A method for detecting defects in the window area of ​​mobile phone glass cover based on symmetry

Through the symmetry-based window area defect detection method, using black and white periodic stripe structured light and image enhancement algorithms, combined with sub-pixel edge detection and Hough line detection, the problem of low manual visual inspection efficiency in glass cover inspection is solved and high efficiency is achieved. Precise and automated defect detection, suitable for different types of glass covers.

CN114881915BActive Publication Date: 2024-10-22XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210128421.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2024-10-22
Estimated Expiration
2042-02-11

AI Technical Summary

Technical Problem

Existing glass cover defect detection mainly relies on manual visual inspection, which has problems such as low efficiency and high missed detection and false detection rates. It also causes damage to the vision of quality inspectors. Manufacturers face challenges of recruitment difficulties and high labor costs.

Method used

Using a symmetry-based defect detection method in the window area of ​​the mobile phone glass cover, the image sequence is captured through black and white periodic stripe structured light, combined with the image enhancement algorithm, sub-pixel contour extraction and improved Hough line detection, taking advantage of the axial symmetry characteristics of the glass cover, Automatically detect defects in the window area.

Benefits of technology

It achieves high-precision detection of defects in the window area of ​​the glass cover, reduces labor costs, improves production efficiency, is suitable for the detection of different types of glass cover, and overcomes the shortcomings of traditional template matching methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114881915B_ABST
    Figure CN114881915B_ABST
Patent Text Reader

Abstract

A method for detecting defects in the window area of ​​a mobile phone glass cover based on symmetry, the invention relates to the detection of defects in the mobile phone glass cover, and the defect enhancement image is calculated from the image sequence taken by black and white periodic structured light, and then pre-processed for denoising. The ROI is extracted, and then the contour of the window area is extracted twice by a sub-pixel edge detection method, which is the real contour edge and the standard contour edge of the straight line fitting, and the symmetry axis is calculated. The edge collapse and burrs are detected according to the difference between the two contours. The pixel points at the corresponding positions on both sides of the symmetry axis are subtracted in the spatial domain, and the difference information is used to extract a binary image of only the defective area to detect defects on the surface of the window area. The detection method of the present invention overcomes the problem that traditional template matching requires a standard template and cannot adapt to the detection of multiple models, and can realize fast and high recognition rate automatic detection of defects in the window area of ​​mobile phone glass cover.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of glass defect detection, and in particular to a method for detecting defects in a window area of ​​a mobile phone glass cover plate based on symmetry. Background Art

[0002] With the continuous development of technologies such as wireless charging and 5G, glass has become the preferred raw material for mobile phone cover manufacturers due to its good mechanical and optical properties and low cost compared to ceramic materials. However, as the outermost layer of the mobile phone and a component that consumers often touch, the glass cover will inevitably produce various defects with different characteristics during the production process, including scratches, pits, broken edges, impurities, discoloration and other common defects. Before leaving the factory, manufacturers and purchasers will require strict quality inspection processes to monitor the production quality of the products and improve their product competitiveness.

[0003] Now other production processes of glass cover production lines have been automated, but defect detection still all uses manual visual inspection methods. This method cannot accurately quantify defects and is easily affected by human subjective consciousness, so there are problems of low efficiency and high missed detection and false detection rate. Quality inspectors need to be in a dark environment, but the inspection station is in a high-intensity light environment, which also damages the eyesight of quality inspectors to a certain extent. Manufacturers are also facing difficulties in recruiting workers and high labor costs. There is an urgent need to introduce advanced automatic inspection equipment to reduce labor costs and improve production efficiency. Summary of the invention

[0004] In order to solve the above problems, the present invention provides a method for detecting defects in the window area of ​​a mobile phone glass cover based on symmetry, which is suitable for detecting defects in the middle window area of ​​a mobile phone glass cover. First, a sequence of multiple glass cover images is captured using black and white periodic stripe structured light, and then a final defect enhanced image is obtained through an image enhancement algorithm, in which the defective area will be darker and the non-defective area will be brighter, thereby achieving the purpose of highlighting the defect.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is:

[0006] A method for detecting defects in a mobile phone glass cover window area based on symmetry, characterized in that it comprises the following steps:

[0007] 1) Image data acquisition

[0008] A periodically moving black and white periodic stripe structured light is projected onto the display, and the defect enhancement image is calculated through the image sequence taken by the area array camera; the black and white periodic stripe image displayed on the screen can be expressed as:

