A method for detecting the width and density of scratches on a smooth surface

By combining segmented minimum rectangles with erosion and masking operations to simplify the weight domain superposition, the problems of large calculation errors in bending scratch width and complex density detection are solved, thus achieving fast and accurate detection of scratches on smooth surfaces.

CN117291884BActive Publication Date: 2025-12-19HEFEI UNIV OF TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311231979.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2025-12-19
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

Existing methods for calculating scratch width have large errors when calculating curved scratches, and methods for detecting scratch density are complex, making it difficult to quickly and accurately detect defects on smooth surfaces in industrial inspection.

Method used

The method of calculating scratch width by combining segmented minimum rectangle with erosion operation is adopted, and the weight domain superposition is simplified by using mask operation through an improved scratch density detection method, which is suitable for the detection of scratches of different shapes.

Benefits of technology

It improves the accuracy and speed of scratch detection, reduces the efficiency of complex classification, and is highly adaptable, suitable for scratch density detection with different needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117291884B_ABST
    Figure CN117291884B_ABST
Patent Text Reader

Abstract

The application discloses a kind of detection methods of smooth surface scratch width and density, comprising: step 1, the dark-field image of optical element surface is collected;Step 2, the dark-field image is blocked, and the image block of preset size is obtained;Step 3, after the image block is preprocessed, scratch defect is identified, non scratch area is regarded as black background, and the image block that only retains scratch defect is obtained;Step 4, for each scratch, save as a single scratch image, and the width of scratch in single scratch image is calculated using improved scratch width calculation method;Step 5, image block is spliced, and the density information of scratch in spliced image is obtained using improved scratch density detection algorithm.The application can make scratch detection result more reliable, and can solve the problem of complexity of existing method, so as to improve scratch detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image technology and relates to a method for detecting defects on smooth surfaces, specifically a method for detecting the width and density of scratches on smooth surfaces. Background Technology

[0002] Precision machining technology has become an important research area in advanced manufacturing technology. Ultra-precision machining of parts is increasingly being applied in aerospace, photolithography, micro-optical components, large-scale integrated circuits, and medical devices. However, the surface quality inspection technology for machined smooth-surface parts severely restricts their application and development. Taking smooth-surface optical components as an example, rigorous quantitative and digital inspection of surface defects is essential during the production and processing of optical components.

[0003] Scratch defects are any narrow, elongated marks or wear on the surface of optical components. Scratch width is one of the important indicators for surface defect evaluation. Existing scratch width calculation models include the minimum bounding rectangle method, the area equivalence method, and the equal division method. However, these methods are suitable for calculating the width of straight scratches, but the calculation error is large for curved scratches. In addition, the surface defect evaluation standard has the concept of defect density, which requires that within an area of ​​any specified size on the component surface, the number of defects or other characteristics, such as length, cannot exceed a specified value. Some researchers have proposed using a weighted domain superposition method to calculate scratch density, assigning weights to defects and converting the superposition between weighted domains into the judgment and calculation of the positional relationship between matrices. However, the implementation of this method requires calculating the positional relationship of any pair of scratch defect weight matrices to determine the overlap, which is complex and leads to low execution efficiency. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of existing scratch width calculation methods, such as large errors in calculating the width of curved scratches and the complexity of density detection methods. It provides a method for detecting the width and density of scratches on smooth surfaces, which is applicable to the detection of scratches of different shapes. This aims to improve the reliability of scratch detection results while taking into account accuracy and detection speed, thereby improving the adaptability of the detection method in actual industrial testing environments.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] The present invention provides a method for detecting the width and density of scratches on a smooth surface, characterized by comprising the following steps:

[0007] Step 1: Collect data with a size of W. A ×H A Dark field image of the surface of optical element I A Among them, W A HA respectively represent the width and height of the image I A ;

[0008] Step 2, block the dark-field image I A to obtain M image blocks, denoted as where P i represents the i-th image block in the dark-field image I A ;

[0009] Step 3, pre-process and identify scratch defects:

[0010] Step 3.1, pre-process the i-th image block P i using grayscale and median filtering to obtain the pre-processed i-th image block P i ';

