A method for detecting glass defects

By adopting a fractal defect detection method that first linear defect detection and then block defect detection in glass production, combined with the canny operator and DBSCAN algorithm, the defect detection problem in glass production is solved, and the rapid and accurate defect recognition of glass images is achieved , improves the accuracy of the test results.

CN115049657BActive Publication Date: 2024-11-19DONGGUAN HONGYANG GLASS PROD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210971191.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-15
Publication Date
2024-11-19
Estimated Expiration
2042-08-15

AI Technical Summary

Technical Problem

During the glass production process, defective glass will be generated due to the influence of process and environment. The prior art is difficult to effectively detect these defects, affecting the structural performance of the glass.

Method used

The fractal defect detection method is adopted, which first linear defect detection and then block defect detection, and edge detection is detected and divided by the canny operator and DBSCAN algorithm. Combined with grayscale symbiosis matrix and superpixel segmentation, texture and grayscale features are extracted. Calculate the distance between superpixel blocks, adaptively obtain parameters, and mark linear and block defects.

Benefits of technology

It realizes fast and accurate defect detection of glass images, avoids the problem of defects being misclassified or undetected, and improves the accuracy of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115049657B_ABST
    Figure CN115049657B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of defect detection technology, and specifically to a glass defect detection method, which collects a glass image to obtain a corresponding grayscale image, performs edge detection on the grayscale image to obtain a contour line, divides the contour line into multiple sub-contour lines, and marks the sub-contour lines for linear defects; performs superpixel segmentation on the glass image to obtain multiple superpixel blocks, and combines texture features and grayscale features to form a feature description vector for each superpixel block; obtains the neighborhood search range of each superpixel block, calculates the distance between each superpixel block and multiple superpixel blocks in its neighborhood search range based on the feature description vector, marks the superpixel block for block defects according to the distance, and combines linear defects and block defects to identify defects in the glass image. The fractal defect detection method of first detecting linear defects and then detecting block defects is adopted to achieve rapid detection and judgment of defects in glass images and improve the accuracy of defect detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of defect detection, and in particular to a glass defect detection method. Background Art

[0002] Glass is a building material used to block wind and transmit light, and is widely used in various buildings in cities. Due to the fragility of glass, the strength and safety of glass need to be carefully controlled during the production process. During the glass production process, due to the influence of process and environment, defective glass will be produced, which seriously affects the structural performance of the glass. Therefore, glass defect detection is a very necessary step in glass production. Summary of the invention

[0003] In order to solve the above technical problems, the purpose of the present invention is to provide a glass defect detection method, and the technical solution adopted is as follows:

[0004] Collecting a glass image to obtain a corresponding grayscale image;

[0005] The canny operator is used to perform edge detection on the grayscale image to obtain a contour line, and the DBSCAN algorithm is used to divide the contour line into multiple sub-contour lines. The linear defect similarity of the sub-contour line is obtained according to the length of the sub-contour line and the number of pixel points intersected between the gradient line of each sampling point on the sub-contour line and the sub-contour line, and the sub-contour line whose linear defect similarity is greater than the set threshold is marked as a linear defect;

[0006] The glass image is segmented into multiple superpixel blocks by superpixel segmentation. The texture features of each superpixel block are extracted by using the gray-level co-occurrence matrix. The gray-level histogram of each superpixel block is obtained based on the gray-level image. The gray-level features in the gray-level histogram are extracted. The texture features and gray-level features are combined into a feature description vector of each superpixel block.

[0007] Taking each superpixel block as the central superpixel block, the neighborhood search range of each superpixel block is obtained, and the distances between the central superpixel block and the N superpixel blocks in the neighborhood search range are respectively calculated based on the feature description vector to obtain N distances corresponding to the central superpixel block, where N is a positive integer; sorting the N distances from small to large, and then calculating the average value of the first K distances, where K is a positive integer, and N is greater than K. When the average value is greater than the average value threshold, it is confirmed that the central superpixel block is a block defect, and the average value threshold and K value are adaptive parameters corresponding to the central superpixel block;

[0008] When there are linear defects or block defects in the glass image, it is confirmed that the corresponding glass has defects; conversely, when there are no linear defects or block defects in the glass image, it is confirmed that the corresponding glass is normal.