[0009]

[0010] In the formula, f db (x, y) represents the gray value of the pixel at the coordinate (x, y) of the black and white periodic stripe image, T is the period of the black and white periodic stripe image, δ is the width of the white stripe in the black and white periodic stripe, T is 4 times of δ, w is the width of the black and white periodic stripe image, and the image of the mobile phone glass cover photographed by the projection and reflection of the black and white periodic stripe light is recorded as I db ;

[0011] The enhanced image of the mobile phone glass cover plate synthesized from the image sequence of the mobile phone glass cover plate photographed by the black and white periodic stripe light reflection can stably improve the contrast between the defect and the background and highlight the defect. The acquisition process of the enhanced image of the mobile phone glass cover plate defect can be expressed as:

[0012]

[0013] In the formula, It represents the pixel grayscale value at the coordinate (x, y) of the defect enhanced image of the mobile phone glass cover obtained by the image enhancement algorithm. N is the total number of images taken. represents the kth mobile phone glass cover image captured;

[0014] 2) Image preprocessing

[0015] The image is first subjected to median filtering, and then morphological closing operation is performed to remove noise interference and reduce burr adhesion; mean square error normalization is then used to reduce the impact of illumination on image grayscale. The calculation formula for the image mean square error is:

[0016]

[0017] Where σ is the standard deviation, M*N represents the size of the image, P(i,j) represents the pixel value of the i-th row and j-th column, and u is the mean value of the pixel;

[0018] The process of normalizing pixel values ​​to a mean of 0 and a variance of 1 can be expressed as:

[0019] P'(i,j)=P(i,j)-uσ

[0020] Where P'(i,j) represents the pixel value of the i-th row and j-th column after mean square error normalization;

[0021] 3) Sub-pixel contour extraction

[0022] First, locate the ROI window area, and then use the sub-pixel edge detection method to extract the contour of the window area twice, including the actual contour edge and the standard contour edge of the straight line fitting; use the discrete image data to establish a quadratic curve edge step model to calculate the sub-pixel edge parameters and complete the edge detection. The quadratic curve can be expressed as:

[0023] y=ax 2 +bx+c

[0024] Among them, a, b, c are the parameters of the quadratic curve.

[0025] For digital images with discrete data, the one-dimensional discrete q-order grayscale moment can be expressed as:

[0026]

[0027] Among them, g i (i=1,2,...,n) is the actual grayscale value in the image, and n is the total number of pixels.

[0028] First, the pixel-level detection operator Sobel operator is used to perform pixel-level edge detection on the image, and then the first-order and second-order grayscale moments of the edge points in the image are calculated, which correspond to q=1 and q=2 in the above grayscale moment formula. Finally, an edge model diagram based on one-dimensional grayscale moment sub-pixel edge detection is established, and all curve edge parameters can be calculated to detect the actual sub-pixel edge contour of the mobile phone glass cover window area. Let the actual sub-pixel contour of the window area be recorded as S real (x,y);

[0029] Hough line detection has strong anti-interference ability and is insensitive to the incomplete parts of the straight line in the image and noise. A ,y A ), point B(x B ,y B ), the inclination angle θ of the straight line AB in the Hough space can be expressed as:

[0030]

[0031] After the actual edge of the mobile phone glass cover is detected, the present invention uses a sub-pixel straight line detection method based on an improved Hough_line to accurately detect S real The straight line in (x, y) is used to avoid the impact of defects such as broken edges and burrs on the edge of the glass cover on the detection. The calculation range of θ is set and a minimum value θ is taken. min and a maximum value θ max , the formula for each point in the Hough space within this range is:

[0032] r ij =x i cosθ j +y i sinθ j

[0033] Among them, r ij is a pixel point on an edge, x iis the horizontal axis, y i is the ordinate. When the number of times r appears is greater than the set threshold, the corresponding points will form a straight line in the plane. j When the minimum value is taken, the straight line obtained is the sub-pixel position of the edge of the window area, and its edge direction is perpendicular to the straight line where the θ direction is located. Let the standard outline of the window area extracted by the improved Hough_line sub-pixel straight line detection method be recorded as S ideal (x, y), let the straight lines of each edge of the standard outline of the window area be expressed in the Cartesian coordinate system as follows:

[0034]