[0011] Step 3.2, perform maximum inter-class variance threshold segmentation on the pre-processed i-th image block P i ' to obtain a segmented image block, and then perform a closing operation to obtain the i-th image block P i " after removing holes;

[0012] Step 3.3, perform connected domain analysis on the i-th image block P i " after removing holes to identify K i scratches wherein, represents the j-th scratch; the non-scratch region in the i-th image block P i " is regarded as background, and the pixel brightness thereof is set to 0 to obtain an image block Q i which only retains K i scratches, thereby obtaining M image blocks which only retain scratches

[0013] Step 4, calculate the scratch width using an improved scratch width calculation method:

[0014] Step 4.1, take the circumscribed rectangle of the j-th scratch in the i-th image block Q i as a scratch image

[0015] Step 4.2, calculate the division result of the length and width of the minimum circumscribed rectangle of the scratch in the scratch image If the division result is an integer, then the division result minus 1 is taken as the segmentation number Otherwise, the division result is directly taken as the segmentation number

[0016] ​​Step 4.3: Divide the longer side of the smallest bounding rectangle into equal parts. The segment is along the short side of the smallest bounding rectangle. Cut into Small scratches in, Indicates scratches The z-th small scratch is obtained by segmentation; calculate the z-th small scratch. The width of the minimum bounding rectangle Thus obtain Small scratches The width of the minimum bounding rectangle And select the maximum width value from them and denote it as .

[0017] Step 4.4, The diameter d of the circular structural element in the etching operation is used, and the circular structural element is used to refine the scratch image. If scratches are caused during corrosion operations. If completely eroded, assign d-1 to d and return to step 4.4; if the scratch... Partially corroded, after assigning d+1 to d, return to step 4.4 and continue until the scratch is removed. The width of is approximately equal to d;

[0018] Step 5: Obtain scratch density information using an improved scratch density detection method:

[0019] Step 5.1: Extract M image blocks containing only scratches. Scratch image I is pieced together in sequence. B ;

[0020] Step 5.2, examine scratch image I B Perform connected component analysis to obtain U scratches. Among them, s u ′ represents scratch image I B The u-th connected region, i.e. the u-th scratch;

[0021] Step 5.3: Use a circular structural element with diameter d′ to apply the solution to the u-th scratch s. u Perform morphological dilation to obtain the u-th dilated region R. u and assign R u The weight is G u ;

[0022] Using masking operations to extract scratch image I B Copy the u-th expansion region R u Then, the non-expanded region is set to a black background, and the weight of the black background is assigned to 0, thus saving the u-th scratch s.u the expansion region R of s u the image P of s B u ; thus obtaining U scratches corresponding U expansion regions and their corresponding U images

[0023] Step 5.4, superimpose the U images , and add the weights corresponding to the overlapping expansion regions in different images, thus obtaining a scratch expansion image I C ;

[0024] Statistically determine the maximum value G C of the weights in the scratch expansion image I max , and take the expansion region corresponding to G max as the scratch dense region R', thus obtaining the density information of the scratches in the dark field image I A from the scratch dense region R'.

[0025] The detection method of the smooth surface scratch width and density according to the present application is also characterized in that the density information of the scratches is obtained by the following process:

[0026] If the weight G u of R u is 1, it means that in the scratch dense region R', in the circular region R'' with d' as the diameter and any point in the scratch dense region R' as the center, there are at most G max scratches;

[0027] If the weight G u of R u is the length of s u ', it means that the maximum value of the sum of the lengths of all scratches in the scratch dense region R'' is G max .

[0028] If the weight G u of R u is the area of s u ', it means that the maximum value of the sum of the areas of all scratches in the scratch dense region R'' is G max .

[0029] An electronic device according to the present application includes a memory and a processor, and is characterized in that the memory is used to store a program supporting the processor to execute the method, and the processor is configured to execute the program stored in the memory.

[0030] The computer readable storage medium stores a computer program, and the computer program is run by a processor to execute the steps of the method.

[0031] Compared with the prior art, the beneficial technical effects of the present application are embodied in that:

[0032] 1、The method for scratch width calculation is used for the scratch width calculation, and the method is used for the scratch width calculation, and the method is used for the scratch width calculation.

[0033] 2、Compared with the prior art, the present application uses the mask operation in image processing when the weight of the scratch expansion region is superimposed.