[0009] Furthermore, the method for obtaining the linear defect similarity of the sub-contour line according to the length of the sub-contour line and the number of pixel points intersecting between the gradient line of each sampling point on the sub-contour line and the sub-contour line includes:

[0010] Based on the length of the subcontour , on the subcontour line every Get a sampling point at each sampling point, get the gradient at each sampling point, take the sampling point as the center and the gradient as the slope to get the gradient line of each sampling point, and take the number of pixels where the gradient line intersects with the sub-contour line as the width of the corresponding sampling point;

[0011] The width of each sampling point on the sub-contour line is obtained to obtain the average width, and the ratio between the average width and the length of the sub-contour line is used as the linear defect similarity of the sub-contour line.

[0012] Furthermore, the texture features refer to the energy, entropy, contrast and inverse moment of the gray level co-occurrence matrix.

[0013] Furthermore, the grayscale features refer to the statistical features of the grayscale histogram, such as variance, mean, kurtosis, skewness, entropy and energy.

[0014] Furthermore, the method of obtaining a neighborhood search range of each superpixel block with each superpixel block as the center superpixel block includes:

[0015] Construct the first potential circle with the current superpixel block as the central superpixel block , the first potential circle It refers to the area composed of superpixel blocks that have intersecting pixels or contours with the central superpixel block, and then construct the second potential circle , the second potential circle The first potential circle The area composed of superpixel blocks with intersecting pixels or contours, and so on, until the fifth potential circle is obtained , then the neighborhood search range of the current superpixel block is .

[0016] Furthermore, the method of respectively calculating the distances between the central super pixel block and N super pixel blocks within its neighborhood search range based on the feature description vector includes:

[0017]

[0018] in, for distance; is the first feature description vector corresponding to the central superpixel block elements, Indicates the first superpixel block in the neighborhood search area corresponding to the feature description vector elements.

[0019] Furthermore, the method for obtaining the average value threshold and K value is:

[0020] Calculate the central superpixel block and the first potential circle The minimum distance and maximum distance between the superpixel blocks contained in the first potential circle are used to form the distance interval , and then get the distance interval of each potential circle; calculate the potential circle according to the distance interval The drop between any two potential circles in ,in, and Represents the distance interval between any two potential circles;

[0021] If there are two potential circles with a drop difference less than the drop difference threshold, the defect distance intervals corresponding to the two potential circles are obtained. , and the potential circle with a smaller potential circle number is taken as the defect interference potential circle, and the number of defect interference potential circles whose distances to the central super pixel block fall into the defect distance interval is counted as the number of defect interference super pixel blocks;

[0022] Perform the same operation on any two potential circles and we get According to the number of defect interference super pixel blocks and multiple defect distance intervals, ; Obtain a union of the defect distance intervals. When the average value threshold is greater than the maximum value in the union, the average value threshold is not modified; when the average value threshold is less than or equal to the maximum value in the union, the upper limit in the union is used as the average value threshold.

[0023] The embodiments of the present invention have at least the following beneficial effects: a fractal defect detection method of first detecting linear defects and then detecting block defects is adopted to perform defect detection on glass images; at the same time, in the process of block defect detection, the neighborhood search range is expanded and the parameters of each super-pixel block are adaptively obtained, thereby solving the problem of defects being misclassified or not detected because they span multiple adjacent super-pixel blocks, achieving rapid detection and judgment of defects in glass images, and improving the accuracy of defect detection results. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0025] Figure 1A flowchart of a glass defect detection method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a glass defect detection method proposed according to the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0027] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0028] A specific scheme of a glass defect detection method provided by the present invention is described in detail below with reference to the accompanying drawings.

[0029] See also Figure 1 , which shows a flow chart of a glass defect detection method provided by an embodiment of the present invention, the method comprising the following steps:

[0030] Step S001, collecting a glass image to obtain a corresponding grayscale image.

[0031] Specifically, for the glass image (size ) to preprocess the image from color The image is converted into a grayscale image, and then the median filter is used to filter the noise of the grayscale image, and the histogram equalization is used to enhance the grayscale image.

[0032] Step S002, use the canny operator to perform edge detection on the grayscale image to obtain the contour line, use the DBSCAN algorithm to divide the contour line into multiple sub-contour lines, and obtain the linear defect similarity of the sub-contour line based on the length of the sub-contour line and the number of pixel points intersecting between the gradient line of each sampling point on the sub-contour line and the sub-contour line, and mark the sub-contour line whose linear defect similarity is greater than the set threshold as a linear defect.