[0035] In the formula, y top ,y bottom ,y left ,y right Respectively represent the ordinates of the mathematical expressions of the lines where the upper, lower, left, and right sides of the standard outline of the window area are located, k i (i=1,2,3,4) represents the slope of each straight line, and k1=k2, k3=k4;

[0036] 4) Calculate the symmetry axis of the window area

[0037] According to the detected standard contour edge, the horizontal symmetry axis and the vertical symmetry axis of the window area surface are calculated; since the window area is almost a standard axisymmetric rectangle, the symmetry axis is parallel to the two sides, that is, its slope is the same as the slope of the two sides. Taking the upper and lower sides as an example, the expression of the straight line where the horizontal symmetry axis is located in the Cartesian linear coordinate system can be set as:

[0038] y symmetry =kx+b

[0039] Where k is the slope, and k=k3=k4, b is the intercept, and b=(b1+b2) / 2;

[0040] 5) Edge defect detection

[0041] According to the difference between the actual contour and the standard contour, the edge collapse and burr defects are detected; according to the production line detection standard, the detection accuracy threshold δ is set, and according to the actual contour S detected in step 3) real (x,y) and the standard contour S ideal (x, y) comparison is used to detect edge collapse and burr defects. The detection process can be expressed as:

[0042]

[0043] 6) Surface defect detection in the window area

[0044] According to the calculated symmetry axis, the subtraction operation of the corresponding pixel points in the spatial domain is performed, and the binary image with only the defect area is extracted using the difference information to detect the defects on the surface of the window area, detect the horizontal symmetry axis and the vertical symmetry axis of the window area, and divide the surface of the window area into two identical upper and lower parts, respectively, denoted as S top (x,y),S bottom (x,y), and the same left and right parts, denoted as S left (x,y),S right (x, y), respectively, the defects on the surface of the window area are detected by a method similar to the traditional template matching method, that is, the pixels on both sides of the symmetry axis are subtracted in the corresponding position in the spatial domain, and the left image S left (x,y) minus the right image S right (x, y) to get the difference information of the two images, and use the upper image S top (x,y) minus the lower image S bottom (x, y) obtains the difference information of the two images, and fuses the results of the upper and lower and left and right detections to obtain the final detection result.

[0045] The horizontal symmetry axis and the vertical symmetry axis detected in step 6) respectively divide the area formed by the standard contour of the mobile phone glass cover into two identical areas.

[0046] The image after defect enhancement will be darker at the defect and brighter at the non-defect. In the digital image, the grayscale value corresponding to the dark area is small, and the grayscale value corresponding to the bright area is large, that is, the difference after subtracting the defect and the non-defect is negative. For defects that cross the axis of symmetry, the positive and negative difference information after image subtraction is judged to determine the specific position of the defect in the image. For the position where the difference is positive, a mirror operation is performed about the axis of symmetry to restore it to the position in the original window area.

[0047] As the image acquisition process is inevitably disturbed by noise, even if the image has been pre-processed and denoised as described above, there will still be a small amount of noise. For the two 1 / 2 areas obtained by dividing the symmetry axis, even the grayscale value difference information obtained from the defect-free background will appear positive or negative instead of the standard 0. The grayscale value mean difference of the two areas on both sides is used as the threshold thresh to further filter the noise. The pixel points with a difference lower than the threshold can be considered as grayscale value fluctuations in a small range caused by noise.

[0048] The beneficial effects of the present invention are:

[0049] The window area of ​​the mobile phone glass cover plate is obviously symmetrical left and right and up and down, which is a major advantage for window area defect detection, but previous studies have ignored this point. The present invention utilizes the axial symmetry of the window area of ​​the mobile phone glass cover plate to propose a simple and fast symmetry-based window area defect detection method to meet the real-time requirements of industrial production line detection. Most traditional template matching methods first extract the corner point features of the pre-processed image for image registration, and then use the difference method to segment the defect area for defect detection. This method requires a perfect standard image to be prepared in advance for comparison, is easily affected by changes in ambient light, and cannot be applied to different models of glass cover plate detection. The present invention utilizes the axial symmetry of the window area of ​​the mobile phone glass cover plate to overcome the shortcomings of traditional template matching and can adapt to various models.

