Method and device for detecting weak defect in image, equipment and storage medium
Through median filtering and local grayscale feature algorithms combined with multi-threshold segmentation and fusion algorithms, the problem of versatility and accuracy of weak defect detection in images is solved, and the detection effect is improved.
Patent Information
- Application Number
- CN202410878845.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-10-11
AI Technical Summary
The existing technology lacks versatility in detecting weak defects in images. Improper setting of sensitivity factors leads to inaccurate detection. Deep learning algorithms have problems such as difficulty in sample collection, long training time, difficulty in feature learning, and inconsistent edge segmentation sizes.
Median filtering is used combined with a local grayscale feature algorithm to analyze and fuse images through at least two threshold segmentation algorithms, anomaly screening algorithms and candidate weak defect fusion algorithms to improve the accuracy and consistency of weak defect detection.
It improves the detection rate of weak defects in images and the accuracy of edge segmentation, reduces the possibility of over-detection, and enhances the consistency and accuracy of weak defect size calculations.
Smart Images

Figure CN118761982A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method, device, equipment and storage medium for detecting weak defects in an image. Background Art
[0002] In the field of optical inspection image analysis and processing technology, detecting the contrast between the target object and the image background is an important basis for image analysis and detection. If the target object image is weak, slight changes in the image background and noise interference will affect the detection of weak defects. In the prior art, the detection method for weak defects in images can only solve a single problem, and it is difficult to achieve universality. For example, the adaptive binarization algorithm cannot accurately detect weak defects when its sensitivity factor is too large, and there will be over-detection and false judgment of background changes when the sensitivity factor is too small. For another example, the median filtering adaptive binarization algorithm cannot solve the problems of weak defect detection and image background change over-detection and false judgment at the same time. For another example, deep learning algorithms have problems such as difficult sample collection, long training time, difficult feature learning, and inconsistent edge segmentation size. How to properly detect weak defects in images has become a topic that the industry needs to solve urgently. Summary of the invention
[0003] The present invention provides a method, device, equipment and storage medium for detecting weak defects in an image, which are used to improve the detection rate of weak defects in an image, improve the accuracy of edge segmentation of weak defects in an image, and thus improve the consistency and accuracy of size calculation of weak defects in an image.
[0004] According to a first aspect of the present invention, a method for detecting weak defects in an image is provided, the method for detecting weak defects in an image comprising:
[0005] Performing median filtering on the received source image to obtain a filtered image of the source image;
[0006] Performing image processing on the filtered image using a local grayscale feature algorithm to obtain a background image in the filtered image;
[0007] Analyzing the background image by using at least two threshold segmentation algorithms, an abnormal screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image;
[0008] Perform image fusion on the weak defects in the candidate images to obtain the weak defects in the images.
[0009] In one embodiment, performing median filtering on the received source image includes:
[0010] The received source image is subjected to small window median filtering, and the filtering formula used is as follows:
[0011] g(x,y)=Median{f(xk,yl)k、l∈W}
[0012] Among them, g(x,y) is the filtered image, f(x,y) is the source image, Median{} is the median filter function, k is the width of the filter window, l is the height of the filter window, and W is the filter window.
[0013] In one embodiment, the step of performing image processing on the filtered image using a local grayscale feature algorithm to obtain a background image in the filtered image includes:
[0014] The filtered image is downsampled, and the formula is as follows:
[0015]
[0016] Among them, g(x,y) is the filtered image, s(x,y) is the downsampled image, and N is the downsampling coefficient;
[0017] The downsampled image is subjected to median filtering, and the formula is as follows:
[0018] s`(x,y)=Median{f(xk,yl)k、l∈W}
[0019] Where s`(x, y) is the filtered image of the downsampled image, Median{} is the median filter function, k is the width of the filter window, l is the height of the filter window, and W is the filter window;
[0020] The filtered image of the downsampled image is upsampled, and the formula is as follows:
[0021] g`(x,y)=s`(Round(x / N),Round(y / N))
[0022] Among them, g`(x, y) is the background image of the filtered image, s`(x, y) is the filtered image of the downsampled image, and N is the upsampling coefficient.
[0023] In one embodiment, the segmentation algorithm using at least two thresholds detects at least two weak defects, including:
[0024] According to at least two thresholds, a binarization algorithm is performed on the grayscale difference value of the background image of the filtered image, and the formula is as follows:
[0025]
[0026] Among them, g(x,y) is the filtered image, g`(x,y) is the background image of the filtered image, T1 is the first threshold, T2 is the second threshold, T3 is the third threshold, and T3 < T2 < T1. v1(x,y) is the first abnormal segmentation image of the filtered image, v2(x,y) is the second abnormal segmentation image of the filtered image, and v3(x,y) is the third abnormal segmentation image of the filtered image.
[0027] In one embodiment, the abnormal screening algorithm includes:
[0028] Eliminate the invalid regions in the abnormal segmentation image through the Mask mask region, and the formula is as follows:
[0029]
[0030] Among them, v1(x,y) is the first abnormal segmentation image of the filtered image, v2(x,y) is the second abnormal segmentation image of the filtered image, Mask1 is the first mask region, Mask2 is the second mask region, v1`(x,y) is the region operation image of the first segmentation image, and v2`(x,y) is the region operation image of the second segmentation image.
[0031] In one embodiment, the candidate weak defect fusion algorithm includes:
[0032] Perform a region AND operation on the region operation image of the first segmentation image and the region operation image of the second segmentation image to obtain a union region;
[0033] Perform a dilation operation on the union region to obtain the union dilation region;
[0034] Perform a region intersection operation on the union dilation region and the third abnormal segmentation image to obtain an abnormal intersection region;
[0035] Perform a closing operation on the abnormal intersection region to obtain the weak defects in the candidate image.
[0036] In one embodiment, the image fusion of the weak defects in the candidate image to obtain the weak defects in the image includes:
[0037] Calculate the edge distance between each weak defect in the candidate image;
[0038] When the edge distance between any two weak defects in the candidate image is less than the preset fusion distance, perform image fusion;
[0039] Traverse all the weak defects in the candidate image and perform image fusion to obtain the weak defects in the image.
[0040] According to a second aspect of the present invention, there is provided a device for detecting weak defects in an image, comprising:
[0041] A filtering module, used for performing median filtering on the received source image to obtain a filtered image of the source image;
[0042] A grayscale module, used for performing image processing on the filtered image using a local grayscale feature algorithm to obtain a background image in the filtered image;
[0043] An analysis module, used to analyze the background image by using at least two threshold segmentation algorithms, an abnormal screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image;
[0044] The fusion module is used to perform image fusion on the weak defects in the candidate images to obtain the weak defects in the images.
[0045] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising: a communication interface, a processor, and a memory;
[0046] The memory is used to store program instructions, and when the program instructions are executed by the processor that is communicatively connected to the memory through the communication interface, any of the above-mentioned methods for detecting weak defects in an image is implemented.
[0047] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, characterized in that computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are executed by a computer (for example, a processor in the computer), any of the above-mentioned methods for detecting weak defects in an image is implemented.
[0048] In summary, the present invention provides a method and device for detecting weak defects in an image, the method comprising: performing median filtering on a received source image to obtain a filtered image of the source image; performing image processing on the filtered image using a local grayscale feature algorithm to obtain a background image in the filtered image; analyzing the background image using a segmentation algorithm with at least two thresholds, an abnormal screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in a candidate image; performing image fusion on the weak defects in the candidate image to obtain weak defects in the image. The technical solution of the present application ensures the detection rate of weak defects in an image, while reducing the possibility of over-detection, improving the accuracy and completeness of edge segmentation of weak defects in an image, and thereby improving the consistency and accuracy of size calculation of weak defects in an image.
[0049] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0050] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 A flowchart of a method for detecting weak defects in an image provided by an embodiment of the present invention;
[0053] Figure 2 A flowchart of step S12 of a method for detecting weak defects in an image provided by an embodiment of the present invention;
[0054] Figure 3 A flowchart of step S13 of a method for detecting weak defects in an image provided by an embodiment of the present invention;
[0055] Figure 4 A flowchart of step S14 of a method for detecting weak defects in an image provided by an embodiment of the present invention;
[0056] Figure 5 A structural diagram of a device for detecting weak defects in an image provided by an embodiment of the present invention;
[0057] Figure 6 A structural diagram of an electronic device provided by an embodiment of the present invention;
[0058] Figure 7 A schematic diagram of a source image provided for an embodiment of the present invention;
[0059] Figure 8 A schematic diagram of a filtered image provided by an embodiment of the present invention;
[0060] Fig. 9 A schematic diagram of a background image of a filtered image provided by an embodiment of the present invention;
[0061] Fig.10Schematic diagram of weak defects in three candidate images provided by an embodiment of the present invention;
[0062] Fig.11 A schematic diagram of a weak defect detection result provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0064] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0065] like Figure 1 As shown, the present invention provides a method for detecting weak defects in an image, and the method for detecting weak defects in an image includes steps S11-S14:
[0066] In step S11, a median filter is performed on the received source image to obtain a filtered image of the source image;
[0067] In step S12, the filtered image is processed using a local grayscale feature algorithm to obtain a background image in the filtered image;
[0068] In step S13, the background image is analyzed by a segmentation algorithm of at least two thresholds, an abnormal screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image;
[0069] In step S14, image fusion is performed on the weak defects in the candidate images to obtain the weak defects in the images.
[0070] In one embodiment, the received source image may be a grayscale image or a color image. Figure 7 As shown. Median filtering the source image can retain the true grayscale information of the source image to the maximum extent and reduce the influence of noise interference in the source image. For each pixel point, the median filter replaces the value of the pixel point with the average value of the pixel values around it. For example, if the pixel values around a pixel point are [10, 20, 30, 40, 50, 60, 70, 80], and the value is 50, the value of the pixel point will be replaced with 50. The specific method is to use the small window median filtering algorithm for processing. The formula of the small window median filtering algorithm is as follows:
[0071] g(x,y)=Median{f(xk,yl)k、l∈W}
[0072] Among them, g(x,y) is the filtered image, f(x,y) is the source image, Median{} is the median filter function, k is the width of the filter window, l is the height of the filter window, W is the filter window, and the filtered image is as shown in the attached figure. Figure 8 In a preferred embodiment, the filter window is preferably a 3*3 window.
[0073] The purpose of the local grayscale feature algorithm is to extract the local features of the image. First, the filtered image is downsampled, then the median filter is applied, and finally upsampled to obtain a smoother background image. It is usually used to distinguish the target object image from the background image. The specific method is to analyze the local area of the image and calculate the statistical characteristics of the grayscale value, such as the mean, variance, etc. For example, in a local area of the image, the grayscale average of all pixels is calculated. If this average is lower than a certain threshold, the local area may be considered to belong to the background image. Through segmentation algorithms with different thresholds, the detection rate of weak defects can be improved, the over-detection caused by slight changes in the background image can be reduced, and the accuracy of weak defect edge segmentation can be improved. After each threshold segmentation, the abnormal points in the image that do not belong to weak defects are removed by abnormal area calculation. The method is to remove the invalid area in the abnormal segmentation image and filter out the abnormal area with too small area through the Mask mask area. The candidate weak defect fusion algorithm is to improve the integrity of weak defect detection and the consistency and accuracy of weak defect size calculation. The method is to fuse the candidate defect images obtained by the multi-threshold segmentation algorithm, perform regional AND operation on the regional operation image of the first segmented image and the regional operation image of the second segmented image, and then expand the union area, perform regional intersection operation with the third abnormal segmented image, and then perform closed operation to obtain the weak defects in the candidate image. According to the edge distance between the weak defects in each of the candidate images, image fusion is performed to finally obtain the weak defects in the image.
[0074] The technical solution in this embodiment is well applicable to the detection of weak defects in images in visual inspection equipment such as glass cover plates, glass substrates, display panels, semiconductor wafers, silicon wafers, etc. It can improve the detection rate of weak defects, reduce over-detection and false positives due to slight changes in the image background, improve the accuracy of weak defect edge segmentation, improve the integrity of weak defect detection, and thereby improve the consistency and accuracy of weak defect size calculation.
[0075] In one embodiment, Figure 2 As shown, step S12 includes the following steps S21-S23:
[0076] In step S21, downsampling the filtered image;
[0077] In step S22, median filtering is performed on the downsampled image;
[0078] In step S23, the filtered image of the downsampled image is upsampled.
[0079] In one embodiment, the image processing algorithm for local grayscale features is a downsampling-median filtering-upsampling algorithm for quickly and efficiently obtaining a background image. Downsampling is performed on the filtered image. Downsampling is an image size reduction technique that reduces the resolution of the image by reducing the number of pixels in the image. The preferred value of the downsampling coefficient N is 80. The formula is as follows:
[0080]
[0081] Among them, g(x,y) is the filtered image, s(x,y) is the downsampled image, and N is the downsampling coefficient.
[0082] The downsampled image is subjected to median filtering. Median filtering is a nonlinear digital filtering technique used to remove noise in images, especially salt and pepper noise. It is achieved by replacing each pixel value with the median value in its neighborhood. The formula is as follows:
[0083] s`(x,y)=Median{f(xk,yl)k、l∈W}
[0084] Among them, s`(x, y) is the filtered image of the downsampled image, Median{} is the median filter function, k is the width of the filter window, l is the height of the filter window, and W is the filter window.
[0085] Upsampling is the inverse process of downsampling, which is used to increase the resolution of the image. Upsampling is done by enlarging the median filtered image s′(x,y) back to the size of the original image g(x,y). The formula is as follows
[0086] g`(x,y)=s`(Round(x / N),Round(y / N))
[0087] Among them, g`(x,y) is the background image of the filtered image, as shown in the attached figure. Fig. 9 As shown, s`(x, y) is the filtered image of the downsampled image, N is the upsampling coefficient, and Round() is the rounding function.
[0088] In one embodiment, Figure 3 As shown, step S13 includes the following steps S31-S36:
[0089] In step S31, a binarization algorithm is performed on the grayscale difference value of the background image of the filtered image according to at least two thresholds;
[0090] In step S32, the invalid area in the abnormal segmented image is removed by using the Mask area;
[0091] In step S33, performing a regional AND operation on the regional operation image of the first segmented image and the regional operation image of the second segmented image to obtain a union region;
[0092] In step S34, a dilation operation is performed on the union region to obtain the union dilated region;
[0093] In step S35, a region intersection operation is performed on the union dilation region and the third abnormal segmentation image to obtain an abnormal intersection region;
[0094] In step S36, a closing operation is performed on the abnormal intersection area to obtain a weak defect in the candidate image.
[0095] In one embodiment, a binarization algorithm is performed on the grayscale difference value of the background image of the filtered image, and the formula is as follows:
[0096]
[0097] Among them, g(x, y) is the filtered image, g`(x, y) is the background image of the filtered image, T1 is the first threshold, T2 is the second threshold, T3 is the third threshold, and T3 < T2 < T1. The purpose of using the larger first threshold T1 is to reduce the over-detection misjudgment caused by slight changes in the background of the image edge. The purpose of using the intermediate second threshold T2 is to improve the detection rate of weak defects and reduce the over-detection caused by slight changes in the background image. The purpose of using the smaller third threshold T3 is to improve the accuracy of weak defect edge segmentation. In a preferred embodiment, the value of the first threshold T1 is 9, the value of the second threshold T2 is 7, and the value of the third threshold T3 is 3. v1(x, y) is the first abnormal segmentation image of the filtered image, v2(x, y) is the second abnormal segmentation image of the filtered image, v3(x, y) is the third abnormal segmentation image of the filtered image, as shown in the appendix Fig.10 as follows.
[0098] The invalid regions in the abnormal segmentation images are removed through the Mask mask region, and the formula is as follows:
[0099]
[0100] Among them, v1(x, y) is the first abnormal segmentation image of the filtered image, v2(x, y) is the second abnormal segmentation image of the filtered image, Mask1 is the first mask region, Mask2 is the second mask region, v1`(x, y) is the region operation image of the first segmentation image, and v2`(x, y) is the region operation image of the second segmentation image. The first mask region, Mask1, is slightly smaller than the filtered image, and the second mask region Mask2 is slightly smaller than the first mask region Mask1. The purpose is to reduce the probability of over-detection of background changes at the image edge. Also, both the first mask region Mask1 and the second mask region Mask2 need to remove abnormal regions smaller than the preset removal threshold, and the abnormal regions are S T1 and S T2 , and S T1 and S T2 are independent of each other in size and shape.
[0101] Perform region operations on the filtered segmentation images. Perform a region AND operation on v1′(x, y) and v2′(x, y) to obtain the union region v3′(x, y) = v1′(x, y) ∪ v2′(x, y). Perform a dilation operation on the union region v3′(x, y) to obtain the union dilation region v3*(x, y). Perform a region intersection operation on the union dilation region v3*(x, y) and the third abnormal segmentation image v3(x, y) to obtain the abnormal intersection region v4(x, y) = v3*(x, y) ∩ v3(x, y). Perform a closing operation on the abnormal intersection region v4(x, y) to obtain the weak defects in the candidate image.
[0102] In one embodiment, Figure 4 As shown, step S14 includes the following steps S41-S43:
[0103] In step S41, the edge distances between the weak defects in the candidate image are calculated;
[0104] In step S42, when the edge distance between the weak defects in any two of the candidate images is less than a preset fusion distance, image fusion is performed;
[0105] In step S43, the weak defects in all candidate images are traversed and image fusion is performed to obtain the weak defects in the image.
[0106] In one embodiment, it is necessary to calculate the edge distance between all weak defects in the candidate images. The edge distance refers to the shortest distance between the boundaries of two weak defects. By traversing all weak defects in the candidate images and performing image fusion, the weak defects in the image can be finally obtained, as shown in the attached figure. Fig.11 shown.
[0107] For example, the following three weak defects A, B and C, the edge distances between them are shown in Table 1, and the preset fusion distance is 12.
[0108] Table 1
[0109] Defective area Edge distance to A Edge distance to B Edge distance to C A / 10 20 B 10 / 15 C 20 15 /
[0110] The edge distance between weak defect A and weak defect B is 10, which meets the conditions for image fusion, so weak defect A and weak defect B are merged into a larger weak defect.
[0111] The edge distance between weak defect B and weak defect C is 15, and the edge distance between weak defect A and weak defect C is 20. Neither of them meets the fusion condition, so C will exist independently.
[0112] The process of using code to implement the above-mentioned weak defect image fusion is as follows.
[0113] a. Count the number n of weak defects in the candidate images;
[0114] b. Select weak defect i, with an initial value of 1; start traversing weak defects until n;
[0115] c. Select weak defect j, with initial value i+1;
[0116] d. Calculate the edge distance between weak defect i and weak defect j; when the edge distance between weak defect i and weak defect j is greater than the preset fusion distance D, j=j+1; when the edge distance between weak defect i and weak defect j is less than or equal to D, merge weak defect i and weak defect j, and replace weak defect i with the merged abnormal area, remove weak defect j, j=j-1, and recalculate the number of weak defects n;
[0117] e. When j is less than n, steps c and d are executed repeatedly until the weak defect j is traversed to n, and the loop ends, i=i+1;
[0118] f. When i is less than n, steps b, c, d, and e are executed repeatedly until the weak defect i is traversed to n, and the loop ends;
[0119] g. Output weak defects in the final fused image.
[0120] The image fusion algorithm in this embodiment can enhance the integrity of defect detection, thereby improving the consistency and accuracy of the size calculation of weak defects.
[0121] In one embodiment, Figure 5 FIG. 1 is a block diagram of a device for detecting weak defects in an image according to an exemplary embodiment. Figure 5 As shown, the detection device for weak defects in the image includes a filtering module 51, a grayscale module 52, an analysis module 53 and a fusion module 54.
[0122] The filtering module 51 is used to perform median filtering on the received source image to obtain a filtered image of the source image;
[0123] The grayscale module 52 is used to process the filtered image using a local grayscale feature algorithm to obtain a background image in the filtered image;
[0124] The analysis module 53 is used to analyze the background image by using at least two threshold segmentation algorithms, an abnormal screening algorithm and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image;
[0125] The fusion module 54 is used to perform image fusion on the weak defects in the candidate images to obtain the weak defects in the images.
[0126] The filtering module 51, the grayscale module 52, the analysis module 53 and the fusion module 54 included in the block diagram of the device for detecting weak defects in an image are controlled to execute the method for detecting weak defects in an image described in any of the above embodiments.
[0127] like Figure 6 As shown, the present invention provides an electronic device 600, which includes: a communication interface, a processor 601, and a memory 602;
[0128] Among them, the memory 602 is used to store program instructions. When the program instructions are executed by the processor 601 that is communicatively connected to the memory 602 through the communication interface, the received source image is subjected to median filtering to obtain a filtered image of the source image; the filtered image is subjected to image processing using a local grayscale feature algorithm to obtain a background image in the filtered image; the background image is analyzed using a segmentation algorithm with at least two thresholds, an abnormality screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image; and the weak defects in the candidate image are subjected to image fusion to obtain weak defects in the image.
[0129] The present invention provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, a median filtering process is performed on a received source image to obtain a filtered image of the source image; a local grayscale feature algorithm is used to perform image processing on the filtered image to obtain a background image in the filtered image; the background image is analyzed by a segmentation algorithm with at least two thresholds, an abnormality screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in a candidate image; and image fusion is performed on the weak defects in the candidate image to obtain weak defects in the image.
[0130] It should be understood that the specific features, operations and details described hereinabove about the method of the present invention may also be similarly applied to the device and system of the present invention, or, vice versa. In addition, each step of the method of the present invention described above may be performed by the corresponding parts or units of the device or system of the present invention.
[0131] It should be understood that each module / unit of the device of the present invention can be implemented in whole or in part by software, hardware, firmware or a combination thereof. Each module / unit can be embedded in the processor of the computer device in the form of hardware or firmware or independent of the processor, or can be stored in the memory of the computer device in the form of software for the processor to call to perform the operation of each module / unit. Each module / unit can be implemented as an independent component or module, or two or more modules / units can be implemented as a single component or module.
[0132] In one embodiment, a computer device is provided, which includes a memory and a processor, and the memory stores computer instructions executable by the processor, and the computer instructions instruct the processor to execute each step of the method of the embodiment of the present invention when executed by the processor. The computer device can be a server, a terminal, or any other electronic device with necessary computing and / or processing capabilities in a broad sense. In one embodiment, the computer device may include a processor, a memory, a network interface, a communication interface, etc. connected through a system bus. The processor of the computer device can be used to provide necessary computing, processing and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory can provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the computer device can be used to connect and communicate with external devices through a network. The steps of the method of the present invention are executed by the processor.
[0133] The present invention may be implemented as a computer-readable storage medium having a computer program stored thereon, which causes the steps of the method of an embodiment of the present invention to be executed when executed by a processor. In one embodiment, the computer program is distributed on a plurality of computer devices or processors coupled to a network so that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be performed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be performed by one or more computer devices or processors, and one or more other method steps / operations may be performed by one or more other computer devices or processors. One or more computer devices or processors may perform a single method step / operation, or perform two or more method steps / operations.
[0134] It will be appreciated by those skilled in the art that the method steps of the present invention may be performed by instructing related hardware such as a computer device or a processor through a computer program, and the computer program may be stored in a non-temporary computer-readable storage medium, which causes the steps of the present invention to be performed when the computer program is executed. Depending on the circumstances, any reference to memory, storage, database, or other media herein may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0135] The various technical features described above can be combined arbitrarily. Although all possible combinations of these technical features are not described, any combination of these technical features should be considered to be covered by this specification as long as there is no contradiction in such combination.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting weak defects in an image, characterized in that: Including: Performing median filtering on the received source image to obtain a filtered image of the source image; Performing image processing on the filtered image using a local gray feature algorithm to obtain a background image in the filtered image; Analyzing the background image through a segmentation algorithm with at least two thresholds, an anomaly screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image; Performing image fusion on the weak defects in the candidate image to obtain weak defects in the image.
2. The method for detecting weak defects in an image according to claim 1, characterized in that: The performing median filtering on the received source image includes: Performing small-window median filtering on the received source image, and the filtering formula used is as follows: g(x,y) = Median{f(x - k,y - l) k, l ∈ W} Where, g(x,y) is the filtered image, f(x,y) is the source image, Median{} is the median filtering function, k is the width of the filtering window, l is the height of the filtering window, and W is the filtering window.
3. The method for detecting weak defects in an image according to claim 1, characterized in that: The performing image processing on the filtered image using a local gray feature algorithm to obtain a background image in the filtered image includes: Performing downsampling on the filtered image, and the formula is as follows: Where, g(x,y) is the filtered image, s(x,y) is the downsampled image, and N is the downsampling coefficient; Performing median filtering on the downsampled image, and the formula is as follows: s`(x,y) = Median{f(x - k,y - l) k, l ∈ W} Where, s`(x,y) is the filtered image of the downsampled image, Median{} is the median filtering function, k is the width of the filtering window, l is the height of the filtering window, and W is the filtering window; Performing upsampling on the filtered image of the downsampled image, and the formula is as follows: g`(x,y) = s`(Round(x / N),Round(y / N)) Where, g`(x,y) is the background image of the filtered image, s`(x,y) is the filtered image of the downsampled image, and N is the upsampling coefficient.
4. The method for detecting weak defects in an image according to claim 3, characterized in that: The detecting at least two kinds of weak defects through a segmentation algorithm with at least two thresholds includes: Performing a binary algorithm on the gray difference value of the background image of the filtered image according to at least two thresholds, and the formula is as follows: Where, g(x,y) is the filtered image, g`(x,y) is the background image of the filtered image, T1 is the first threshold, T2 is the second threshold, T3 is the third threshold, and T3 < T2 < T1, v1(x,y) is the first abnormal segmentation image of the filtered image, v2(x,y) is the second abnormal segmentation image of the filtered image, and v3(x,y) is the third abnormal segmentation image of the filtered image.
5. The method for detecting weak defects in an image according to claim 4, characterized in that: The anomaly screening algorithm includes: Removing invalid regions in the abnormal segmentation image through a Mask mask region, and the formula is as follows: Where, v1(x,y) is the first abnormal segmentation image of the filtered image, v2(x,y) is the second abnormal segmentation image of the filtered image, Mask1 is the first mask region, Mask2 is the second mask region, v1`(x,y) is the region operation image of the first segmentation image, and v2`(x,y) is the region operation image of the second segmentation image.
6. The method for detecting weak defects in an image according to claim 5, characterized in that: The candidate weak defect fusion algorithm includes: Performing a regional AND operation on the regional operation image of the first segmented image and the regional operation image of the second segmented image to obtain a union region; Performing an expansion operation on the union region to obtain the union expansion region; Performing a region intersection operation on the union dilation region and the third abnormal segmentation image to obtain an abnormal intersection region; A closing operation is performed on the abnormal intersection region to obtain a weak defect in the candidate image.
7. The method for detecting weak defects in an image according to claim 1, characterized in that: The performing image fusion on the weak defects in the candidate images to obtain the weak defects in the images includes: Calculating edge distances between each weak defect in the candidate image; When the edge distance between the weak defects in any two of the candidate images is less than a preset fusion distance, image fusion is performed; Traverse the weak defects in all candidate images and perform image fusion to obtain the weak defects in the image.
8. A device for detecting weak defects in an image, characterized in that: include: A filtering module, used for performing median filtering on the received source image to obtain a filtered image of the source image; A grayscale module, used for performing image processing on the filtered image using a local grayscale feature algorithm to obtain a background image in the filtered image; An analysis module, used to analyze the background image by using at least two threshold segmentation algorithms, an abnormal screening algorithm, and a candidate weak defect fusion algorithm to obtain weak defects in the candidate image; The fusion module is used to perform image fusion on the weak defects in the candidate images to obtain the weak defects in the images.
9. An electronic device, characterized in that: include: Communication interface, processor, memory; The memory is used to store program instructions, and when the program instructions are executed by the processor that is communicatively connected to the memory through the communication interface, the electronic device implements the method for detecting weak defects in an image as described in any one of claims 1 to 7.
10. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a computer, the computer implements the method for detecting weak defects in an image as claimed in any one of claims 1 to 7.
Citation Information
Cited By
Wafer surface pollution defect detection method and device
CN120318181A