[0033] Specifically, the morphology of glass defects mainly includes block defects (bubbles, stones and inclusions) and linear defects (scratches). If only the block defect detection method is used, the linear defects do not fit the morphological structure of the super-pixel block, that is, when the image is divided into block areas by super-pixel segmentation, linear defects will appear at the edges of adjacent super-pixel blocks, and when operations such as clustering the internal features of the super-pixel blocks and clustering different super-pixel blocks are performed, the linear defects cannot be analyzed and detected; if only the linear defect detection method is used, some defects will be difficult to detect due to unclear edges. Therefore, an embodiment of the present invention proposes a fractal defect detection method, which adopts a fractal defect detection method that first detects linear defects and then detects block defects.

[0034] The method for detecting linear defects in glass images is as follows: using the Canny operator to extract edge information in the glass image to obtain contour lines , and then use the morphological closing operation to close the broken contours Considering that there may be multiple defect areas in the glass image, which contain multiple defect contour lines, the contour lines are then Use DBSCAN algorithm and set the neighborhood radius and number threshold , the contour line Divided into independent Strip outline, is a positive integer; Linear defect detection is performed on sub-contours. First, each sub-contour is refined to obtain a single-pixel contour skeleton, and the number of pixels contained in the contour skeleton is used as the length of the sub-contour , and then on the contour line every The contour skeleton is sampled evenly, and the Sobel algorithm is used to calculate the horizontal gradient at the sampling point. and the vertical gradient , centered at the sampling point, the gradient Draw a gradient line for the slope, and take the number of pixels where the gradient line intersects the sub-contour line as the width of the sampling point. The average value of these five widths is calculated to get the average width. , and then get the linear defect similarity ; Get Linear defect similarity of strip contour , set the linear defect similarity threshold , the linear defect similarity is greater than The subcontours of are marked as linear defects.

[0035] Step S003, perform superpixel segmentation on the glass image to obtain multiple superpixel blocks, use the grayscale co-occurrence matrix to extract the texture features of each superpixel block, obtain the grayscale histogram of each superpixel block based on the grayscale image, extract the grayscale features in the grayscale histogram, and combine the texture features and grayscale features to form a feature description vector for each superpixel block.

[0036] Specifically, a superpixel segmentation method is used to segment the glass image into multiple superpixel blocks, where the number of superpixels is set ,get Since the normal glass surface presents similar texture and grayscale features, the grayscale co-occurrence matrix and the grayscale statistical features based on the grayscale histogram are used to extract the features of each superpixel block, and the current superpixel block is characterized by: the grayscale co-occurrence matrix is ​​used to extract the texture information of the current superpixel block, and the energy of the grayscale co-occurrence matrix is ​​saved. , Entropy , Contrast and inverse moment The feature is used as the texture feature of the current superpixel block; then the grayscale histogram of the current superpixel block is obtained based on the grayscale image, and the statistical feature variance of the grayscale histogram is converted to , mean , Kurtosis , Skewness ,entropy and energy As the grayscale feature of the current superpixel block, the feature description vector of the current superpixel block is obtained .

[0037] Step S004, taking each superpixel block as the central superpixel block to obtain the neighborhood search range of each superpixel block, and calculating the distances between the central superpixel block and the N superpixel blocks in the neighborhood search range based on the feature description vector, to obtain N distances corresponding to the central superpixel block; sorting the N distances from small to large and calculating the average of the first K distances, and when the average value is greater than the average value threshold, confirming that the central superpixel block is a block defect.

[0038] Specifically, the method for detecting block defects on a superpixel block comprises the following steps:

[0039] Considering that the grayscale and texture features inside the stone defect are not uniform, that is, the same defect contains no less than one superpixel block with different feature description vectors, and the distance between the superpixel blocks with different feature description vectors of the same defect may be smaller than the distance between these superpixel blocks and the superpixel blocks on the normal glass surface, if only the distance between the superpixel block and its neighboring superpixel blocks is analyzed, the two compared superpixel blocks may belong to the same defect and the defect cannot be identified because their distance is less than the distance threshold. Therefore, it is necessary to expand the neighborhood search range of the superpixel block to perform block defect detection. The method of the neighborhood search range of each superpixel block is: construct the first potential circle with each superpixel block as the central superpixel block , the first potential circle It refers to the area composed of superpixel blocks that have intersecting pixels or contours with the central superpixel block, and then construct the second potential circle , the second potential circle The first potential circle Repeat the above steps until the fifth potential circle is obtained. , thus obtaining the neighborhood search range of the central superpixel block , and then get the neighborhood search range of each superpixel block .

