Detection method and apparatus, detection device, and storage medium
By matching and identifying connected image regions in workpiece inspection, the problem of inaccurate detection caused by template matching offset is solved, and efficient defect detection is achieved.
Patent Information
- Application Number
- CN202110557047.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-21
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2041-05-21
AI Technical Summary
In existing workpiece inspection technologies, when there is an offset in the area to be measured, the template matching effect is poor, resulting in inaccurate detection.
By matching the image to be tested with a preset template image, a first image region is obtained, connected components are identified, a connected component image is generated, and a second image region is compared to detect defects. A processor is used to perform these steps to achieve accurate matching and defect detection.
It improves the matching accuracy between the image to be tested and the template image, enabling precise detection of defects in the workpiece and enhancing the detection effect.
Smart Images

Figure CN115375608B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of testing technology, and in particular to a testing method, testing device, testing equipment, and a non-volatile computer-readable storage medium. Background Technology
[0002] When inspecting a workpiece to determine its defects, template matching can be used to match the image of the area to be tested on the workpiece with the corresponding area in a standard template, thereby completing the overall matching of the area to be tested. However, when there are offset parts in the area to be tested, the matching is no longer accurate, resulting in poor detection effect of template matching. Summary of the Invention
[0003] This application provides a detection method, a detection apparatus, a detection device, and a non-volatile computer-readable storage medium.
[0004] The detection method of this application includes matching a test image and a preset template image to obtain a first image region; identifying connected components of the first image region to generate a connected component image; obtaining a second image region in the test image corresponding to the connected component image; and comparing the second image region and the connected component image to detect defects in the test image.
[0005] The detection device according to this application includes a matching module, an identification module, an acquisition module, and a comparison module. The matching module is used to match the image to be tested with a preset template image to obtain a first image region; the identification module is used to identify connected components of the first image region to generate a connected component image; the acquisition module is used to acquire a second image region in the image to be tested that corresponds to the connected component image; and the comparison module is used to compare the second image region and the connected component image to detect defects in the image to be tested.
[0006] The detection device according to this application includes a processor. The processor is used to match a test image and a preset template image to obtain a first image region; identify connected components of the first image region to generate a connected component image; obtain a second image region in the test image corresponding to the connected component image; and compare the second image region and the connected component image to detect defects in the test image.
[0007] This application provides a non-volatile computer-readable storage medium containing a computer program, which, when executed by one or more processors, causes the processors to perform the detection method. The detection method includes matching a test image and a preset template image to obtain a first image region; identifying connected components of the first image region to generate a connected component image; obtaining a second image region in the test image corresponding to the connected component image; and comparing the second image region and the connected component image to detect defects in the test image.
[0008] The detection method, detection device, detection equipment, and non-volatile computer-readable storage medium of this application obtain a first image region that matches the entire image under test by matching the image under test and the template image. Then, connected components in the first image region are identified to obtain one or more connected component images. The connected component images and the image under test are then matched again to find a second image region in the image under test that corresponds to the connected component image. This completes the accurate matching of each part under test (corresponding to the second image region) in the image under test, which can improve the matching effect between the image under test and the template image. Then, each part under test is compared with the corresponding connected component image to determine the defect of each part under test, thus completing the defect detection of the image under test. The detection effect is good.
[0009] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating the detection method of some embodiments of this application;
[0012] Figure 2 This is a schematic diagram of the detection device according to some embodiments of this application;
[0013] Figure 3 This is a plan view of the detection device according to some embodiments of this application;
[0014] Figure 4 This is a schematic diagram of the image to be tested according to certain embodiments of this application;
[0015] Figure 5This is a schematic diagram of template images for certain embodiments of this application;
[0016] Figure 6 This is a flowchart illustrating the detection method of some embodiments of this application;
[0017] Figure 7 This is a schematic diagram of a second template for certain embodiments of this application;
[0018] Figures 8 to 9 This is a flowchart illustrating the detection method of some embodiments of this application;
[0019] Figures 10 to 12 This is a schematic diagram illustrating the principle of the detection method according to certain embodiments of this application;
[0020] Figure 13a , Figure 13b and Figure 13c This is a schematic diagram illustrating the principle of the detection method according to certain embodiments of this application;
[0021] Figure 14 This is a flowchart illustrating the detection method of some embodiments of this application;
[0022] Figure 15a , Figure 15b , Figure 16a , Figure 16b , Figure 17a and Figure 17b This is a schematic diagram illustrating the principle of the detection method according to certain embodiments of this application; and
[0023] Figure 18 This is a schematic diagram showing the connection between a processor and a computer-readable storage medium in some embodiments of this application. Detailed Implementation
[0024] The embodiments of this application will be further described below with reference to the accompanying drawings. The same or similar reference numerals in the drawings denote the same or similar elements or elements having the same or similar functions throughout. Furthermore, the embodiments of this application described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of this application, and should not be construed as limiting this application.
[0025] Please see Figures 1 to 3 The detection method of this application includes the following steps:
[0026] 011: Match the image to be tested with a preset template image to obtain the first image region;
[0027] 012: Identify the connected components of the first image region to generate a connected component image;
[0028] 013: Obtain the second image region in the image to be tested that corresponds to the connected component image;
[0029] 014: Compare the second image region with the connected component image to detect defects in the image under test.
[0030] The detection device 10 of this application includes a matching module 11, an identification module 12, an acquisition module 13, and a comparison module 14. The matching module 11 matches the image to be tested with a preset template image to obtain a first image region; the identification module 12 identifies connected components of the first image region to generate a connected component image; the acquisition module 13 acquires a second image region in the image to be tested that corresponds to the connected component image; and the comparison module 14 compares the second image region and the connected component image to detect defects in the image to be tested. That is, step 011 can be implemented by the matching module 11, step 012 can be executed by the identification module 12, step 013 can be executed by the acquisition module 13, and step 014 can be executed by the comparison module 14.
[0031] The detection device 100 of this application includes a processor 20. The processor 20 is used to match a test image and a preset template image to obtain a first image region; identify connected components of the first image region to generate a connected component image; obtain a second image region in the test image corresponding to the connected component image; and compare the second image region and the connected component image to detect defects in the test image. That is, steps 011, 012, 013, and 014 can be executed by the processor 20.
[0032] Specifically, the testing device 100 can be a measuring machine. It is understood that the specific form of the testing device 100 is not limited to a measuring machine, but can be any device capable of testing the workpiece 200.
[0033] The testing device 100 includes a processor 20, a motion platform 30, and a sensor 40. Both the processor 20 and the sensor 40 can be mounted on the motion platform 30. The motion platform 30 can be used to carry the test piece 200. The motion platform 30 moves to move the test piece 200, so that the sensor 40 can collect information from the test piece 200 (such as collecting a test image of the test area of the test piece 200).
[0034] For example, the motion platform 30 includes an XY motion platform 31 and a Z motion platform 32. The device under test (DUT) 200 is disposed on the XY motion platform 31, and the sensor 40 is disposed on the Z motion platform 32. The XY motion platform 31 is used to control the movement of the DUT 200 along the horizontal plane, changing the relative position of the DUT 200 and the sensor 40 in the horizontal plane. The Z motion platform 32 is used to control the movement of the sensor 40 in the direction perpendicular to the horizontal plane. In this way, the three-dimensional position of the sensor 40 relative to the DUT 200 (i.e., the relative position in the horizontal plane and the relative position in the direction perpendicular to the horizontal plane) is realized through the cooperation of the XY motion platform 31 and the Z motion platform 32. Alternatively, the XY motion platform 31 is used to control the movement of the sensor 40 in the direction perpendicular to the horizontal plane, and the Z motion platform 32 is used to control the movement of the DUT 200 along the horizontal plane.
[0035] It is understood that the motion platform 30 is not limited to the above structure; it only needs to be able to change the three-dimensional position of the sensor 40 relative to the test piece 200.
[0036] The sensor 40 can be a visible light camera, a depth camera, a distance sensor 40, etc. In this embodiment, the sensor 40 is a visible light camera.
[0037] The sensor 40 can acquire the test image of the test piece 200. If the test piece 200 includes multiple test areas, the sensor 40 can acquire the test image of at least a part of the test area of the test piece 200 each time. The motion platform 30 is used to achieve the acquisition of the test images of all areas of the test piece 200.
[0038] Then, when the processor 20 detects the image under test, it first acquires a preset template image that matches the image under test. For example, the preset template image can be determined according to the parameter information of the device under test 200 (such as type, model, etc.). The device under test 200 can be a wafer, a display panel, etc. In this embodiment, a wafer is used as an example for explanation. The wafer can be composed of multiple minimum repeating units (corresponding to a test area). The lines in each minimum repeating unit can be the same. There are channel gaps between different minimum repeating units. The field of view of the sensor 40 generally covers one minimum repeating unit. The test image of one minimum repeating unit is captured each time.
[0039] Then, the processor 20 matches the image to be tested with a preset template image. The matching process is to find the region in the preset template image that is basically the same as the image to be tested. Specifically, the template image can be traversed by a traversal box of the same size as the image to be tested. Each traversal calculates the similarity between the image region in the traversal box and the image to be tested. The similarity can be determined by the difference in pixel values at corresponding positions in the region image in the traversal box and the image to be tested, such as the sum, average, and variance of the pixel value differences. After traversing the entire template image, multiple similarities can be obtained. The image region with the highest similarity can be determined to match the image to be tested. The image region with the highest similarity is the first image region.
[0040] This is understandable; please refer to [link / reference]. Figure 4 Since the imaging accuracy of sensor 40 cannot guarantee that it will always be directly facing the smallest repeating unit Q, thus just acquiring the test image P1 of the smallest repeating unit Q, the possible situation is that the field of view of sensor 40 spans the channel H, and simultaneously captures a portion of multiple smallest repeating units Q.
[0041] In other embodiments, the test piece 200 contains a positioning marker O for matching. The processor 20 first identifies the positioning marker O in the test image P1 and the template image, and then determines a first image region by matching the positioning marker O. For example, the positioning marker O is the center of a feature circle in the test piece. By matching the center of the feature circle in the test image P1 with the center of the feature circle in the template image, the centers of the feature circles in both are aligned, thereby determining the first image region.
[0042] Please combine Figure 5 The preset template image P2 can include images of multiple standard minimum repeating units Q. Since the field of view of sensor 40 covers one minimum repeating unit Q, sensor 40 can simultaneously capture a portion of a maximum of four minimum repeating units Q across the channel. Therefore, the preset template image P2 can include standard images of four minimum repeating units Q, and the four minimum repeating units Q are arranged in a 2*2 matrix. This ensures that regardless of which part of the test piece 200 is captured by sensor 40, it can find a matching first image region A1 in the preset template image P2. Figure 4 The image to be tested, P1, has a matching first image region A1 in the template image P2.
[0043] After matching the test image P1 and the template image P2 to obtain the first image region A1, the overall matching of the test image P1 and the template image P2 is completed. Then, the processor 20 can identify the connected components in the first image region A1 to generate one or more connected component images.
[0044] In this context, a connected component is a region composed of pixels exceeding a preset threshold. It can be understood that the colors of the circuitry and the substrate on a wafer differ significantly. For example, the substrate might be nearly black, while the circuitry on the wafer might be red, yellow, or other colors. The image acquired by sensor 40 can be a grayscale image. In a grayscale image, the area containing the circuitry is nearly white. Therefore, by setting a preset threshold (e.g., 100, 150), pixels located within the circuitry can be identified. Adjacent pixels that are part of the circuitry are thus identified as the same connected component, allowing for the identification of one or more connected components. The connected component represents the region containing the circuitry that requires defect detection. One or more connected component images can be generated based on the pixels within the connected component; alternatively, a connected component image can be generated based on the image region containing the bounding rectangle of the connected component. Alternatively, the connected components in the template image can be pre-labeled, allowing the identification of only the labeled regions to determine the connected components.
[0045] After obtaining the connected component image within the first image region, the connected component image can be matched again with the image to be tested to find a second image region in the image to be tested that matches the connected component image. The matching method between the connected component image and the second image region is similar to the matching method between the image to be tested and a preset template image, and will not be elaborated here. In this way, each line region in the image to be tested can be accurately matched with the corresponding connected component image, thereby improving the matching accuracy.
[0046] Finally, the processor 20 compares the second image region with the connected component image, and based on the difference between the two, defect detection can be achieved for each second image region. For example, a difference image can be generated based on the pixel value difference at corresponding positions in the second image region and the connected component image, and then the difference between the two can be determined based on the difference image, thereby determining the defects in each third region image.
[0047] The detection method, detection device 10, and detection equipment 100 of this application obtain a first image region that matches the entire image under test by matching the image to be tested and the template image. Then, connected components in the first image region are identified to obtain one or more connected component images. The connected component images and the image under test are then matched again to find a second image region in the image under test that corresponds to the connected component image. This completes the accurate matching of each part to be tested (corresponding to the second image region) in the image under test, which can improve the matching effect between the image under test and the template image. Then, each part to be tested is compared with the corresponding connected component image to determine the defect of each part to be tested, thus completing the defect detection of the image under test. The detection effect is good.
[0048] Please see Figure 2 , Figure 3 and Figure 6In some embodiments, the template image includes a first template and a second template. The first template is an image of the smallest repeating unit of the device under test 200, and the second template is a circuit image of the smallest repeating unit. Step 011 includes:
[0049] 0111: Match the image to be tested with the first template to obtain the target image region;
[0050] 0112: Based on the mapping relationship between the first template and the second template, obtain the image region in the second template that corresponds to the target image region, and use it as the first image region.
[0051] In some implementations, the matching module 11 is further configured to match the image to be tested and the first template to obtain a target image region; based on the mapping relationship between the first template and the second template, to obtain the image region in the second template that corresponds to the target image region, as the first image region. That is to say, steps 0111 and 0112 can be performed by the matching module 11.
[0052] In some implementations, the processor 20 is further configured to match the image to be tested and the first template to obtain a target image region; based on the mapping relationship between the first template and the second template, to obtain the image region in the second template that corresponds to the target image region, as the first image region. That is to say, steps 0111 and 0112 can be executed by the processor 20.
[0053] Specifically, please refer to Figure 5 and Figure 7 The template image P2 includes a first template P21 and a second template P22. The first template P21 is an image (such as a grayscale image) of the minimum repeating unit Q, and the second template P22 is a circuit image of the minimum repeating unit Q, containing only the circuit portion of the minimum repeating unit Q. Both the first template P21 and the second template P22 include images corresponding to four minimum repeating units Q, and the images corresponding to the four minimum repeating units Q are arranged in a 2*2 matrix, thereby ensuring that the image under test has matching image regions in both the first template P21 and the second template P22.
[0054] When matching the image to be tested and the template image P2, since the image to be tested is generally a grayscale image, the image to be tested is first matched with the first template P21 to determine the target image region (e.g., Figure 5The target image region A11 shown is used for matching. Please refer to the matching method for the image to be tested and the template image P2 in the previous embodiment. The first template P21 and the second template P22 have a preset mapping relationship. It can be understood that the first template P21 and the second template P22 are the same size, and the images at corresponding positions correspond to the same local area of the standard test piece 200. Therefore, after determining the target image region A11 in the first template P21, the image region A12 corresponding to the target image region A11 can be quickly found in the second template P22 according to the mapping relationship. Figure 7 The area containing the white box in the image is used to detect defects in the circuit. Therefore, by using the image area A1 in the second template P22 that corresponds to the target image area A11 as the first image area A1, the matching of the circuit part in the image to be tested can be achieved more accurately, thereby improving the accuracy of circuit defect detection.
[0055] The second template P22 can be generated based on the first template P21. For example, by annotating the line outline in the first template P21, the area image where the line is located can be determined, thereby generating the second template P22. Alternatively, the line of the test piece 200 is designed according to a preset line drawing, such as a computer-aided design (CAD) line drawing. The second template P22 can also be generated based on the CAD line drawing. For example, since the line actually has a width, the lines in the CAD line drawing can be thickened so that the thickness of the line matches the thickness of the actual line in the second template P22, thereby generating the second template P22.
[0056] Please see Figure 2 , Figure 3 and Figure 8 In some implementations, step 012 includes:
[0057] 0121: Identify one or more pixels in the first image region with a spacing smaller than a predetermined spacing as the same connected component to generate a connected component image.
[0058] In some embodiments, the identification module 12 is further configured to identify one or more pixels in the first image region with a spacing less than a predetermined spacing as the same connected component, so as to generate a connected component image. That is, step 0121 can be performed by the identification module 12.
[0059] In some implementations, the processor 20 is further configured to identify one or more pixels in the first image region with a spacing less than a predetermined spacing as the same connected component, in order to generate a connected component image. That is, step 0121 can be executed by the processor 20.
[0060] Specifically, when determining connected components, adjacent pixels in the first image region that are located within a line area and whose distance (the distance between the centers of two pixels) is less than a predetermined distance (such as 1 pixel, 2 pixels, etc.) can be considered as pixels within the same connected component. For example, taking a pixel as a rectangle, when the predetermined distance is 1 pixel, only pixels whose edges are adjacent and are within a line area can be considered as pixels within the same connected component. When the predetermined distance is 2 pixels, pixels whose corners are adjacent and are within a line area can also be considered as pixels within the same connected component, thus quickly determining pixels located within the same connected component.
[0061] It can be understood that the first image region is part of a circuit diagram. The circuit diagram can be a binary image, where all pixels in the circuit area are 255, and those in non-circuit areas are 0. Therefore, to determine whether a pixel is located in the circuit area, we can determine whether the pixel value is 255. In this way, connected components in the first image region can be accurately identified.
[0062] Then, the processor 20 generates a connected component image based on the identified connected components. Specifically, the processor 20 may extract the image region containing the minimum bounding rectangle of the connected component to serve as the connected component image, thereby facilitating subsequent comparison between the connected component image and the image under test to determine the second image region.
[0063] Please refer to 2. Figure 3 and Figure 9 In some implementations, step 013 includes:
[0064] 0131: Expand the connected component image to generate a third image region;
[0065] 0132: Binarize the image to be tested to generate a binarized image to be tested;
[0066] 0133: Obtain the fourth image region in the binarized image to be tested that corresponds to the third image region;
[0067] 0134: Match the connected component image and the fourth image region to obtain the fifth image region in the fourth image region that matches the connected component image, and use it as the second image region.
[0068] In some embodiments, the acquisition module 13 is further configured to: enlarge the connected component image to generate a third image region; binarize the image to be tested to generate a binarized image to be tested; acquire a fourth image region in the binarized image to be tested that corresponds to the third image region; and match the connected component image and the fourth image region to acquire a fifth image region in the fourth image region that matches the connected component image, which is then used as the second image region. That is, steps 0131, 0132, 0133, and 0134 can be executed by the acquisition module 13.
[0069] In some embodiments, the processor 20 is further configured to: enlarge the connected component image to generate a third image region; binarize the image to be tested to generate a binarized image to be tested; obtain a fourth image region in the binarized image to be tested that corresponds to the third image region; and match the connected component image and the fourth image region to obtain a fifth image region in the fourth image region that matches the connected component image, which is then used as the second image region. That is, steps 0131, 0132, 0133, and 0134 can be executed by the processor 20.
[0070] Specifically, please refer to Figure 10 Taking the image region containing the minimum bounding rectangle N of the connected component M as an example, since the image to be tested and the first image region A1 are aligned after matching, the connected component image has a corresponding image region in the image to be tested. However, since the line regions in the image to be tested may have positional deviations (such as not being able to be perfectly aligned with standard lines), if the image to be tested is directly matched based on the minimum bounding rectangle N of the connected component M, then some of the corresponding lines in the image to be tested may not be within the image region corresponding to the minimum bounding rectangle N. Therefore, please refer to... Figure 11 and Figure 12 The processor 20 first needs to expand the minimum bounding rectangle N. The expansion can be done by using the center of the minimum bounding rectangle N as the expansion center and increasing the bounding rectangle by a predetermined factor, such as 1.1x, 1.2x, or 1.5x. For example, if the minimum bounding rectangle N is 10*10 pixels in size and the predetermined factor is 1.2x, then the expanded bounding rectangle K will be 12*12 pixels. The processor 20 can then use the image area containing the expanded bounding rectangle K as the third image area A3, ensuring that even if there is a deviation in the line, the fourth image area A4 corresponding to the third image area A3 in the image P1 under test can still cover the line.
[0071] The processor 20 can first convert the image to be tested P1 into a binarized image of the same type as the second template, and then obtain the fourth image region A4 in the binarized image to be tested that corresponds to the third image region A3; alternatively, the processor 20 can first obtain the fourth image region A4 in the image to be tested P1 that corresponds to the third image region A3, and then binarize the image to be tested P1 to obtain the binarized image to be tested. This facilitates the subsequent matching of the connected component image and the fourth image region A4.
[0072] In this image, the image to be tested, P1, is a grayscale image. In the grayscale image, the part where the line is located is close to white. Therefore, by setting a preset threshold (such as 100, 150, etc.), the pixels belonging to the line area (such as the pixel value being greater than the preset threshold) and the pixels of the non-line image area (such as the pixel value being less than or equal to the preset threshold) can be determined, thereby converting the image to be tested into a binary image (such as the pixels of the line area being set to 255 and the pixels of the non-line area being set to 0).
[0073] Then, please see Figure 10 and Figure 12 The processor 20 matches the connected component image and the fourth image region A4. Since the size of the fourth image region A4 is larger than that of the connected component image, during matching, multiple fifth image regions A5 within the fourth image region A4, which have the same size as the connected component image, can be obtained first. For details, please refer to... Figure 13a , Figure 13b and Figure 13c The processor 20 can poll the fourth image region A4 according to a polling box of the same size as the connected component image, so that the polling box polls the entire fourth image region A4 line by line, thereby obtaining multiple fifth image regions A5. Then, the processor 20 matches each fifth image region A5 with the connected component image, thereby calculating the matching degree between the fifth image region A5 and the connected component image. For example, by using the difference of pixel values at corresponding positions in the fifth image region A5 and the connected component image, and then using the sum and average of the differences of all pixel values as the matching degree, the processor 20 calculates the matching degree corresponding to each fifth image region A5. The processor 20 selects the fifth image region A5 with the highest matching degree as the second image region A2 that matches the connected component image (as shown in Figure 13C), thereby achieving accurate matching of each connected component image and obtaining the second image region A2 corresponding to each connected component image.
[0074] Please see Figure 2 , Figure 3 and Figure 14 In some implementations, step 014 includes:
[0075] 0141: Obtain the pixels corresponding to the connected components in the second image region to generate a comparison image;
[0076] 0142: Compare the image and the connected component image to generate a difference image;
[0077] 0143: Detect defects in the image under test based on the difference image.
[0078] In some embodiments, the comparison module 14 is further configured to acquire pixels corresponding to connected components in the second image region to generate a comparison image; perform difference analysis between the comparison image and the connected component image to generate a difference image; and detect defects in the image to be tested based on the difference image. That is, steps 0141, 0142, and 0143 can be performed by the comparison module 14.
[0079] In some embodiments, the processor 20 is further configured to: acquire pixels corresponding to connected components in the second image region to generate a comparison image; perform difference between the comparison image and the connected component image to generate a difference image; and detect defects in the image under test based on the difference image. That is, steps 0141, 0142, and 0143 can be executed by the processor 20.
[0080] Specifically, after obtaining the second image region that matches the connected component image, the position of the pixel corresponding to the connected component in the second image region A2 can be determined based on the position of the connected component in the connected component image. Based on this position, a comparison image P3 is generated. For example, the pixel at the position corresponding to the connected component in the second image region A2 can be set to 255, while the pixels at other positions in the second image region A2 can be set to 0 to generate the comparison image P3.
[0081] like Figure 15a and Figure 15b The examples shown are the second image regions A2 and A3, respectively, with and without line loss defects. Figure 16a and Figure 16b They are respectively Figure 15a and Figure 15b The corresponding comparison image P3. The processor performs difference analysis between the comparison image P3 and the corresponding connected component image. Specifically, it obtains the pixel value difference between corresponding positions in the comparison image P3 and the connected component image, and then generates a difference image (e.g., based on the absolute value of the pixel value difference) according to the absolute value of the pixel value difference. Figure 17a and 17b They are respectively Figure 15a and Figure 15b The corresponding difference image P4). The difference image can represent the difference between the comparison image P4 (corresponding to the line region in the image under test) and the connected component image (the corresponding line region in the second template), thereby realizing the detection of each line region in the image under test.
[0082] Please see Figure 17bIn one embodiment, the processor 20 identifies connected components in the difference image. For example, the portion of the difference image containing pixels with a value greater than 0 (e.g., 255) is a connected component, which corresponds to the missing line in the image under test (specifically, a line region). The processor 20 can determine the location and area of the missing line based on the location and area of the connected components. It can be understood that when the area of the connected component is small (e.g., less than a preset area threshold, such as 5, 7, or 10 pixels), this portion may simply be noise, not a missing line, and therefore, the line region can be determined to be defect-free. Conversely, when the area of the connected component is large (e.g., greater than or equal to the preset area threshold), the connected component can be determined to be a defective line region. In this way, the location and area of defects in each line region can be accurately determined, thereby detecting defects in the image under test.
[0083] Please see Figure 18 One or more non-volatile computer-readable storage media 300 containing a computer program 302 according to embodiments of this application enable the processor 20 to perform the calibration method of any of the above embodiments when the computer program 302 is executed by one or more processors 20.
[0084] For example, please combine Figures 1 to 3 When computer program 302 is executed by one or more processors 20, the processors 20 perform the following steps:
[0085] 011: Match the image to be tested with a preset template image to obtain the first image region;
[0086] 012: Identify the connected components of the first image region to generate a connected component image;
[0087] 013: Obtain the second image region in the image to be tested that corresponds to the connected component image;
[0088] 014: Compare the second image region with the connected component image to detect defects in the image under test.
[0089] For example, please combine Figure 2 , Figure 3 and Figure 5 When computer program 302 is executed by one or more processors 20, processor 20 may also perform the following steps:
[0090] 0121: Identify one or more pixels in the first image region with a spacing smaller than a predetermined spacing as the same connected component to generate a connected component image.
[0091] In the description of this specification, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with an embodiment or example that are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0092] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0093] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A method of detection, characterized in that, The method comprises: matching a to-be-tested image and a first template to obtain a target image region, obtaining, based on a mapping relationship between the first template and a second template, an image region corresponding to the target image region in the second template as a first image region; wherein the first template is an image of a minimum repeating unit of a to-be-tested piece, and the second template is a circuit image of the minimum repeating unit; identifying a connected domain of the first image region to generate a connected domain image; enlarging the connected domain image to generate a third image region; binarizing the to-be-tested image to generate a binarized to-be-tested image; obtaining a fourth image region corresponding to the third image region in the binarized to-be-tested image; matching the connected domain image and the fourth image region to obtain a second image region in the fourth image region that matches the connected domain image; comparing the second image region and the connected domain image to detect defects of the to-be-tested image.
2. The detection method according to claim 1, characterized in that, The first template comprises four images of the minimum repeating unit arranged in a 2*2 matrix, and the second template comprises four circuit images arranged in a 2*2 matrix.
3. The detection method according to claim 1, characterized in that, The method further comprises: labeling an outline of a circuit in the first template to generate the second template; or obtaining a preset circuit diagram and generating the second template based on the circuit diagram. The identification of the connected domain of the first image region to generate the connected domain image comprises:
4. The method of claim 1, wherein identifying one or more pixels in the first image region with a distance less than a predetermined distance as the same connected domain to generate the connected domain image. The matching of the connected domain image and the fourth image region to obtain the second image region in the fourth image region that matches the connected domain image comprises:
5. The method of claim 1, wherein, obtaining a plurality of fifth image regions in the fourth image region that have the same size as the connected domain image; matching the fifth image regions and the connected domain image to obtain a matching degree of each of the fifth image regions and the connected domain image; obtaining the fifth image region with the highest matching degree as the fifth image region; and generating the second image region based on the fifth image region. The comparison of the second image region and the connected domain image to detect defects of the to-be-tested image comprises:
6. The method of claim 1, wherein obtaining pixels in the second image region corresponding to the connected domain to generate a comparison image; performing a difference operation on the comparison image and the connected domain image to generate a difference image; and detecting defects of the to-be-tested image based on the difference image. The detection of defects of the to-be-tested image based on the difference image comprises:
7. The detection method according to claim 6, characterized in that, identifying the connected domain in the difference image; determining, based on a position and an area of the connected domain, whether the connected domain image has defects and a position of the defects. The method comprises:
8. A detection device, characterized in that The matching module is configured to match the to-be-tested image and a first template to obtain a target image region, the template image comprising the first template and a second template, the first template being an image of a minimum repeating unit of the to-be-tested piece, and the second template being a circuit image of the minimum repeating unit; and based on a mapping relationship between the first template and the second template, an image region corresponding to the target image region in the second template is obtained as a first image region. The identification module is configured to identify a connected domain of the first image region to generate a connected domain image. The acquisition module is configured to expand the connected domain image to generate a third image region. The to-be-tested image is binarized to generate a binarized to-be-tested image. A fourth image region corresponding to the third image region in the binarized to-be-tested image is obtained. The connected domain image and the fourth image region are matched to obtain a second image region in the fourth image region that matches the connected domain image. The comparison module is configured to compare the second image region and the connected domain image to detect defects of the to-be-tested image. The processor is configured to:
9. A detection device, characterized by match a to-be-tested image and a preset template image to obtain a first image region; identify a connected domain of the first image region to generate a connected domain image; obtain a second image region in the to-be-tested image that corresponds to the connected domain image; and compare the second image region and the connected domain image to detect defects of the to-be-tested image.
10. A nonvolatile computer-readable storage medium storing a computer program, which, when executed by one or more processors, causes the processors to perform the detection method of any one of claims 1 to 7.
Citation Information
Patent Citations
Method for detecting screen printing defects of electronic product shell
CN110533660A
Lighting defect detection method and device, electronic equipment and storage medium
CN111445467A