[0050] With the development of science and technology, the edge detection accuracy at the pixel level cannot meet the actual production and application. The method proposed in the present invention first detects the actual edge of the window area using a sub-pixel edge detection method based on a one-dimensional grayscale moment, and then detects the ideal contour of the window area based on a sub-pixel straight line detection method based on an improved Hough_line, and uses the difference between the two to detect the broken edges and burr defects at the edge of the window area of ​​the mobile phone glass cover. When the window area of ​​the mobile phone glass cover is perfect, it is a standard rectangle. After the surface of the window area is divided into two identical areas by the detected horizontal and vertical symmetry axes, the defects on the surface of the window area are detected by the difference between the two areas. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a schematic diagram of the physical principle of light scattering of the present invention;

[0052] Figure 2 This is a schematic structural diagram of the glass cover plate partitions of the present invention;

[0053] Figure 3 It is the window area edge extraction map of the present invention;

[0054] Figure 4 is a schematic diagram of the symmetry axis of the window area of ​​the present invention;

[0055] Figure 5 This is an edge defect detection diagram of the present invention.

[0056] Figure 6 It is a detection flow chart of the present invention. DETAILED DESCRIPTION

[0057] The present invention is further described below in conjunction with the accompanying drawings.

[0058] like Figure 6As shown, in the image data acquisition system, the glass cover plate to be inspected is placed on the online inspection system through the glass cover plate automatic conveying system, and the display screen of the online inspection system shows as follows Figure 1 The black and white periodic stripe image shown in the figure is used as the projection light source, and the controller is used to control the area array camera to capture the black and white periodic stripe image reflected by the glass cover to be tested. The physical diagram of light scattering is shown in Figure 2 As shown; then the black and white periodic stripes are moved rightward as a whole on the display by a fixed step length, and the area array camera takes another image of the glass cover plate; the above steps are repeated until the white stripes have passed a cycle and each pixel on the display screen appears inside the white stripes at least once, and the collected image is transmitted to the corresponding computer processing module through the image acquisition card;

[0059] The black and white periodic stripe image displayed on the screen can be expressed as:

[0060]

[0061] In the formula, f db (x, y) represents the gray value of the pixel at the coordinate (x, y) of the black and white periodic stripe image, T is the period of the black and white periodic stripe image, δ is the width of the white stripe in the black and white periodic stripe, T is 4 times of δ, and w is the width of the black and white periodic stripe image. Let the image of the mobile phone glass cover captured by the projection and reflection of the black and white periodic stripe light be recorded as I db .

[0062] The following involves image processing. In order to achieve sub-pixel precision defect detection in the window area of ​​the mobile phone glass cover, the processing algorithm uses algorithms such as sub-pixel edge detection and improved Hough line detection.

[0063] 1) Calculate the defect enhanced image of mobile phone glass cover

[0064] The enhanced image of the mobile phone glass cover plate synthesized from the image sequence of the mobile phone glass cover plate photographed by black and white periodic stripe light reflection can stably improve the contrast between the defect and the background and highlight the defect. The acquisition process of the enhanced image of the mobile phone glass cover plate defect can be expressed as:

[0065]

[0066] In the formula, It represents the pixel grayscale value at the coordinate (x, y) of the defect enhanced image of the mobile phone glass cover obtained by the image enhancement algorithm. N is the total number of images taken. Indicates the kth mobile phone glass cover image captured.

[0067] 2) Image preprocessing

[0068] Under the influence of the production process of mobile phone glass cover plates and human factors, the image will be disturbed by various noises during the acquisition and transmission process. Performing filtering preprocessing operations on the image can improve the image quality, and suppressing the image noise is helpful for subsequent image processing operations. The present invention adopts median filtering to suppress the random noise introduced by the image during the shooting process. In order to extract clear contours and to make up for the deficiency that the median filter needs a relatively large mask to achieve the effect, the present invention performs morphological closing operations after the median filter to effectively reduce the adhesion of burrs.

[0069] Then, mean square error normalization is used to reduce the influence of illumination on image grayscale. The calculation formula of image mean square error is:

[0070]

[0071] Where σ is the standard deviation, M*N represents the size of the image, P(i,j) represents the pixel value of the i-th row and j-th column, and u is the mean value of the pixel.

[0072] The process of normalizing pixel values ​​to a mean of 0 and a variance of 1 can be expressed as:

[0073] P'(i,j)=P(i,j)-uσ

[0074] Where P'(i,j) represents the pixel value of the i-th row and j-th column after mean square error normalization.

[0075] 3) Sub-pixel contour extraction