[0040] Calculate the neighborhood search area range of the central superpixel block respectively The distance between the superpixel block inside and the central superpixel block :

[0041]

[0042] in, is the first feature description vector corresponding to the central superpixel block elements, Indicates the scope of the neighborhood search area The first superpixel block in the feature description vector corresponds to elements.

[0043] Set the neighborhood search area to In The distance between each superpixel block and the central superpixel block is calculated , N is a positive integer, Sort the distances from small to large, and select the first The average value of the distances, K is a positive integer, and N is greater than K. When the average value is greater than the average value threshold When the value is 0.8, the central superpixel block is confirmed to be a block defect.

[0044] Considering that the stone defect may span multiple adjacent superpixel blocks, the embodiment of the present invention adopts a local adaptive method to set K and adjust the average value threshold Method:

[0045] For the central superpixel block, calculate the central superpixel block and the first potential circle respectively , the second potential circle , the third circle , the fourth circle and the fifth circle The minimum distance between the superpixel blocks contained in and maximum distance As the distance interval of each potential circle The two endpoints of the potential circle are further determined based on the distance interval. Is there a distance gap between them? For every two distance intervals of the five potential circles Calculate the drop :

[0046]

[0047] in, and Represents the distance interval between any two potential circles.

[0048] If there is a difference between two potential circles Less than the drop threshold , then the potential circle with a smaller potential circle number is taken as the defect interference potential circle, and the distance between the defect interference potential circle and the central super pixel block falls into the defect distance interval The number of defect interference superpixel blocks is taken as the number of defect interference superpixel blocks; the above operation is performed on any two potential circles to obtain defect interference superpixel blocks and multiple defect distance intervals , any two potential circles get a defect distance interval, and these defect distance intervals Taking the union we get The adaptive parameters are obtained , further determine the average value threshold set Is it greater than the interval? If the average value threshold Greater than interval The maximum value of the average value threshold Modify if the average value threshold Less than or equal to interval The maximum value of The upper limit of the average value threshold .

[0049] Step S005, when there are linear defects or block defects in the glass image, it is confirmed that the corresponding glass has defects; conversely, when there are no linear defects or block defects in the glass image, it is confirmed that the corresponding glass is normal.

[0050] Specifically, yes If all super-pixel blocks have neither linear defects nor block defects, the glass image is considered normal and the corresponding glass is determined to have no defects. Otherwise, as long as there is a super-pixel block with linear defects or block defects, the glass image is considered to have defects and the corresponding glass is determined to have defects.

[0051] In summary, an embodiment of the present invention provides a glass defect detection method, which collects a glass image to obtain a corresponding grayscale image, performs edge detection on the grayscale image to obtain a contour line, divides the contour line into multiple sub-contour lines, and marks the sub-contour lines for linear defects; performs superpixel segmentation on the glass image to obtain multiple superpixel blocks, and combines texture features and grayscale features to form a feature description vector for each superpixel block; obtains the neighborhood search range of each superpixel block, calculates the distance between each superpixel block and multiple superpixel blocks in its neighborhood search range based on the feature description vector, marks the superpixel block for block defects according to the distance, and combines linear defects and block defects to identify defects in the glass image. The fractal defect detection method of first detecting linear defects and then detecting block defects is adopted to achieve rapid detection and judgment of defects in glass images and improve the accuracy of defect detection results.