[0034] 3、The present application has strong scalability when detecting the density, and can adapt to different requirements of scratch density detection by the diameter of the structural element and the weight of the expansion region. BRIEF DESCRIPTION OF DRAWINGS

[0035] Figure 1 The flow chart of the scratch width and density detection method of the present application is shown in the figure;

[0036] Figure 2 The dark field image block diagram in the embodiment is shown in the figure;

[0037] Figure 3 The sub-block image No. 3 in the embodiment is shown in the figure;

[0038] Figure 4 A scratch image is shown in the figure;

[0039] Figure 5 The schematic flow chart of the improved scratch width calculation method is shown in the figure;

[0040] Figure 6a The scratch segmentation situation diagram is shown in the figure;

[0041] Figure 6b The schematic diagram of calculating the small scratch width using the minimum circumscribed rectangle is shown in the figure;

[0042] Figure 6c The scratch erosion situation diagram when taking different diameters is shown in the figure;

[0043] Figure 7 Flow chart of scratch density detection algorithm;

[0044] Figure 8 Scratch distribution diagram of spliced image;

[0045] Figure 9 Density detection result diagram. DETAILED DESCRIPTION

[0046] In this embodiment, as shown in the following steps, a method for detecting scratch width and density of a smooth surface is performed: Figure 1

[0047] Step 1, collecting a dark field image I of a surface of an optical element with a size of W A ×H A ; wherein W A , H A respectively represent the width and height of the image I A ; in this embodiment, the size of the collected dark field image is 1600×1200;

[0048] Step 2, dividing the dark field image I A into M image blocks, denoted as P i ; wherein P A represents the i-th image block in the dark field image I A ; the purpose of the division is to make full use of multi-core processors or multi-thread resources to process the image blocks in parallel, thereby speeding up the image processing process, and avoiding the problem of defect missing detection caused by directly using a global threshold; the size of the image block is set as W A ′×H A ′, the number of divided columns and rows are the division results of W A and W′, H i and H′, respectively; if the division cannot be performed, black pixel padding is performed on the right and lower boundaries of the image I i ; in this embodiment, as shown in the following image, the image is divided into 12 image blocks with a resolution of 500×500, the width padding size of the image I i is 400, the height padding size is 300, the number of divided rows and columns are 3 and 4, respectively;

[0049] Step 3, pre-processing and identifying scratch defects:

[0050] Step 3.1, using grayscale and median filtering to pre-process the i-th image block P i to eliminate random noise of the system, to obtain the pre-processed i-th image block P i ′;​

[0051] Step 3.2: Process the preprocessed i-th image block P i The Otsu's method performs maximum inter-class variance thresholding to clearly separate the defect from the background. Background pixels have a brightness of 0, while defect pixels have a brightness of 255, resulting in segmented image blocks. A closing operation is then performed to fill small holes in the defect, yielding the i-th image block P after hole removal. i ";

[0052] Step 3.3: For the i-th image block P after removing holes... i "Perform connected component analysis to identify K." i scratches in, Let j be the j-th scratch; let the i-th image block P be... i "The non-scratched areas are treated as the background, and their pixel brightness is set to 0, resulting in a K-value-only image." i Image patch Q with scratches i This yields M image patches that retain only the scratches. Figure 3 This is the image obtained after processing image block number 3 in this embodiment. It is observed that the scratch is a bright image on a dark background. This image composed of light and dark is very beneficial for digital processing.

[0053] Step 4: Calculate the scratch width using the improved scratch width calculation method:

[0054] Step 4.1: Transfer the i-th image block Q i The jth scratch The bounding rectangle of the image is used as a scratch image. Figure 4 This is an image of a scratch in this embodiment.

[0055] Step 4.2: Calculate the scratch image Medium scratches The result of dividing the length and width of the smallest bounding rectangle is used as the segment number if the result is an integer, and 1 is subtracted from the result. Otherwise, directly use the result of the division as the number of segments. During the segmentation process, if there are too many segments, the length of small scratches may be shorter than the width, causing the length to be recorded as the width in error; if there are too few segments, the width calculation result will be too large, and the initial diameter setting of the erosion structural element will be too large, which will increase the number of erosion operations and reduce the program execution speed. Therefore, the method of calculating the number of segments in step 4.2 is the better choice.