[0076] Schematic diagram of mobile phone glass cover partition Figure 3 As shown, the window area of ​​the mobile phone glass cover is mostly a regular rectangle. The left and right boundaries of the window area correspond to the left and right boundaries of the mobile phone glass cover, and the upper and lower boundaries correspond to the junction of the window area and the ink area, that is, there is an obvious grayscale value jump at the edge. First, the ROI window area is extracted using a mask. Taking into account that there may be defects such as broken edges and burrs at the edge of the window area, the present invention performs two contour extractions on the window area, including the actual contour edge and the standard contour edge of the straight line fitting. The actual contour edge is compared with the standard contour edge to detect the broken edges and burr defects at the edge. Then, the symmetry axis of the window area is obtained through the standard contour edge, and the window area defect detection is completed. The detection accuracy of mobile phone glass cover defects is at the micron level. Traditional pixel-level defect detection is difficult to meet high-precision requirements. The present invention uses a sub-pixel edge detection method to detect the actual contour of the window area, and uses discrete image data to establish a quadratic curve edge step model to calculate the sub-pixel edge parameters to complete edge detection. The quadratic curve can be expressed as:

[0077] y=ax 2 +bx+c

[0078] Among them, a, b, c are the parameters of the quadratic curve.

[0079] For digital images with discrete data, the one-dimensional discrete q-order grayscale moment can be expressed as:

[0080]

[0081] Among them, g i (i=1,2,...,n) is the actual grayscale value in the image, and n is the total number of pixels.

[0082] First, the pixel-level detection operator Sobel operator is used to perform pixel-level edge detection on the image, and then the first-order and second-order grayscale moments of the edge points in the image are calculated, which corresponds to q=1 and q=2 in the above grayscale moment formula. Finally, an edge model diagram based on one-dimensional grayscale moment sub-pixel edge detection is established, and all curve edge parameters can be calculated to detect the actual sub-pixel edge contour of the mobile phone glass cover window area. Let the actual sub-pixel contour of the window area be denoted by S real (x,y).

[0083] Hough line detection has strong anti-interference ability and is insensitive to the incomplete parts of the straight line in the image, noise, etc. A ,y A ), point B(x B ,y B ), the inclination angle θ of the straight line AB in the Hough space can be expressed as:

[0084]

[0085] After the actual edge of the mobile phone glass cover is detected, the present invention uses a sub-pixel straight line detection method based on an improved Hough_line to accurately detect S real The straight line in (x, y) avoids the defects such as broken edges and burrs at the edge of the glass cover that may affect the detection. In the traditional Hough straight line detection, θ is generally set to 0-180°. The present invention resets the calculation range of θ and takes a minimum value θ min and a maximum value θ max , the formula for each point in the Hough space within this range is:

[0086] r ij =x i cosθ j +y i sinθ j

[0087] Among them, r ij is a pixel point on an edge, x i is the horizontal axis, y iis the ordinate. When the number of times r appears is greater than the set threshold, the corresponding points will form a straight line in the plane. j When the minimum value is taken, the straight line obtained is the sub-pixel position of the edge of the window area, and its edge direction is perpendicular to the straight line where the θ direction is located. Let the standard outline of the window area extracted by the improved Hough_line sub-pixel straight line detection method be recorded as S ideal (x, y). Let the straight lines of each edge of the standard outline of the window area be expressed in the Cartesian coordinate system as:

[0088]

[0089] In the formula, y top ,y bottom ,y left ,y right Respectively represent the ordinates of the mathematical expressions of the lines where the upper, lower, left, and right sides of the standard outline of the window area are located, k i (i=1,2,3,4) represents the slope of each straight line, and k1=k2,k3=k4. Figure 4 As shown, the straight line where the diagonal line of the window area of ​​the mobile phone glass cover is located is selected as the coordinate axis to avoid the situation where the slope of the straight line where the edge is located does not exist.

[0090] 4) Calculate the axis of symmetry

[0091] In step 4, the actual curve profile and standard profile of the window area and the mathematical expression of the line or curve corresponding to each edge are obtained. In order to avoid the possible edge collapse and burr defects at the edge of the window area affecting the high-precision detection of the symmetry axis of the window area, the present invention uses the standard profile to detect the horizontal symmetry axis corresponding to the upper and lower edges of the window area and the vertical symmetry axis corresponding to the left and right edges. Since the window area is almost a standard axisymmetric rectangle, the symmetry axis is parallel to the two sides, that is, its slope is the same as the slope of the two sides. Taking the upper and lower sides as an example, the expression of the line where the horizontal symmetry axis is located in the Cartesian linear coordinate system can be set as:

