Visual inspection method and system for small glass products based on finite element method
The DLHPDE model is improved through the finite element method, and the edge distortion problem in visual detection of small-piece glass products is solved, achieving high-precision denoising effect and significantly improving the signal-to-noise ratio.
Patent Information
- Application Number
- CN202211439395.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-11-17
AI Technical Summary
In the visual detection of small glass products, the human eye detection accuracy and yield are insufficient, and the traditional denoising algorithm causes image edge distortion, the finite difference method has limited accuracy and high requirements for geometric areas.
Using the DLHPDE model based on the finite element method, we can improve partial differential equations by constructing weight values and using the finite element method to solve the weak marginalization problem and improve the calculation accuracy and efficiency.
It effectively protects the edge information of the image and improves the denoising effect. The signal-to-noise ratio reaches 37.14, which is significantly better than the 11.21 of the traditional method.
Smart Images

Figure CN115760617B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a visual inspection method and system for small glass products based on a finite element method. Background Art
[0002] Defect detection of small glass products is a key step in controlling the quality of mobile phones. Currently, most practices use human eyes to detect defects in small glass products, but the accuracy and output of human eye detection are inferior to industrial automated visual inspection.
[0003] For glass products, glass is transparent or translucent under normal ambient light. If too much image processing, such as weak edge processing, is performed on the original image during the image processing process, it is easy to cause distortion of the true value, resulting in inaccurate or erroneous detection.
[0004] During the visual inspection process, the image usually needs to be denoised to ensure the realization of defect detection. However, the usual denoising algorithm will lead to weak marginalization. The use of partial differential equation image processing can effectively alleviate the impact of weak marginalization.
[0005] Methods in the prior art, such as the finite difference method, are the main tools for solving partial differential equations in image processing. However, the accuracy achieved by the finite difference method is limited and has high requirements on the geometric area. Summary of the Invention
[0006] In response to the shortcomings of existing algorithms, the present invention utilizes the DLHPDE model in partial differential equation image processing and solves the numerical solution of the model through the finite element method to solve the weak marginalization problem in the denoising process of glass product image detection in the existing technology. The finite element method has high calculation accuracy and can approximate the boundaries of regions with complex geometric shapes, effectively improving the efficiency of finite element pre-processing.
[0007] The technical solution adopted by the present invention is: a visual inspection method for small glass products based on the finite element method comprises the following steps:
[0008] Step 1: Capture images of glass products with defects;
[0009] Furthermore, defects include: scratches, chipped edges, concave and convex spots, ink shortage, light leakage, ink overflow, white spots, whitening, prism damage, point damage, dust, prism dirt, and spots.
[0010] Step 2: Construct a DLHPDE model and calculate the weight value through the DLHPDE model;
[0011] Furthermore, the weight value formula is:
[0012]
[0013] Among them, P x,y and P x',y' The pixel u x,y As the center and pixel u x',y' The image block centered on the image block, δ represents the image block P x,y The neighborhood block set of .
[0014] Step 3: Improve the DLHPDE model using the finite element method and solve the partial differential equation according to different weight values;
[0015] Further, it specifically includes:
[0016] Step 31, define the finite element space;
[0017] Further, it specifically includes:
[0018] Assume that the coordinates of the four grid nodes of the image are A1(x1,y1),A2(x2,y2),A3(x3,y3),A4(x4,y4), and the basis functions are:
[0019]
[0020]
[0021]
[0022]
[0023] Let the polynomial space S h satisfy:
[0024]
[0025] in, is a complete Hilbert space, P2(τ) represents a quadratic polynomial on τ, V h is the finite element space;
[0026] Let the finite element space V h satisfy:
[0027]
[0028] Where T is T h Any element of p j (x,y) is the basis function, a j (t) is any continuous function related to t, E is the time cutoff point;
[0029] Then any element of the finite element space is expressed as
[0030] Step 32: Use the variational principle to transform the partial differential equation into an approximation problem, and discretize the approximation problem to obtain a discrete problem;
[0031] Further, specifically including:
[0032] Discretize the time interval [0, E], set 0 = t 0 <t 1 <...<t N =E,I n =(t n ,t n+1 ], time step Δt = t n+1 -t n , n=0,1,2,...,N-1; define the spatiotemporal region X=Ω×[0,E], where Ω is the corresponding region of the image, At time t n ,
[0033] When h→0, the diffusion model is varied to obtain:
[0034]
[0035] in, u、
[0036] Using the backward Euler method for time discretization, we can get:
[0037]
[0038] Assuming the image size is M*N, the solution to the PM model becomes:
[0039] Known Solution
[0040] Where, N'=M*N;
[0041] Step 33: Use the finite element method to convert the discrete problem into a linear equation system, and solve the linear equation system;
[0042] Further, specifically including:
[0043] When h approaches 0, the iterative format is discretized into a matrix form, which is:
[0044]
[0045] Assume N'=M*N, A' is an N'*N' matrix, B is an N'*1 matrix, and F is an N'*1 matrix. The matrix form of the discrete problem is:
[0046] A'*B=F
[0047] in, A' i,j is the element in the i-th row and j-th column of matrix A'; B j is the element in the jth row of matrix B, F j is the element in the j-th row of matrix F;
[0048] The problem is thus transformed into:
[0049] B=A' -1 F
[0050] Furthermore, it also includes:
[0051] When h does not approach 0, the pixel point is a noise reduction point, and the diffusion model iteration problem can be transformed into:
[0052]
[0053] Discrete the iterative problem into matrix form:
[0054] Assume W is an N'*N' matrix, B is an N'*1 matrix, and Q is an N'*1 matrix. The matrix form of the discrete problem is:
[0055] WB=Q,
[0056] in,
[0057]
[0058] Among them, B j is the element in the jth row of matrix B, Q j is the element in the j-th row of matrix Q;
[0059] The problem is thus transformed into:
[0060] B=W -1 Q.
[0061] Step 4: Output the denoised image.
[0062] A system for visual inspection of small glass products based on the finite element method, comprising:
[0063] An acquisition module, used for acquiring images of glass products with defects;
[0064] The first calculation module is used to construct a DLHPDE model and calculate the weight value through the DLHPDE model;
[0065] The second calculation module uses the finite element method to improve the DLHPDE model and solve the partial differential equation according to different weight values;
[0066] Output module, used to output the denoised image.
[0067] Beneficial effects of the present invention:
[0068] 1. The ID model, PM model, and DLHPDE model are used to denoise the glass product images affected by noise. The DLHPDE model better protects edge information.
[0069] 2. Based on the DLHPDE model, FDM and FEM are used to denoise the image. The signal-to-noise ratio corresponding to FEM is 37.14, and the signal-to-noise ratio corresponding to FDM is 11.21. The FEM method has better denoising effect than the FDM method. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 is a flow chart of a visual inspection method for small glass products based on the finite element method of the present invention;
[0071] Figure 2 This is a schematic diagram of node selection for the bilinear quadratic interpolation function;
[0072] Figure 3 is the acquired image affected by noise;
[0073] Figure 4 This is a comparison chart of the denoising effects of the ID model, PM model and the method of the present invention. DETAILED DESCRIPTION
[0074] The present invention will be further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.
[0075] The imaging conditions of glass products are very strict. When light hits a transparent object, three situations will occur: part of it is refracted, part of it is reflected, and part of it is absorbed. Only the reflected light can form an image, and the reflected light is usually relatively weak.
[0076] Brightfield lighting illuminates the surface of an object directly at an angle of incidence between 45° and 90°. This direct illumination of the surface by the light source results in a significant amount of reflected light entering the lens, making conventional brightfield lighting less suitable for mirrored objects. Darkfield lighting illuminates the object from a low angle. Light reflected from smooth surfaces at angles less than 45 degrees will be scattered in all directions, preventing it from reaching the lens and creating a darker image. Concave or convex areas, on the other hand, reflect light at a greater angle, allowing more reflected light to enter the lens, resulting in a brighter image. Darkfield lighting contrasts the smooth surface of the light source's color with the bright concave and convex areas, highlighting edges and damage. Therefore, for imaging glass products, the optical solution employs the principles of brightfield and darkfield imaging.
[0077] Table 1: Imaging solutions for scratches, chipping, concave and convex spots, ink shortage, light leakage, ink overflow, white spots, and whitening:
[0078]
[0079] Table 2: Imaging solutions for prism damage, spot damage, dust, prism dirt, and spots:
[0080]
[0081] like Figure 1 As shown, a visual inspection method for small glass products based on the finite element method includes the following steps:
[0082] Step 1: Capture images of glass products with defects;
[0083] Defects include: scratches, chipped edges, bumps, ink shortages, light leakage, ink overflow, white spots, whitening, prism scratches, dot scratches, dust, prism dirt, and dots.
[0084] Step 2: Construct the DLHPDE model and calculate the weight value through the DLHPDE model:
[0085] Classical filtering methods are often used in image denoising, while partial differential equation image processing methods are less used. Partial differential equation image processing can maintain edges while smoothing noise, which is conducive to constructing high-speed, correct and stable algorithms. Partial differential equations are an important component of mathematical analysis and one of the complex tools for image processing. Their essence is to transform discrete, chaotic and disorganized digital images into continuous mathematical models through technical means to form certain physical laws. They refer to similar images. Once the existence and uniqueness of the solution are proved, it needs to be discretized to find a numerical solution. Reasoning in a continuous framework can make it easier to understand physical reality.
[0086] The DLHPDE model is selected as a method for partial differential equation image processing, which effectively solves the problem of weak marginalization through partial differential equations;
[0087] There are many methods for image processing using partial differential equations, but not all of them can achieve edge preservation during the denoising process for glass products. For example, the denoising results of the traditional ID model (Isotropic Diffusion) usually severely blur the image edges. The PM model (Perona-Malik) is an anisotropic diffusion model constructed by Perona and Malik to solve the problem of denoising while better preserving the image edges. This model can adaptively control the diffusion speed in the edge and non-edge areas of the image, and can achieve a good strong edge preservation effect. The problem of weak edge preservation can be effectively solved through partial differential equations, and the ID model and PM model are combined to use the ID model during smoothing.
[0088] Step 2: Calculate the weight value through the DLHPDE model and use the weight value;
[0089] The calculation formula of the weight value h is:
[0090]
[0091] Among them, P x,y and P x',y' The pixel u x,y As the center and pixel u x',y' The image block centered on the image block, δ represents the image block P x,y The neighborhood block set of .
[0092] When h→0, the diffusion model is changed to an improved model with edge features, that is, solving u to satisfy:
[0093]
[0094] in, is a unit vector in any direction, u0(x,y) is a noise image, Ω is an image subset, c(·) is a diffusion coefficient, and satisfies c(0) = 1, and its size adaptively controls the diffusion intensity in different areas of the image. Usually, the following two diffusion coefficients are used: or Among them, k is the edge threshold parameter; Indicates the boundaries of the image.
[0095] When h does not approach 0, the pixel point is a noise reduction point, and the diffusion model is an improved ID model with strong noise reduction ability, that is, the solution u satisfies:
[0096]
[0097] Step 3: Use the finite element method to improve the DLHPDE model and solve the partial differential equation;
[0098] The finite element method is used to process the DLHPDE model, which has high calculation accuracy, can approximate the boundaries of regions with complex geometric shapes, and effectively improve the efficiency of finite element pre-processing.
[0099] Numerical partial differential equation methods are the primary computational tool for solving DLHPDE models. This step is crucial, as it directly impacts the convergence, stability, and computational complexity of the solution. Numerical solutions to partial differential equations typically begin by meshing the problem domain. Then, using numerical methods such as the finite element method, finite difference method, and iterative methods, the original problem or its equivalent form is discretized and reduced to a system of linear algebraic equations. Ultimately, an approximation of the exact solution at the discrete grid points is obtained on a computer.
[0100] The finite element method has better geometric adaptability, can well approximate the boundaries of geometrically complex regions, and has high calculation accuracy. At the same time, since the finite element method is a commonly used engineering analysis tool, using the finite element method for numerical solution can effectively improve the efficiency of finite element pre-processing.
[0101] Step 31: Define the finite element space V h ;
[0102] like Figure 2 , the image grid is divided into square grids, and the pixel value of any point in the square grid is approximated by the Q1 element, that is, the bilinear quadratic interpolation function and the pixel values of the four nodes of the square grid;
[0103] Specifically include:
[0104] The square grid division of the image is denoted as T h ; T∈T h , T is any element v of Th| τ ∈P2(τ), Where P2(τ) represents a quadratic polynomial on τ;
[0105] Assume that the coordinates of the four grid nodes of the image are A1(x1,y1), A2(x2,y2), A3(x3,y3), and A4(x4,y4), then the basis functions are:
[0106]
[0107]
[0108]
[0109]
[0110] Let the polynomial space S h satisfy:
[0111]
[0112] in, It is a complete Hilbert space, and the function value is zero on the Ω boundary;
[0113] Let the finite element space V h satisfy:
[0114]
[0115] Where T is T h Any element of p j (x,y) is the basis function, a j (t) is any continuous function related to t, E is the time cutoff point;
[0116] Then any element of the finite element space can be expressed as
[0117] Step 32: Use the variational principle to transform the partial differential equation into an approximation problem, and discretize the approximation problem to obtain a discrete problem;
[0118] Specifically include:
[0119] Discretize the time interval [0, E], set 0 = t 0 <t 1 <...<t N =E,I n =(t n ,t n+1 ], time step Δt = t n+1 -t n , n=0,1,2,...,N-1; define the spatiotemporal region X=Ω×[0,E], where Ω is the corresponding region of the image, At time t n ,
[0120] When h→0, the diffusion model is varied to:
[0121]
[0122] Among them, u,
[0123] Using the backward Euler method for time discretization, we can get:
[0124]
[0125] Assuming the image size is M*N, the solution to the PM model becomes:
[0126] Known Solution
[0127] Where, N'=M*N;
[0128] Step 33: Use the finite element method to convert the discrete problem into a linear equation system, and solve the linear equation system;
[0129] Specifically include:
[0130] When h approaches 0, the iterative format is discretized into a matrix form, which is:
[0131]
[0132] Assume N'=M*N, A' is an N'*N' matrix, B is an N'*1 matrix, and F is an N'*1 matrix. The matrix form of the discrete problem is:
[0133] A'*B=F
[0134] in, A' i,j is the element in the i-th row and j-th column of matrix A'; B j is the element in the jth row of matrix B, F j is the element in the j-th row of matrix F;
[0135] The problem is thus transformed into:
[0136] B=A' -1 F
[0137] When h does not approach 0, the pixel point is a noise reduction point, and the diffusion model iteration problem can be transformed into:
[0138]
[0139] Discrete the iterative problem into matrix form:
[0140] Assume W is an N'*N' matrix, B is an N'*1 matrix, and Q is an N'*1 matrix. The matrix form of the discrete problem is:
[0141] WB=Q,
[0142] in,
[0143]
[0144] Among them, B jis the element in the jth row of matrix B, Q j is the element in the j-th row of matrix Q;
[0145] The problem is thus transformed into:
[0146] B=W -1 Q
[0147] Step 4: Output the denoised image;
[0148] In order to compare the advantages and disadvantages of each model, the time step Δt = 0.2 is taken, and the collected glass product images affected by noise are respectively Figure 4 (a) is the ID model, Figure 4 (b) is the PM model and Figure 4 (c) shows the denoising process of the FEM-improved DLHPDE model. Both the ID model and the PM model can achieve denoising effects, but the DLHPDE model better protects edge information.
[0149] right Figure 3 In the image processing affected by noise, based on the DLHPDE model, the finite difference method (FDM) and the finite element method (FEM) are used to denoise the image. The signal-to-noise ratio corresponding to FEM is 37.14, and the signal-to-noise ratio corresponding to FDM is 11.21. The FEM method has better denoising effect than the FDM method.
[0150] With the above-described preferred embodiments of the present invention as a guide, and with reference to the above description, relevant personnel are fully capable of making various changes and modifications without departing from the technical scope of this invention. The technical scope of this invention is not limited to the contents of the specification and must be determined according to the scope of the claims.
Claims
1. A visual inspection method for small glass products based on the finite element method, characterized in that: The following steps are involved: Step 1: Capture images of glass products with defects; Step 2: Construct a DLHPDE model and calculate the weight value through the DLHPDE model; Step 3: Improve the DLHPDE model using the finite element method and solve the partial differential equation according to different weight values; Step three specifically includes: Step 31: define the finite element space; Step 31 specifically includes: Assume that the coordinates of the four grid nodes of the image are , the basis functions are: Let polynomial space satisfy: in, is a complete Hilbert space, express A quadratic polynomial on , is the finite element space; Let the finite element space satisfy: in, T yes Any element of is the basis function, For any t The continuous function is related to E, which is the time cutoff point; Then any element of the finite element space is expressed as ; Step 32: Use the variational principle to transform the partial differential equation into an approximation problem, and discretize the approximation problem to obtain a discrete problem; Step 32 specifically includes: Discretize the time interval [0,E], let , time step ;in, is the corresponding area of the image, At the moment , ; Assume the image size is M N, the solution to the PM model becomes: Known , solve ; in, N ’ =M N; Step 33: Use the finite element method to convert the discrete problem into a linear equation system, and solve the linear equation system; Step 33 specifically includes: When h approaches 0, the iterative format is discretized into a matrix form, which is: set up N ’ =M N, A ’ for N ’ N ’ matrix, B for N ’ 1 matrix, F for N ’ 1 matrix, the matrix form of the discrete problem is: A ’ B = F in, , is a matrix A ’ Middle i Row, No. j Elements of the column; , is a matrix B Middle j Elements of the row, is a matrix F Middle j Elements of the row; The problem is thus transformed into: ; Step 4: Output the denoised image.
2. The visual inspection method for small glass products based on the finite element method according to claim 1, characterized in that: The defects in step one include: scratches, chipped edges, concave and convex spots, ink shortage, light leakage, ink overflow, white spots, whitening, prism damage, point damage, dust, prism dirt, and spots.
3. The visual inspection method for small glass products based on the finite element method according to claim 1, characterized in that: The weight calculation formula in step 2 is: in, and Pixels Centered and pixel-based The image patch centered on Represents an image block The neighborhood block set of .
4. The visual inspection method for small glass products based on the finite element method according to claim 1, characterized in that: Step 33 also includes: When h does not approach 0, the pixel point is a noise reduction point, and the diffusion model iteration problem can be transformed into: set up W for N ’ N ’ matrix, B for N ’ 1 matrix, Q for N ’ 1 matrix, the matrix form of the discrete problem is: WB = Q , in, ; in, is a matrix B Middle j Elements of the row, is a matrix Q Middle j Elements of the row; The problem is thus transformed into: 。 5. A system using the visual inspection method for small glass products based on the finite element method according to any one of claims 1 to 4, characterized in that: include: An acquisition module, used for acquiring images of glass products with defects; The first calculation module is used to construct a DLHPDE model and calculate the weight value through the DLHPDE model; The second calculation module uses the finite element method to improve the DLHPDE model and solve the partial differential equation according to different weight values; Output module, used to output the denoised image.
Citation Information
Patent Citations
Image denoising method combining wavelet packet and partial differential equation
CN108805845A
Apparatus and method for efficient adaptation of finite element meshes for numerical solutions of partial differential equations
US20040133616A1