[0052] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The above is a description of a specific embodiment of this specification. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0053] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0054] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A glass defect detection method, characterized in that: The method comprises the following steps: Collecting a glass image to obtain a corresponding grayscale image; The canny operator is used to perform edge detection on the grayscale image to obtain a contour line, and the DBSCAN algorithm is used to divide the contour line into multiple sub-contour lines. According to the length of the sub-contour line and the number of pixel points intersecting between the gradient line of each sampling point on the sub-contour line and the sub-contour line, the linear defect similarity of the sub-contour line is obtained, and the sub-contour line with a linear defect similarity greater than a set threshold is marked as a linear defect, including: extracting edge information in the glass image using the canny operator to obtain a contour line , and then use the morphological closing operation to close the broken contours Considering that there may be multiple defect areas in the glass image, which contain multiple defect contour lines, the contour lines are then Use DBSCAN algorithm and set the neighborhood radius and number threshold , the contour line Divided into independent Strip outline, is a positive integer; Linear defect detection is performed on sub-contours. First, each sub-contour is refined to obtain a single-pixel contour skeleton, and the number of pixels contained in the contour skeleton is used as the length of the sub-contour , and then on the contour line every The contour skeleton is sampled evenly, and the Sobel algorithm is used to calculate the horizontal gradient at the sampling point. and the vertical gradient , centered at the sampling point, the gradient Draw a gradient line for the slope, and take the number of pixels where the gradient line intersects the sub-contour line as the width of the sampling point. The average value of these five widths is calculated to get the average width. , and then get the linear defect similarity ; Get Linear defect similarity of strip contour , set the linear defect similarity threshold 5. The linear defect similarity is greater than The subcontours of are marked as linear defects; The glass image is segmented into multiple superpixel blocks by superpixel segmentation. The texture features of each superpixel block are extracted by using the gray-level co-occurrence matrix. The gray-level histogram of each superpixel block is obtained based on the gray-level image. The gray-level features in the gray-level histogram are extracted. The texture features and gray-level features are combined into a feature description vector of each superpixel block. Taking each superpixel block as the central superpixel block, the neighborhood search range of each superpixel block is obtained, and the distances between the central superpixel block and the N superpixel blocks in the neighborhood search range are respectively calculated based on the feature description vector to obtain N distances corresponding to the central superpixel block, where N is a positive integer; sorting the N distances from small to large, and then calculating the average value of the first K distances, where K is a positive integer, and N is greater than K. When the average value is greater than the average value threshold, it is confirmed that the central superpixel block is a block defect, and the average value threshold and K value are adaptive parameters corresponding to the central superpixel block; When there are linear defects or block defects in the glass image, it is confirmed that the corresponding glass has defects; conversely, when there are no linear defects or block defects in the glass image, it is confirmed that the corresponding glass is normal; The method for obtaining a neighborhood search range of each superpixel block by taking each superpixel block as a central superpixel block comprises: Construct the first potential circle with the current superpixel block as the central superpixel block , the first potential circle It refers to the area composed of superpixel blocks that have intersecting pixels or contours with the central superpixel block, and then construct the second potential circle , the second potential circle The first potential circle The area composed of superpixel blocks with intersecting pixels or contours, and so on, until the fifth potential circle is obtained , then the neighborhood search range of the current superpixel block is ; The method for respectively calculating the distances between the central super pixel block and N super pixel blocks within its neighborhood search range based on the feature description vector comprises: in, for distance; is the first feature description vector corresponding to the central superpixel block elements, Indicates the first superpixel block in the neighborhood search area corresponding to the feature description vector elements; The method for obtaining the average value threshold and K value is: Calculate the central superpixel block and the first potential circle The minimum distance and maximum distance between the superpixel blocks contained in the first potential circle are used to form the distance interval , and then get the distance interval of each potential circle; calculate the potential circle according to the distance interval The drop between any two potential circles in ,in, and Represents the distance interval between any two potential circles; If there are two potential circles with a drop difference less than the drop difference threshold, the defect distance intervals corresponding to the two potential circles are obtained. , and the potential circle with a smaller potential circle number is taken as the defect interference potential circle, and the number of defect interference potential circles whose distances to the central super pixel block fall into the defect distance interval is counted as the number of defect interference super pixel blocks; Perform the same operation on any two potential circles and we get According to the number of defect interference super pixel blocks and multiple defect distance intervals, ; Obtain a union of the defect distance intervals. When the average value threshold is greater than the maximum value in the union, the average value threshold is not modified; when the average value threshold is less than or equal to the maximum value in the union, the upper limit in the union is used as the average value threshold.

2. A glass defect detection method according to claim 1, characterized in that: The texture features refer to the energy, entropy, contrast and inverse difference moment of the gray level co-occurrence matrix.

3. A glass defect detection method according to claim 1, characterized in that: The grayscale features refer to the statistical features of the grayscale histogram, such as variance, mean, kurtosis, skewness, entropy and energy.