[0092] y symmetry =kx+b

[0093] Where k is the slope, and k=k3=k4, b is the intercept, and b=(b1+b2) / 2.

[0094] 5) Defect Detection

[0095] For defect detection of the window area of ​​the mobile phone glass cover, the present invention divides it into two parts, the edge and the window area surface, and detects them separately.

[0096] a) Edge defect detection

[0097] Set the detection accuracy threshold δ according to the production line detection standard, such as Figure 5 As shown, the actual contour S detected in step 4 real (x,y) and the standard contour S ideal (x, y) comparison is used to detect edge collapse and burr defects. The detection process can be expressed as:

[0098]

[0099] A result of 1 indicates that the sub-pixel point in the actual contour is determined to be a defect.

[0100] b) Surface defect detection in window area

[0101] Step 5: Detect the horizontal and vertical symmetry axes of the window area, and divide the surface of the window area into two identical upper and lower parts, denoted as S top (x,y),S bottom (x,y), and the same left and right parts, denoted as S left (x,y),S right (x, y), we use a method similar to traditional template matching to detect defects on the surface of the window area, that is, the pixels on both sides of the symmetry axis are subtracted in the spatial domain at corresponding positions, and the left image S left (x,y) minus the right image S right (x, y) to get the difference information of the two images, and use the upper image S top (x,y) minus the lower image S bottom (x, y) obtains the difference information of the two images, and fuses the results of the upper and lower and left and right detections to obtain the final detection result.

[0102] Furthermore, as mentioned above, the image after defect enhancement will be darker at the defect location and brighter at the non-defect location. In the digital image, the grayscale value corresponding to the dark location is small, and the grayscale value corresponding to the bright location is large, that is, the difference between the defect location and the non-defect location is negative. In combination with this feature, the present invention determines the positive or negative difference information after image subtraction to determine the specific location of the defect in the image for defects that cross the symmetry axis. For the location with a positive difference, a mirror operation is performed on it about the symmetry axis to obtain the location in the original window area. For example, S left (x,y) minus S right (x, y), if the difference of one pixel is positive, the defect point is located at S right (x,y) area, otherwise it is in S left (x,y) region, because S left (x,y) and S right(x, y) is symmetric about the symmetry axis, and the difference information is only included in the 1 / 2 area of ​​the original window area, so it is necessary to perform a mirror operation about the symmetry axis for the position where the difference is positive to restore its true position in the original window area, and obtain the grayscale image of the defect area, which is recorded as I sub (x, y). Furthermore, since the image acquisition process will inevitably be disturbed by noise, even if the image has been pre-processed and denoised as described above, there will still be a small amount of noise. For the two 1 / 2 areas obtained by segmentation by the symmetry axis, even the grayscale value difference information obtained from the defect-free background will appear positive or negative instead of the standard 0. Therefore, the present invention uses the grayscale value mean difference of the two side areas as the threshold thresh to further filter the noise. The pixel points whose difference is lower than the threshold can be considered as grayscale value fluctuations in a small range caused by noise.

[0103] Furthermore, in the production process of mobile phone glass cover plates, the area of ​​defects is mostly much smaller than the area of ​​the background area, so the grayscale value of the background in the image is very close to the grayscale average value of the entire image. Considering that for the image obtained by the lighting method adopted by the present invention, the defects appear darker, so only the noise imaged as dark colors will affect the detection, and the background grayscale value fluctuation caused by noise is generally in a very small range, generally around 5 grayscale values. Considering that the probability of defects on the actual mobile phone glass cover plate production line is very small, most products are defect-free. In order to ensure that the selected threshold thresh correctly detects defect-free glass cover plates with dark noise, the present invention introduces an offset offset to filter the noise within the fluctuation range of the offset to avoid false detection. Pixels with grayscale values ​​lower than thresh+offset are caused by noise, and the threshold is corrected to thresh+offset.

[0104] Furthermore, the grayscale image of the defective area on the window area contains both a black background part and a defective part or a noise part of different grayscales. In order to extract a binary image of only the defective area, the defective area and the background area of ​​the image are subjected to binary segmentation processing. While judging the noise and the defect, the present invention performs a binary processing on the defective grayscale image, so that the background is black (0) and the defective area on the window area is white (255).

[0105]

[0106]