[0056] Step 4.3: Divide the longer side of the smallest bounding rectangle into equal parts. The segment is along the short side of the smallest bounding rectangle. Cut into Small scratches in, Indicates scratches The z-th small scratch is obtained by segmentation; calculate the z-th small scratch. The width of the minimum bounding rectangle Thus obtain Small scratches The width of the minimum bounding rectangle And select the maximum width value from them and denote it as .

[0057] Step 4.4, The diameter d of the circular structural element in the etching operation is used, and the circular structural element is used to refine the scratch image. If scratches are caused during corrosion operations. If completely eroded, assign d-1 to d and return to step 4.4; if the scratch... Partially corroded, after assigning d+1 to d, return to step 4.4 and continue until the scratch is removed. The width of is approximately equal to d;

[0058] In this embodiment, the process of calculating the scratch width is as follows: Figure 5 As shown, in the case of Figure 4 In calculating the width of the scratch, the length and width calculated using the minimum bounding rectangle are 132 and 16, respectively. The division result is 8.25, therefore the number of segments is taken as 8. Figure 6a This is a diagram illustrating the segmentation of the scratches. Figure 6b This diagram illustrates the calculation of the width of each small scratch using the minimum bounding rectangle. The maximum width of the small scratch is 12, which is used as the initial diameter d of the circular structural element. The diameter at which the scratch is completely eroded is found by performing a cyclic erosion operation on the complete scratch. Figure 6c The data shows the corrosion of the scratch. When d is 5 or 6, most of the scratch remains uncorroded. When d is 10, the scratch is completely corroded. By comparing the case where the scratch is not completely corroded when d is 9, it is determined that the scratch is completely corroded when the diameter is 10. Therefore, 10 is the width of the scratch.

[0059] Step 5, as follows Figure 7 As shown, an improved scratch density detection method is used to obtain scratch density information:

[0060] Step 5.1: Extract M image blocks containing only scratches. Scratch image I is pieced together in sequence. B ;like Figure 8 As shown;

[0061] Step 5.2, on the scratch image I B Perform connected domain analysis to obtain U scratches where s u ' represents the u-th connected domain of the scratch image I B , i.e., the u-th scratch;

[0062] Step 5.3, perform morphological dilation operation on the u-th scratch s u ' using a circular structuring element with diameter d', to obtain the u-th dilated region R u , and assign a weight G u to R u ; where the diameter d' is set according to the specific requirements for density in the optical element surface defect evaluation standard followed by the actual detection process; as shown in the figure, the weight of the scratch dilated region is identified in the figure. Figure 9

[0063] Use the mask operation to copy the u-th dilated region R B from the scratch image I u , and set the non-dilated region as black background, and assign a weight of 0 to the black background, to obtain the image P u u that saves the dilated region R u of the u-th scratch s B '; thus obtaining U dilated regions corresponding to U scratches and U images corresponding thereto

[0064] Step 5.4, superimpose the U images , and accumulate the weights corresponding to the overlapping dilated regions in different images, to obtain a scratch dilated image I C ;

[0065] Statistically, the maximum value G C of the weight in the scratch dilated image I max , and the dilated region corresponding to G max is taken as the scratch dense region R'; if the weight G u of R u is 1, it means that in the scratch dense region R', the circular region R" with d' as the diameter and the center at any point has at most G max scratches; if the weight G u of R u is the length of s u ', it means that the maximum value of the sum of the lengths of all scratches in the scratch dense region R" is G max ; if the weight G u of R u is s uIf the area of R' is less than the area of R, then the maximum value of the sum of the areas of all scratches in the scratch-intensive region R" is G max .

[0066] In this embodiment, an electronic device includes a memory for storing a program supporting a processor to execute the above method, and the processor is configured to execute the program stored in the memory.

[0067] In this embodiment, a computer readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, performs the steps of the above method.

Claims

