A glass cover plate defect detection method and system based on image processing
By constructing a surface defect intensity index based on damage scattering matching degree and gradient information, and combining it with a linear damage significance index based on the ratio of eigenvalues of the covariance matrix, the Otsu threshold segmentation method was used to solve the problem of high false alarm rate in glass cover plate defect detection, thus achieving high-precision defect identification and tracing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUIZHOU LIANGCHENG ELECTRONICS CO LTD
- Filing Date
- 2025-10-27
- Publication Date
- 2026-05-01
AI Technical Summary
Existing image processing algorithms struggle to effectively distinguish between genuine surface defects on glass covers and artifacts caused by optical properties, resulting in a high false alarm rate.
By constructing a surface defect intensity index that combines damage scattering matching degree and gradient information, and constructing a linear damage significance index by combining the ratio of eigenvalues of the covariance matrix, the Otsu threshold segmentation method is used to distinguish different types of defects, thereby achieving accurate identification and tracing of defects in glass cover plates.
It enables accurate identification and classification of defects in glass covers, reduces false alarm rates, improves the accuracy and stability of detection, and allows for targeted optimization of the production process.
Smart Images

Figure CN121544528B_ABST
Abstract
Description
A method and system for detecting defects in glass cover plates based on image processing Technical Field
[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a method and system for detecting defects in glass cover plates based on image processing. Background Technology
[0002] As a crucial protective optical component, the glass cover is commonly used in the display screens of many electronic products, such as smartphones, tablets, automotive displays, and smart wearable devices. Its main function is to protect the delicate internal display and touch components from scratches, impacts, and contamination from the external environment, while ensuring excellent light transmittance, optical consistency, and good visual effects. Therefore, the surface quality of the glass cover is paramount. Any minor defects, such as scratches, dirt, bubbles, or dents, can not only affect the product's appearance but also interfere with touch response and light transmission, thus severely impacting the user experience and brand perception of the end product.
[0003] In existing technologies, automated optical inspection technology based on image processing has become the main method for detecting defects in glass cover plates. However, glass cover plates possess two unique optical characteristics that distinguish them from other opaque materials: high light transmittance and high reflectivity. High reflectivity makes it easy for illumination sources or the surrounding environment to form bright, sharp-edged specular reflection areas on the glass surface. These areas are not defects, but are easily misidentified as defects by traditional algorithms. High light transmittance causes defects at different depths to exhibit different levels of clarity when imaged; that is, surface defects and internal defects will have different levels of clarity in the image. When using existing image processing algorithms to detect defects in glass cover plates, it is difficult to effectively distinguish between true surface defects and these artifacts caused by optical characteristics, resulting in a high false alarm rate. Summary of the Invention
[0004] This invention provides a glass cover plate defect detection method and system based on image processing, aiming to solve the problem that existing image processing algorithms in related technologies have difficulty in effectively distinguishing between real surface defects and artifacts caused by optical properties when detecting defects in glass cover plates, resulting in a high false alarm rate.
[0005] In a first aspect, the present invention provides a method for detecting defects in a glass cover plate based on image processing, comprising: acquiring a glass cover plate image and preprocessing it to obtain a preprocessed grayscale image; selecting any pixel in the grayscale image as a target pixel, establishing a window centered on the target pixel, calculating the damage scattering matching degree of the target pixel, wherein the damage scattering matching degree characterizes the difference between the mean grayscale value of all pixels within the window and the mean of the maximum and minimum grayscale values of all pixels within the window, and taking the product of the damage scattering matching degree of the target pixel and the mean gradient value of all pixels within the window as the target pixel. Surface defect intensity index: A feature map composed of the surface defect intensity indices of all pixels is denoted as a defect feature map. A binary image of the defect feature map is obtained, and the defect region in the defect feature map is extracted. The linear damage significance index of the defect region is calculated. The linear damage significance index is negatively correlated with the ratio of the minimum to the maximum value of the eigenvalues of the covariance matrix corresponding to the defect region. The defect type is determined based on the surface defect degree and the linear damage significance index of the defect region, where the surface defect degree is the mean of the surface defect intensity indices of all pixels in the defect region, so as to achieve defect traceability in glass cover production. By constructing a surface defect intensity index that combines damage scattering matching degree and gradient information, pixel-level defect features are accurately described. Furthermore, a linear damage significance index is constructed by combining the ratio of eigenvalues of the covariance matrix, realizing quantitative analysis of the structural features of the defect region. It can also effectively distinguish different types of defects, which is conducive to the accurate identification of glass cover defects and defect traceability in the production process.
[0006] Furthermore, the defect types are determined by using the surface defect severity of all defective regions as input to the Otsu threshold segmentation method. The defective regions are divided into two categories, and the mean surface defect severity of each category is calculated. Regions with a larger mean are designated as surface defective regions, and those with a smaller mean are designated as internal defective regions. By adaptively classifying the surface defect severity of defective regions using the Otsu threshold segmentation method and combining it with the average feature intensity of the two types of defective regions, automatic differentiation between surface and internal defects is achieved, effectively improving the accuracy and stability of defect classification.
[0007] Furthermore, the linear damage significance index of all defective regions is used as input to the Otsu threshold segmentation method to classify the defective regions into two categories. The mean of the linear damage significance index for each category is calculated, and the defective region with the larger mean is designated as a scratch defect region, while the defective region with the smaller mean is designated as an area defect region. Based on the linear damage significance index of the defective regions, the Otsu threshold segmentation method automatically distinguishes between scratch defects and area defects, accurately capturing the geometric structural features of defects and significantly improving the automation and accuracy of defect morphology classification.
[0008] Furthermore, it also includes: classifying the defect types of the glass cover by combining the classification results of the defect area with the comprehensive surface defect degree and the linear damage significance index, wherein the defect types include internal area defects, surface area defects, internal scratch defects and surface scratch defects.
[0009] Furthermore, obtaining the binary image of the defect feature map includes: inputting the surface defect intensity index of all pixels in the defect feature map into the Otsu threshold segmentation method, and outputting the segmented binary image of the defect feature map.
[0010] Furthermore, the method for obtaining the eigenvalues of the covariance matrix corresponding to the defect region includes: obtaining the coordinates of all pixels within the defect region in the pixel coordinate system, and constructing a covariance matrix based on the coordinates. Constructing the covariance matrix based on the pixel coordinates within the defect region and utilizing its eigenvalues to reflect the spatial distribution characteristics of the region provides a structured and quantitative means for defect morphology analysis, effectively improving the ability to distinguish between scratches and area-type defects.
[0011] Furthermore, the method for obtaining the average gradient of all pixels within the window includes: calculating the gradient magnitude of each pixel in the window using the Sobel operator, thereby obtaining the average gradient of all pixels within the window.
[0012] Furthermore, the glass cover image is acquired and preprocessed, including grayscale conversion and smoothing. By performing grayscale conversion and smoothing preprocessing on the glass cover image, image noise is suppressed while retaining effective brightness information. This simplifies the computational complexity of subsequent processing and improves the stability and accuracy of the defect detection process.
[0013] Furthermore, the defect region in the defect feature map is extracted, including: extracting the defect region in the defect feature map using connected components.
[0014] In a second aspect, the present invention also provides a glass cover plate defect detection system based on image processing, comprising a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement the glass cover plate defect detection method based on image processing described in any of the above embodiments.
[0015] Beneficial effects: Based on the surface defect intensity index, a defect feature map of the glass cover is constructed and threshold segmentation is performed to obtain the defect region. The shape characteristics of the defect region are analyzed by the eigenvalues of the covariance matrix to construct a linear damage significance index and evaluate the linear characteristics of the defect. Based on the surface defect degree and the linear damage significance index, the defect types are accurately classified and the causes of different defect types are analyzed, realizing defect detection and traceability in the production of glass covers. Attached Figure Description
[0016] Figure 1 is a flowchart schematically illustrating the detection of defects in a glass cover plate according to an embodiment of the present invention. Detailed Implementation
[0017] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0018] As shown in Figure 1, S101: Acquire the image of the glass cover plate and perform preprocessing.
[0019] Specifically, during the quality inspection of glass covers, the glass covers to be inspected are placed on a closed, darkroom inspection platform with a built-in shadowless LED light source to eliminate interference from external ambient light and provide uniform and stable backlighting or coaxial illumination for the glass covers. Images of the glass covers to be inspected are acquired by a high-resolution industrial camera, and the resulting glass cover images are RGB images.
[0020] Furthermore, to reduce the data dimensionality and computational complexity in subsequent processing, the acquired RGB images are converted to grayscale. Considering that random noise may be introduced during image acquisition and transmission, and to preserve edge information of the defect area as much as possible, this embodiment uses a bilateral filtering algorithm to smooth the grayscale image. This algorithm can preserve image edges while removing noise and is a commonly used technique in image preprocessing, which will not be described in detail here. After the above steps, a preprocessed grayscale image of the glass cover plate suitable for subsequent defect detection is obtained.
[0021] S102: Calculate the damage scattering matching degree of any pixel.
[0022] Among the defects in glass cover plates, surface physical damage such as scratches and dents can disrupt their original smooth structure, forming localized grooves or protrusions at the microscopic level. When imaging the glass cover plate under vertical illumination, light will be directionally scattered upon reaching these damaged areas due to the uneven surface: the sloping surface on one side will scatter light outside the camera's field of view, forming dark areas in the image, while the sloping surface on the opposite side may reflect light into the camera lens, forming bright areas.
[0023] Therefore, a real, tiny physical defect typically does not appear as a single bright or dark spot in an image, but rather as a pair of closely adjacent "bright-dark" or "dark-bright" pixel pairs. In contrast, random noise in an image is mostly isolated bright or dark spots, lacking the aforementioned directional characteristics; while specular reflections typically appear as large, uniformly distributed bright areas, also not exhibiting a typical "bright-dark" pixel pair structure.
[0024] Based on the above description, this embodiment proposes a method for constructing damage scattering matching degree to quantify whether pixels in an image possess the brightness and darkness combination features caused by real physical damage. The construction process of damage scattering matching degree is as follows: Any pixel in the grayscale image is selected as the target pixel, and a window is established centered on the target pixel. The window is a square with a side length of 5. The mean, maximum, and minimum grayscale values of the pixels within the window are calculated. Then, the damage scattering matching degree of the target pixel is calculated. The damage scattering matching degree characterizes the difference between the mean grayscale value of all pixels within the window and the mean of the maximum and minimum grayscale values of all pixels within the window. The smaller the difference, the larger the damage scattering matching degree value.
[0025] Following the above, a formula for calculating the damage scattering matching degree is provided, the formula is as follows: .in, Represents the pixels in the grayscale image of the glass cover. Damage scattering matching degree, , and Representing pixels The maximum, minimum, and average grayscale values of all pixels within the defect detection window.
[0026] It should be noted that in the defect detection window, if pixels exhibit closely adjacent "bright-dark" or "dark-bright" pixel pairs, resulting in a situation where the number of "bright" and "dark" pixels is relatively close, and the grayscale values between "bright" pixels and between "dark" pixels are also relatively close, then the calculated average grayscale value will be close to the average of the maximum and minimum grayscale values. and The magnitudes are quite close, and according to the properties of quadratic functions, we can obtain... and When they are equal, The maximum value is reached. In other words, if pixels exhibit closely adjacent "bright-dark" or "dark-bright" pixel features, it indicates that defects are more likely to occur in the window, and the calculated damage scattering matching degree is greater.
[0027] S103: Calculate the surface defect intensity index of any pixel.
[0028] In the steps described above, the high reflectivity of the glass cover plate was analyzed to distinguish defects from specular reflection. However, the high light transmittance of the glass cover plate leads to varying degrees of edge salience for defects at different depths. Specifically, defects located on the upper surface exhibit the sharpest and clearest edges in the image, while defects located on the lower surface or inside the glass, being out of focus, appear blurry and diffused. This difference in sharpness directly distinguishes the spatial location of the defects. In other words, defects located on the upper surface correspond to high-frequency signals in the grayscale image of the glass cover plate, meaning there is a significant difference in grayscale values between adjacent pixels.
[0029] Based on the above analysis, this embodiment constructs a surface defect intensity index based on damage scattering matching degree to reflect the edge sharpness of a pixel in a defect region. The construction process of the surface defect intensity index is as follows: For the window containing the target pixel, the gradient magnitude of each pixel in the window is calculated using the Sobel operator, thereby obtaining the average gradient of all pixels in the window. The product of the damage scattering matching degree of the target pixel and the average gradient of all pixels in the window is used as the surface defect intensity index of the target pixel. If the damage scattering matching degree of the pixel is larger, it indicates that there is a greater likelihood of a defect in the area of the glass cover plate corresponding to the window. At the same time, the average gradient magnitude of the pixels in the window is larger, indicating that the defect edge corresponding to the window is more obvious, that is, the defect is more likely to be located on the upper surface of the glass cover plate. Therefore, the calculated surface defect intensity index is larger. If the average gradient magnitude of the pixels in the window is smaller, it indicates that the defect edge corresponding to the window is less obvious, that is, the defect is more likely to be located inside the glass cover plate. Therefore, the calculated surface defect intensity index is smaller.
[0030] S104: Extract the defect area and calculate the linear damage significance index and surface defect degree of the defect area.
[0031] Among surface defects, linear scratches typically have a greater impact on the quality of the glass cover, while dot-like or clustered pits and stains have a relatively smaller impact. Linear scratches exhibit a high degree of directional uniformity, meaning the scratch extends along a specific direction, while area defects such as pits and stains do not have a clear direction of extension. To identify different types of defects and facilitate subsequent detailed analysis of defect causes, a linear damage significance index is constructed based on the surface defect intensity index. The construction process is as follows.
[0032] In the grayscale image of the glass cover plate, the feature map formed by the surface defect intensity index of all pixels is denoted as the defect feature map. This feature map is used as the input of the Otsu thresholding method, and the output is a binary image of the segmented glass cover plate defect. Connected component analysis is applied to this binary image to obtain multiple independent defect regions. Taking the R-th defect region as an example, a covariance matrix is constructed based on the coordinates of all pixels in the pixel coordinate system within this region. The maximum and minimum values of the eigenvalues of this matrix are calculated using linear algebra. The linear damage significance index and the ratio of the minimum to the maximum value of the eigenvalues of the covariance matrix corresponding to the defect region are negatively correlated. The surface defect degree of the defect region is the mean of the surface defect intensity index of all pixels within the defect region. The Otsu thresholding method and connected component analysis are well-known techniques, and their specific processes will not be elaborated here.
[0033] Based on the above processing steps, a formula for calculating the linear damage significance index is provided, as follows: .in, This represents the linear damage significance index of the R-th defect region in the binary graph of the glass cover plate defect. and These represent the minimum and maximum values of the eigenvalues of the covariance matrix corresponding to the Rth defect region, respectively.
[0034] In the above formula, if the defect area is a scratch defect, then the area is a long and narrow scratch region. Pixels are widely distributed along one direction, resulting in a larger maximum value for the eigenvalues of the covariance matrix. Conversely, they are narrowly distributed in the vertical direction, resulting in a smaller minimum value for the eigenvalues of the covariance matrix. This makes the calculated... Approaching 0, the final calculated linear damage significance index value approaches 1; for area-type defects such as pits and stains, the distribution range of pixels in different directions is relatively small, and the maximum and minimum values of the corresponding covariance matrix eigenvalues are relatively close, making the calculated linear damage significance index approach 0, which facilitates subsequent detailed classification of defect types.
[0035] S105: Determine the defect type based on the surface defect degree and linear damage significance index of the defect region.
[0036] Since the surface defect degree of the defect area reflects the surface significance characteristics of the glass cover plate defect, that is, it is possible to distinguish whether the defect is on the surface or inside the glass cover plate based on the surface defect degree, and the linear damage significance index of the defect area reflects the shape characteristics of the glass cover plate defect, that is, it is possible to distinguish whether the defect is a scratch defect or an area defect based on the linear damage significance index, the defects can be divided into 4 types by combining the surface defect degree and the linear damage significance index. The specific classification process is as follows.
[0037] First, the surface defect severity of all defective regions is used as input to the Otsu threshold segmentation method, dividing the defective regions into two categories. The mean surface defect severity of each category is then calculated. Defective regions with a larger mean surface defect severity are designated as surface defective regions, and those with a smaller mean are designated as internal defective regions. Next, the linear damage significance index of all defective regions is used as input to the Otsu threshold segmentation method. Again, the defective regions are divided into two categories, and the mean linear damage significance index of each category is calculated. Defective regions with a larger mean linear damage significance index are designated as scratch defective regions, and those with a smaller mean linear damage significance index are designated as area defective regions.
[0038] Finally, based on the classification results of the defect area by combining the degree of surface defects and the linear damage significance index, the defect types of the glass cover are divided into internal area defects, surface area defects, internal scratch defects, and surface scratch defects, as shown in the table below.
[0039]
[0040] Taking the Rth defect area of the glass cover as an example, if the surface defect degree of the defect area is classified as a surface defect, and the linear damage significance index of the defect area is classified as a scratch defect, then the defect type corresponding to the defect area is a surface scratch defect.
[0041] Finally, the production process is analyzed based on the type of defect. Internal defects, such as bubbles and stones, indicate potential problems in the glass substrate during melting and forming. If these defects are numerous, the original glass sheet should be inspected promptly. Surface scratches may originate from burrs on robotic arms, foreign objects on conveyor belts, or aging brushes in cleaning tanks during processing, handling, or cleaning. Related equipment and components in these stages need to be inspected. Surface area defects, such as dirt and water stains, may be due to incomplete cleaning or insufficient environmental cleanliness. Dimples may be related to improper chemical etching or polishing process parameters. After classifying defects, dynamic monitoring of defect types and their quantity changes allows for targeted optimization of the entire production process, reducing the probability of defects at the source and improving the quality and consistency of the finished glass cover.
[0042] The present invention also provides a glass cover plate defect detection system based on image processing. The system includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the glass cover plate defect detection method based on image processing according to the first aspect of the present invention.
[0043] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and therefore will not be described in detail here.
[0044] In this invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used or combined with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store desired information and can be accessed by an application, module, or both. Any such computer storage medium can be part of a device or accessible to or connected to a device. Any application or module described in this invention can be implemented using computer-readable / executable instructions stored or otherwise maintained on such a computer-readable medium.
[0045] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for detecting defects in glass cover plates based on image processing, characterized in that, include: The glass cover image is acquired and preprocessed to obtain a preprocessed grayscale image; Any pixel in the grayscale image is selected as the target pixel, and a window is established with the target pixel as the center. The damage scattering matching degree of the target pixel is calculated. The damage scattering matching degree characterizes the difference between the mean grayscale value of all pixels in the window and the mean of the maximum and minimum grayscale values of all pixels in the window. The product of the damage scattering matching degree of the target pixel and the mean gradient value of all pixels in the window is used as the surface defect intensity index of the target pixel. The feature map formed by the surface defect intensity indices of all pixels is recorded as the defect feature map. The binary image of the defect feature map is obtained, the defect region in the defect feature map is extracted, and the linear damage significance index of the defect region is calculated. The linear damage significance index is negatively correlated with the ratio of the minimum to the maximum value of the eigenvalue of the covariance matrix corresponding to the defect region. The defect type is determined based on the surface defect degree and linear damage significance index of the defect area to achieve defect traceability in glass cover production. The surface defect degree is the average of the surface defect intensity index of all pixels in the defect area.
2. The glass cover plate defect detection method based on image processing according to claim 1, characterized in that, Determining the defect type includes: using the surface defect degree of all defect areas as input to the Otsu threshold segmentation method, dividing the defect areas into two categories, and calculating the mean of the surface defect degree of the two categories of defect areas respectively. Defect areas with a larger mean are recorded as surface defect areas, and defect areas with a smaller mean are recorded as internal defect areas.
3. The glass cover plate defect detection method based on image processing according to claim 2, characterized in that, include: The linear damage significance index of all defective regions is used as the input of Otsu's threshold segmentation method to divide the defective regions into two categories. The mean of the linear damage significance index of the two categories of defective regions is calculated. The defective regions with larger mean values are recorded as scratch defective regions, and the defective regions with smaller mean values are recorded as area defective regions.
4. The image processing-based glass cover defect detection method according to claim 3, characterized in that, Also includes: Based on the classification results of defect areas by combining the degree of surface defects and the linear damage significance index, the defect types of glass cover plates are divided into internal area defects, surface area defects, internal scratch defects, and surface scratch defects.
5. The image processing-based glass cover defect detection method according to claim 1, characterized in that, Obtaining a binary image of the defect feature map includes: inputting the surface defect intensity index of all pixels in the defect feature map into the Otsu threshold segmentation method, and outputting a binary image of the segmented defect feature map.
6. The image processing-based glass cover defect detection method according to claim 1, characterized in that, The method for obtaining the eigenvalues of the covariance matrix corresponding to the defect region includes: obtaining the coordinates of all pixels in the defect region in the pixel coordinate system, and constructing the covariance matrix based on the coordinates.
7. The glass cover plate defect detection method based on image processing according to claim 1, characterized in that, The method for obtaining the average gradient of all pixels within a window includes: calculating the gradient magnitude of each pixel in the window using the Sobel operator, and then obtaining the average gradient of all pixels within the window.
8. The glass cover plate defect detection method based on image processing according to claim 1, characterized in that, Acquire images of the glass cover plate and perform preprocessing, including: grayscale conversion and smoothing of the glass cover plate images.
9. The image processing-based glass cover defect detection method according to claim 1, characterized in that, Extracting defect regions from defect feature maps includes: extracting defect regions from defect feature maps using connected components.
10. A glass cover plate defect detection system based on image processing, comprising a processor and a memory, characterized in that, The memory stores a computer program, and the processor executes the computer program to implement the image processing-based glass cover defect detection method as described in any one of claims 1-9.
Citation Information
Patent Citations
Glass defect detection method based on BP neural network
CN113706468A
Mobile phone glass cover plate defect detection method, system and equipment and storage medium
CN119417836A