[0107] Where N1 is S left The total number of pixels in the (x,y) region, Indicates S left The grayscale average value in the (x, y) area, N2 is Sright The total number of pixels in the (x,y) region, Indicates S right The average grayscale value in the (x,y) region.

[0108] After the defects are segmented according to the grayscale average value, the specific position of the defect is determined according to the positive or negative difference. For the position where the difference is positive, a mirror operation about the symmetry axis is performed to restore its true position in the original window area. The process of determining the position can be expressed as:

[0109] I sub (x,y)=S1(x,y)-S2(x,y)

[0110]

[0111] Furthermore, the present invention describes a method for detecting defects in the window area of ​​a mobile phone glass cover plate based on symmetry. It utilizes the axial symmetry of the window area of ​​the glass cover plate of the mobile phone to be tested. Different from the traditional template matching algorithm, it overcomes the limitation that the traditional template matching requires a standard template, and can be applied in scenarios with a large number of product types and rapid updates.

Claims

1. A method for detecting defects in the window area of ​​a mobile phone glass cover based on symmetry, characterized in that: The steps include: 1) Image data acquisition A periodically moving black and white periodic stripe structured light is projected onto the display, and the defect enhancement image is calculated through the image sequence taken by the area array camera; the black and white periodic stripe image displayed on the screen can be expressed as: In the formula, f db (x, y) represents the gray value of the pixel at the coordinate (x, y) of the black and white periodic stripe image, T is the period of the black and white periodic stripe image, δ is the width of the white stripe in the black and white periodic stripe, T is 4 times of δ, w is the width of the black and white periodic stripe image, and the image of the mobile phone glass cover photographed by the projection and reflection of the black and white periodic stripe light is recorded as I db ; The enhanced image of the mobile phone glass cover plate synthesized from the image sequence of the mobile phone glass cover plate photographed by the black and white periodic stripe light reflection can stably improve the contrast between the defect and the background and highlight the defect. The acquisition process of the enhanced image of the mobile phone glass cover plate defect can be expressed as: In the formula, It represents the pixel grayscale value at the coordinate (x, y) of the defect enhanced image of the mobile phone glass cover obtained by the image enhancement algorithm. N is the total number of images taken. represents the kth mobile phone glass cover image captured; 2) Image preprocessing The image is first subjected to median filtering, and then morphological closing operation is performed to remove noise interference and reduce burr adhesion; mean square error normalization is then used to reduce the impact of illumination on image grayscale. The calculation formula for the image mean square error is: Where σ is the standard deviation, M*N represents the size of the image, P(i,j) represents the pixel value of the i-th row and j-th column, and u is the mean value of the pixel; The process of normalizing pixel values ​​to a mean of 0 and a variance of 1 can be expressed as: P'(i,j)=P(i,j)-uσ Where P'(i,j) represents the pixel value of the i-th row and j-th column after mean square error normalization; 3) Sub-pixel contour extraction First, locate the ROI window area, and then use the sub-pixel edge detection method to extract the contour of the window area twice, including the actual contour edge and the standard contour edge of the straight line fitting; use the discrete image data to establish a quadratic curve edge step model to calculate the sub-pixel edge parameters and complete the edge detection. The quadratic curve can be expressed as: y=ax 2 +bx+c Among them, a, b, c are the parameters of the quadratic curve; For digital images with discrete data, the one-dimensional discrete q-order grayscale moment can be expressed as: Among them, g i (i=1,2,...,n) is the actual grayscale value in the image, and n is the total number of pixels; First, the pixel-level detection operator Sobel operator is used to perform pixel-level edge detection on the image, and then the first-order and second-order grayscale moments of the edge points in the image are calculated, which correspond to q=1 and q=2 in the above grayscale moment formula. Finally, an edge model diagram based on one-dimensional grayscale moment sub-pixel edge detection is established, and all curve edge parameters can be calculated to detect the actual sub-pixel edge contour of the mobile phone glass cover window area. Let the actual sub-pixel contour of the window area be recorded as S real (x,y); Hough line detection has strong anti-interference ability and is insensitive to the incomplete parts of the straight line in the image and noise. A ,y A ), point B(x B ,y B ), the inclination angle θ of the straight line AB in the Hough space can be expressed as: After the actual edge of the mobile phone glass cover is detected, the present invention uses a sub-pixel straight line detection method based on an improved Hough_line to accurately detect S real The straight line in (x, y) is used to avoid the impact of defects such as broken edges and burrs on the edge of the glass cover on the detection. The calculation range of θ is set and a minimum value θ is taken. min and a maximum value θ max , the formula for each point in the Hough space within this range is: r ij =x i cosθ j +y i sinθ j Among them, r ij is a pixel point on an edge, x i is the horizontal axis, y i is the ordinate; when the number of times r appears is greater than the set threshold, the corresponding points will form a straight line in the plane. j When the minimum value is taken, the straight line obtained is the sub-pixel position of the edge of the window area, and its edge direction is perpendicular to the straight line where the θ direction is located. Let the standard outline of the window area extracted by the improved Hough_line sub-pixel straight line detection method be recorded as S ideal (x, y), let the straight lines of each edge of the standard outline of the window area be expressed in the Cartesian coordinate system as follows: In the formula, y top ,y bottom ,y left ,y right Respectively represent the ordinates of the mathematical expressions of the lines where the upper, lower, left, and right sides of the standard outline of the window area are located, k i (i=1,2,3,4) represents the slope of each straight line, and k1=k2, k3=k4; 4) Calculate the symmetry axis of the window area According to the detected standard contour edge, the horizontal symmetry axis and the vertical symmetry axis of the window area surface are calculated; since the window area is almost a standard axisymmetric rectangle, the symmetry axis is parallel to the two sides, that is, its slope is the same as the slope of the two sides. Suppose the expression of the line where the horizontal symmetry axis is located in the Cartesian linear coordinate system is: yes symmetry =kx+b Where k is the slope, and k=k3=k4, b is the intercept, and b=(b1+b2) / 2; 5) Edge defect detection According to the difference between the actual contour and the standard contour, the edge collapse and burr defects are detected; according to the production line detection standard, the detection accuracy threshold δ is set, and according to the actual contour S detected in step 3) real (x,y) and the standard contour S ideal (x, y) comparison is used to detect edge collapse and burr defects. The detection process can be expressed as: 6) Surface defect detection in the window area According to the calculated symmetry axis, the subtraction operation of the corresponding pixel points in the spatial domain is performed, and the binary image with only the defect area is extracted using the difference information to detect the defects on the surface of the window area, detect the horizontal symmetry axis and the vertical symmetry axis of the window area, and divide the surface of the window area into two identical upper and lower parts, respectively, denoted as S top (x,y),S bottom (x, y), and the same left and right parts, denoted as S left (x,y),S right (x, y), respectively, the defects on the surface of the window area are detected by a method similar to the traditional template matching method, that is, the pixels on both sides of the symmetry axis are subtracted in the corresponding position in the spatial domain, and the left image S left (x,y) minus the right image S right (x, y) to get the difference information of the two images, and use the upper image S top (x,y) minus the lower image S bottom (x, y) obtains the difference information of the two images, and fuses the results of the upper and lower and left and right detections to obtain the final detection result.