1. A method of detecting the width and density of scratches on a smooth surface, characterized by, The method comprises the following steps: Step 1, collecting a dark field image I A of the surface of the optical element of size W A x H A ; where W A , H A denote the width and height of the image I A , respectively. Step 2, on the dark-field image I A into M image blocks, denoted as where P i denotes the i-th image block in the dark-field image I A . Step 3, pre-processing and identifying scratch defects: Step 3.1, using graying and median filtering on the ith image block P i Step 2.1, pre-processing the ith image block P i ′; Step 3.2, performing maximum inter-class variance threshold segmentation on the pre-processed i-th image block P i to obtain a segmented image block, and then performing a closing operation to obtain the i-th image block P after removing holes i "; Step 3.3, the i-th image block P after removing the holes i "connected component analysis is performed to identify K i Line marks wherein, is the j-th line mark; the i-th image block P i "non-mark region in the i-th image block P i is obtained, which is only reserved for K i line marks, thereby obtaining M image blocks only reserved for line marks Step 4, calculating the width of the scratch by using an improved scratch width calculation method: Step 4.1, the i-th image block Q i the j-th scratch in the image the j-th scratch in the image Step 4.2, calculating the scratch image the minimum circumscribed rectangle of the scratch the length of the minimum circumscribed rectangle of the scratch divided by the width of the minimum circumscribed rectangle of the scratch, if the result is an integer, then the result minus 1 is the number of segments otherwise, the result is the number of segments directly Step 4.3, divide the long side of the minimum circumscribed rectangle into segments, and divide the scratch into segment small scratches wherein, the scratch is divided into the zth segment small scratch; calculate the width of the minimum circumscribed rectangle of the zth segment small scratch . Thus, the width of the minimum circumscribed rectangle of the zth segment small scratch is obtained. The maximum width value is selected from the width of the minimum circumscribed rectangle of the zth segment small scratch and is recorded as Step 4.4, The diameter d of the circular structural element in the etching operation is used, and the circular structural element is used to refine the scratch image. If scratches are caused during corrosion operations. If completely eroded, assign d-1 to d and return to step 4.4; if the scratch... Partially corroded, after assigning d+1 to d, return to step 4.4 and continue until the scratch is removed. The width of is approximately equal to d; Step 5, obtaining the density information of the scratch by using an improved scratch density detection method: Step 5.1, M image patches with only the scratch remaining stitching the scratch image I B ; Step 5.2, on the scratch image I B Perform connected component analysis to obtain U scratches where s' = s - s0 u denotes the u-th connected component of the scratch image I B i.e. the u-th scratch; Step 5.

3. Apply a morphological dilation operation to the u-th scratch s' with a circular structuring element of diameter d' u Step 5.

4. Obtain the u-th dilated region R u Step 5.

5. Assign to R u a weight G u ; Using a mask operation from scratch image I B Copy out the u-th dilated region R u , and set the non-dilated region as black background, and give the weight of black background as 0, get the dilated region R u saving the u-th scratch s' u image P B u ; so as to obtain U scratches corresponding to U dilated regions and their corresponding U images Step 5.4, creating the U-image The superposition is performed and the weights corresponding to the overlapping inflated regions in the different images are added, thus obtaining a scratch inflation image I C ; counting the number of pixels in the expanded image I C the maximum value G of the middle weight max and taking the expanded region corresponding to G max as the scratch dense region R', so that the dark field image I A is obtained from the scratch dense region R', thereby obtaining the scratch density information.

2. The method of detecting the width and density of scratches on a smooth surface according to claim 1, wherein The density information of the scratch is obtained by the following process: If the weight G u of the region R u is 1, it means that in the circular region R″ with the center at any point in the scratch dense region R′ and the diameter d′, there are at most G max scratches. If the weight G u of the scratch R u is the length s′ u , then the maximum value of the sum of the lengths of all scratches in the scratch-intensive area R″ is G max ; If the weight G u of the scratch area R u is the area of s′ u , then the maximum value of the sum of all scratch areas in the scratch dense area R″ is G max .

3. An electronic device comprising a memory and a processor, characterized in that The memory is used for storing programs supporting the processor to execute the method of claim 1 or 2, and the processor is configured to execute the programs stored in the memory.

4. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to perform the steps of the method of claim 1 or 2.

Citation Information

Patent Citations

  • Optical element weak scratch detection method, system and device based on dark field image

    CN110706224A

  • Inspection of components for imperfections

    GB201705052D0