2. The method for detecting defects in the window area of ​​a mobile phone glass cover plate based on symmetry according to claim 1, characterized in that: The horizontal symmetry axis and the vertical symmetry axis detected in step 6) respectively divide the area formed by the standard contour of the mobile phone glass cover into two identical areas.

3. The method for detecting defects in the window area of ​​a mobile phone glass cover plate based on symmetry according to claim 1, characterized in that: After defect enhancement, the image will be darker at the defect and brighter at the non-defect. In the digital image, the grayscale value corresponding to the dark area is small, and the grayscale value corresponding to the bright area is large, that is, the difference after subtracting the defect and the non-defect is negative. For defects that cross the axis of symmetry, the positive and negative difference information after image subtraction is judged to determine the specific position of the defect in the image. For the position with a positive difference, a mirror operation is performed on it about the axis of symmetry to restore it to the position in the original window area.

4. The method for detecting defects in the window area of ​​a mobile phone glass cover plate based on symmetry according to claim 1, characterized in that: Since the image acquisition process will be inevitably disturbed by noise, even if the image has been pre-processed and denoised as above, there will still be a small amount of noise. For the two 1 / 2 areas obtained by dividing the symmetry axis, even the grayscale value difference information obtained from the defect-free background will appear positive or negative instead of the standard 0. The grayscale value mean difference of the two areas on both sides is used as the threshold thresh to further filter the noise. The pixel points with a difference lower than the threshold can be considered as grayscale value fluctuations in a small range caused by noise.