A defect verification method, apparatus, computer equipment, and readable storage medium
By dividing the image to be verified into pixel regions and summing the pixel values, the problem of missed detection in the existing technology for defect detection is solved, and the detection rate of defective pixels is improved.
Patent Information
- Application Number
- CN202310795102.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-06-30
AI Technical Summary
Existing defect detection methods cannot avoid the problem of missed defect detection after verification due to the lack of defect pixel detection.
By defining pixel regions for defect verification, the presence of defective pixels within a pixel region is determined by summing the pixel values in the first and second images to be verified.
It improved the detection rate of defective pixels and reduced the occurrence of missed detections.
Smart Images

Figure CN119269498B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of detection technology, and in particular to a defect verification method, apparatus, computer equipment, and readable storage medium. Background Technology
[0002] Industrial products inevitably develop defects due to the multiple steps involved in manufacturing, transportation, and storage. Therefore, highly reliable defect detection methods are needed to detect defects in industrial products, determine the approximate location of defects, and enable further precise defect detection.
[0003] Many related technologies improve the reliability of defect detection through a dual-verification defect verification method. This involves obtaining multiple images to be verified by detecting the same image through various defect detection methods, and then performing a pixel-by-pixel AND operation on the multiple images to determine the location of the defective pixel on the image to be verified.
[0004] However, this defect verification method cannot avoid the problem of missing defect points after verification due to the lack of defect pixel detection, which leads to fewer defect points and thus missed defect point detection. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a defect verification method, apparatus, computer equipment, and readable storage medium, which improves the detection rate of defective pixels by performing regional defect verification by defining pixel regions.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] In a first aspect, embodiments of this application disclose a defect verification method, the method comprising:
[0008] A first image to be verified and a second image to be verified are obtained; wherein, the first image to be verified is the detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is the detection result obtained by comparing the image to be detected with a second reference image, and the first image to be verified and the second image to be verified include defective pixels;
[0009] A first region is obtained by dividing the first image to be verified into pixel regions, and a second region is obtained by dividing the second image to be verified into pixel regions of the same size at the same position; wherein, the pixel region is a region centered on the point to be tested;
[0010] The pixel values of the pixels in the first region are summed to obtain a first pixel sum value, and the pixel values of the pixels in the second region are summed to obtain a second pixel sum value;
[0011] The presence of the defective pixel point within the pixel region is determined based on the sum of the first pixel value and the sum of the second pixel value.
[0012] Optionally, determining whether the defective pixel exists within the pixel region based on the sum of the first pixel value and the sum of the second pixel value includes:
[0013] If both the sum of the first pixel value and the sum of the second pixel value are not zero, it is determined that the defective pixel point exists in the pixel region.
[0014] Optionally, the method further includes:
[0015] If neither the sum of the first pixel nor the sum of the second pixel is zero, then by traversing all pixels in the first region and the second region, it is determined whether each pixel is a defective pixel.
[0016] Optionally, determining whether each pixel is a defective pixel includes:
[0017] The pixels with non-zero pixel values in the first region and the pixels with non-zero pixel values in the second region are identified as the defective pixels.
[0018] Optionally, determining whether the defective pixel exists within the pixel region based on the sum of the first pixel value and the sum of the second pixel value includes:
[0019] Determine whether the sum of the first pixel values is zero; if it is not zero, determine that the defective pixel exists in the first region.
[0020] If the value is zero, it is determined that there are no defective pixels in the first region;
[0021] Determine whether the sum of the second pixel values is zero; if it is not zero, determine that the defective pixel exists in the second region.
[0022] If the value is zero, it is determined that there are no defective pixels in the second region.
[0023] Optionally, the method further includes:
[0024] By sliding the pixel region across the first image to be verified and the second image to be verified, defective pixels are determined on the first image to be verified and the second image to be verified.
[0025] Optionally, the pixel region is square, and the step size of the sliding traversal is equal to the side length of the pixel region.
[0026] Secondly, embodiments of this application disclose a defect verification device, the device comprising:
[0027] An image acquisition unit is used to acquire a first image to be verified and a second image to be verified; wherein, the first image to be verified is a detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is a detection result obtained by comparing the image to be detected with a second reference image, and the first image to be verified and the second image to be verified include defective pixels;
[0028] A region division unit is used to divide a pixel region in the first image to be verified to obtain a first region, and to divide a pixel region of the same size at the same position in the second image to be verified to obtain a second region; wherein, the pixel region is a region centered on the point to be tested;
[0029] A pixel summation unit is used to sum the pixel values of the pixels in the first region to obtain a first pixel summation value; and to sum the pixel values of the pixels in the second region to obtain a second pixel summation value;
[0030] The first defect determination unit is used to determine whether the defective pixel exists in the pixel region based on the sum of the first pixel value and the sum of the second pixel value.
[0031] Optionally, the first defect determination unit is further configured to:
[0032] If both the sum of the first pixel value and the sum of the second pixel value are not zero, it is determined that the defective pixel point exists in the pixel region.
[0033] Optionally, the device further includes:
[0034] The second defect determination unit is used to determine whether each pixel in the first region and the second region is a defective pixel if both the sum of the first pixel value and the sum of the second pixel value are not zero.
[0035] Optionally, the second defect determination unit is further configured to:
[0036] The pixels with non-zero pixel values in the first region and the pixels with non-zero pixel values in the second region are identified as the defective pixels.
[0037] Optionally, the first defect determination unit is further configured to:
[0038] Determine whether the sum of the first pixel values is zero; if it is not zero, determine that the defective pixel exists in the first region.
[0039] If the value is zero, it is determined that there are no defective pixels in the first region;
[0040] Determine whether the sum of the second pixel values is zero; if it is not zero, determine that the defective pixel exists in the second region.
[0041] If the value is zero, it is determined that there are no defective pixels in the second region.
[0042] Optionally, the device further includes:
[0043] The third defect determination unit is used to determine defective pixels on the first image to be verified and the second image to be verified by sliding the pixel region across the first image to be verified and the second image to be verified.
[0044] Optionally, the pixel region is square, and the step size of the sliding traversal is equal to the side length of the pixel region.
[0045] Thirdly, embodiments of this application disclose a computer device, which includes a processor and a memory:
[0046] The memory is used to store program code and transmit the program code to the processor;
[0047] The processor is configured to execute the defect verification method as described in the first aspect or any optional implementation thereof, according to instructions in the program code.
[0048] Fourthly, embodiments of this application disclose a computer-readable storage medium for storing a computer program, which, when executed by a processor, performs the defect verification method as described in the first aspect or any optional implementation thereof.
[0049] As can be seen from the above technical solution, the process involves obtaining a first image to be verified and a second image to be verified. The first image to be verified is the detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is the detection result obtained by comparing the image to be detected with a second reference image. Both images include defective pixels. The first image to be verified is divided into pixel regions to obtain a first region, and the second image to be verified is divided into pixel regions of the same size at the same location to obtain a second region. Each pixel region is centered on the point to be tested. The pixel values of the pixels in the first region are summed to obtain a first pixel summation value, and the pixel values of the pixels in the second region are summed to obtain a second pixel summation value. The presence of defective pixels within each pixel region is determined based on the summation value. In other words, by summing the pixel values of the pixels within each region, the presence of defective pixels within the divided pixel region is determined, thereby improving the detection rate of defective pixels and reducing the occurrence of missed detections. Attached Figure Description
[0050] 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 based on these drawings without creative effort.
[0051] Figure 1 A schematic diagram of a defect verification method provided for related technologies;
[0052] Figure 2 A flowchart of a defect verification method provided in an embodiment of this application;
[0053] Figure 3 This is a schematic diagram of a defect verification method provided in an embodiment of this application;
[0054] Figure 4 A schematic diagram of another defect verification method provided in this application embodiment;
[0055] Figure 5 This is a schematic diagram of another defect verification method provided in an embodiment of this application;
[0056] Figure 6 A structural block diagram of a defect verification device provided in an embodiment of this application;
[0057] Figure 7 This is a structural diagram of a computer device for defect verification provided in an embodiment of this application. Detailed Implementation
[0058] The embodiments of this application will now be described with reference to the accompanying drawings.
[0059] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects, and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application.
[0060] To facilitate understanding of the technical solution of this application, some technical terms involved in this application will be introduced below.
[0061] Defect detection is a prerequisite for handling defects in industrial products. Only after the defect location is determined can further operations be carried out on the defect location. Generally, image detection is used to locate defect points on the image, thereby achieving defect detection.
[0062] To improve the reliability of defect detection, related technologies employ defect verification methods. After obtaining multiple images to be verified through various detection methods, the defect points in the images to be verified are then validated against these multiple images, thereby increasing the reliability of the defect points. Among these methods, dual verification of detected images for defect verification has been widely adopted.
[0063] Please see Figure 1 , Figure 1 This diagram illustrates a defect verification method for related technologies, specifically a method for verifying defects in a detected image using a dual verification approach. In the diagram: Image A shows the image to be verified, obtained by detecting the detected image through a reference image; Image B shows the image to be verified, obtained by detecting the detected image through another reference image. In the diagram, 255 represents the pixel value of a defective pixel, and 0 represents the pixel value of a non-defective pixel. The "+" and "=" symbols indicate that the related technology performs dual verification on each pixel in the image by performing a pixel-by-pixel AND operation between the defective image A and the defective image B to identify defective pixels.
[0064] If we expand the coordinate system with the bottom left corner as the origin (0,0), then the pixel value of pixel (1,1) in image A to be verified is 255, and the pixel value of pixel (1,1) in image B to be verified is also 255. Only then can pixel (1,1) be identified as a defective pixel. However, the value of pixel (0,3) in image A to be verified is 255, while the value of pixel (0,3) in image B to be verified is 0. In this case, by using the AND operation, we determine that the pixel value of this pixel is 0, thus identifying pixel (0,3) as a non-defective pixel. This leads to a possible defective pixel being mistakenly verified as a non-defective pixel, resulting in a missed detection problem.
[0065] To address the aforementioned technical problems, this application provides a defect detection method. By setting a fixed-size pixel region, the pixel values within the same pixel region of different images to be verified are summed to obtain multiple pixel sum values. Then, based on the multiple pixel sum values obtained from different images to be verified, it is determined whether there are defective pixels within the defined pixel region, thereby determining the position of the defective pixels on the image to be verified, thus improving the detection rate of defective pixels and reducing the occurrence of missed detections.
[0066] Next, with reference to the accompanying drawings, a defect detection method provided by an embodiment of this application will be described. In the embodiments of this application, the defective pixel can exist in the form of any pixel value that is different from the non-defective pixel, or it can appear in the form of a multi-channel image.
[0067] Please see Figure 2 , Figure 2 A flowchart of a defect detection method provided in this application embodiment, the method including:
[0068] S201: Obtain the first image to be verified and the second image to be verified.
[0069] The first image to be verified and the second image to be verified are images containing defective pixels obtained through one or more methods. For example, the first image to be verified is obtained by comparing the first reference image with the image to be detected, or by performing defect detection on the image to be detected using a machine learning-based image detection method; the second image to be verified is obtained by comparing the second reference image with the image to be detected, or by performing defect detection on the image to be detected using a deep learning-based image detection method.
[0070] In some implementations of the embodiments of this application, the images to be verified can be two, three or more. In some high-precision industrial product image inspections, due to the need for extremely high accuracy, product defects are generally detected by multiple methods or by comparing the image to be detected with multiple reference images to obtain multiple images to be verified. In this case, it is necessary to verify defects in three or more images to be verified in order to ensure the product pass rate.
[0071] In this embodiment, the defect pixel is the pixel on the generated image where the defect of the detected object is located. Generally, the center of the defect of the detected object is relatively obvious on the image, and the defect pixel corresponding to the center of the defect can be detected by various defect detection methods; however, the edge of the defect of the detected object is not obvious on the image, and the detection results may be different when different defect detection methods are used to detect the defect edge. In the verification image obtained after detection, pixels detected as defects are mostly represented by non-zero values, and pixels detected as non-defects are mostly represented by zero values. For ease of description, this application will use a single-channel image as the image reference, and take a defect pixel value of 255 and a non-defect pixel value of 0 as an example to introduce the method provided in this application.
[0072] S202: Divide the first image to be verified into a pixel region to obtain a first region, and divide the second image to be verified into a pixel region of the same size at the same position to obtain a second region.
[0073] The pixel region is the area centered on the point to be tested. The size of the preset pixel region is generally based on the size of the pixel region occupied by a common defect in the image to be verified. For example, in a typical defect detection scenario, the size of a defect in the image to be verified is generally 3 to 5 pixels, that is, the length and width of the defect in the image to be verified are mostly 3 to 5 pixels. Therefore, the size of the preset pixel region is mostly 3×3 or 5×5.
[0074] Please see Figure 3 , Figure 3 This is a schematic diagram of a defect verification method provided in an embodiment of this application, wherein... Figure 3 A is the first image to be verified. Figure 3 B is the second image to be verified. Figure 3 C represents the defect verification image obtained after the judgment is completed. Figure 3 In diagram A, the bold black border represents a pixel region, where the size of the pixel region is 3×3. The center of the region is located at the image edge. At this point, this pixel region has only 6 pixels on the image. Figure 3 B also uses the same pixel region to divide the same position. Figure 3 The area inside the black box in A is the first region. Figure 3 The black-framed area in B is the second region. In some implementations of this embodiment, a padding operation can be used, that is, to fill the missing pixels in the first and second regions with 0s to make up the missing pixels in the pixel region, so as to facilitate the automatic summation calculation of pixel values in subsequent steps.
[0075] Please refer to the previous document. Figure 2S203: Summing the pixel values of the pixels in the first region to obtain a first pixel summation value, and summing the pixel values of the pixels in the second region to obtain a second pixel summation value.
[0076] In some implementations of this embodiment, please refer to Figure 3 , Figure 3 The pixel values of each pixel in the first region of A are (0, 0, 255, 255, 0, 255) from left to right and top to bottom. Figure 3 The pixel values of each pixel in the second region of B are (0,0,255,0,0,255) from left to right and top to bottom. After calculation, the first pixel summation value and the second pixel summation value are 765 and 510, respectively.
[0077] Please refer to the previous document. Figure 2 S204: Determine whether the defective pixel exists within the pixel region based on the sum of the first pixel value and the sum of the second pixel value.
[0078] Corresponding to the specific description of summation in step S203, as a possible implementation, determining whether there are defective pixels within the pixel region based on the summation value of the first pixel and the summation value of the second pixel includes:
[0079] If the sum of the first pixel and the sum of the second pixel are both non-zero, it is determined that there are defective pixels in the pixel region.
[0080] Still with Figure 3 For example, as shown: In Figure 3 The sum of the first pixels in the black-framed area of A, i.e., the first region of the first image to be verified, is 765; Figure 3 The black-framed area of B, i.e., the sum of the second pixel of the second image to be verified, is 510; that is to say, the sum of the first pixel and the sum of the second pixel are not zero. Therefore, it can be determined that there are defective pixels in this pixel area.
[0081] By verifying the sum of the first and second pixels, it is possible to determine whether there are defective pixels within the pixel region. When the reference image has a different focus and the detection result obtained by comparing the image to be detected with the reference image misclassifies some pixels as defective pixels, the pixels in the first and second regions are cross-validated by judging the sum of the pixels to further determine whether the pixels in the pixel region are defective pixels, thereby improving the accuracy of defect verification.
[0082] To further pinpoint the exact location of the defective pixel on the image to be verified, based on the above embodiments, the method further includes:
[0083] If the sum of the first pixel and the sum of the second pixel are both non-zero, then by traversing all pixels in the first and second regions, we can determine whether each pixel is a defective pixel.
[0084] In some possible implementations of this embodiment, the point to be tested can be verified first, and then the points surrounding the point to be tested can be verified. Please refer to [link / reference]. Figure 4 , Figure 4 This is a schematic diagram of another defect verification method provided in an embodiment of this application. Figure 4 The center point of the pixel region within the top 9 pixels shown is the point to be measured.
[0085] by Figure 4 For example, in this implementation method, Figure 4 The pixel value of the point to be measured in A is 255, while Figure 4 The pixel value of the test point B is zero, therefore this test point is identified as a defective pixel. At this point, defect verification is then performed on the other pixels in the first and second regions.
[0086] Since defects typically appear not as individual pixels, but rather as a block of defective pixels, occupying several adjacent pixels in the image to be verified, the probability that neighboring pixels are also defective pixels is greatly increased when a defective pixel is detected. Therefore, by first verifying the point to be tested, and then verifying whether other pixels in the same pixel region as the point to be tested are defective pixels, the focus is placed on the neighboring pixels of the detected defective pixels, thus improving defect verification efficiency.
[0087] To reduce false detections of defective pixels, based on the above embodiments, the step of determining whether each pixel is a defective pixel further includes:
[0088] Pixels with non-zero values in the first region and pixels with non-zero values in the second region are identified as defective pixels.
[0089] Still with Figure 3 For example, after determining that there are defective pixels in the first or second region, the pixel value of each pixel in the first and second regions is verified. Pixels with a value of zero are identified as non-defective pixels, and pixels with a non-zero value are identified as defective pixels. This is then combined to form a sequence as shown in the diagram. Figure 3 The image shown in C.
[0090] In some possible implementations of this embodiment, after determining that the sum of the first and second pixels is not zero, a pixel-by-pixel OR operation can be performed directly on the first and second regions to determine the actual location of the defective pixel. For example, in Figure 3 In A, the pixel value of the top-left pixel is zero; similarly, in Figure 3 In B, the pixel value of the top-left pixel is also zero. Therefore, after performing an OR operation on this pixel, its calculated pixel value is zero, and thus it is considered a non-defective pixel. However, in [the following context, the original text is incomplete and requires further information]. Figure 3 In A, the pixel value of the top right corner pixel is zero, but Figure 3 In B, the pixel value of the top-right corner pixel is 255. Therefore, after performing an OR operation on this pixel, its calculated pixel value is 255, and thus this pixel is identified as a defective pixel. This implementation method is simple and easy to implement, facilitating the setting of computer programs to execute the defect verification process.
[0091] To reduce false positives and improve defect verification efficiency while minimizing false negatives, in some other implementations of this application, the pixel values of each pixel in the first region and the second region are summed, the summation value is determined, and then each pixel within the region is judged to be a defective pixel. Specifically, this includes steps S2041-S2044. For ease of description, these steps are also referred to as... Figure 3 The defect verification method shown is used as an example for illustration.
[0092] S2041: Determine if the sum of the values of the first pixels is zero; if it is not zero, determine if there are defective pixels in the first region.
[0093] As can be seen from the preceding steps, the sum of the values of the first pixels is not zero, indicating the presence of defective pixels in the first region. Since it is already known that defective pixels exist in the first region, it is unnecessary to determine whether defective pixels exist in the second region; it can be directly determined that defective pixels exist in the pixel region of the image to be verified.
[0094] S2042: If it is zero, it is determined that there are no defective pixels in the first region.
[0095] The summation value is zero, which means that the pixel value of all pixels in the first region is zero, that is, there are no defective pixels in the first region.
[0096] S2043: Determine if the sum of the values of the second pixels is zero; if it is not zero, determine if there are defective pixels in the second region.
[0097] If the sum of the first pixel values is 0, it is determined that there are no defective pixels in the first region. In this case, it is necessary to determine whether there are defective pixels in the second region. The method for summing the pixel values of the pixels in the second region and performing defective pixel judgment is the same as the method performed in the first region. For the same method, please refer to the description of the corresponding calculation method for the first region above, which will not be repeated here.
[0098] S2044: If it is zero, it means that there are no defective pixels in the second region.
[0099] When the sum of the first pixel and the sum of the second pixel are both 0, it is determined that there are no defective pixels in either the first or second region, meaning that there are no defective pixels in that pixel region of the image to be verified.
[0100] By first determining whether there are defective pixels in the first image to be verified, and if so, then the image to be verified is considered to have defective pixels in that pixel region; if not, then the same pixel region in the second image to be verified and even more images to be verified is determined to have defective pixels, thereby reducing the computing power required for defect verification of the same pixel region and improving the efficiency of defect verification.
[0101] To improve the image accuracy of the image to be verified and further enhance the accuracy of subsequent defect verification, based on the above embodiments, after acquiring the first image to be verified and the second image to be verified, the method further includes:
[0102] Image preprocessing is performed on the first and second images to be verified.
[0103] In some possible implementations, conventional image preprocessing methods can be used to preprocess the image to be verified, such as image sharpening or brightness transformation, to improve the prominence of image features. This helps defective pixels to have better feature representation compared to non-defective pixels, thereby improving the accuracy of defect verification.
[0104] In other possible implementations, image cropping can reduce the number of defective pixels in each image, thereby reducing the computational load of a single defect verification calculation. Parallel computation can be performed on multiple images using processors capable of parallel computing, such as Central Processing Units (CPUs), Graphics Processing Units (GPUs), or Tensor Processing Units (TPUs). Finally, the obtained defect feature images are stitched together according to the corresponding cropping positions, thus fully utilizing the parallel processing of the defect verification algorithm by the processor, reducing inference time, and improving algorithm execution efficiency.
[0105] To facilitate the operation of the defect verification method and automate defect verification, based on the above embodiments, the method further includes:
[0106] Defective pixels are identified by sliding the pixel region across the first and second images to be verified.
[0107] Please see Figure 4 , Figure 4 This is a schematic diagram of another defect verification method provided in an embodiment of this application. Figure 4 Figures A, B, and C in the middle Figure 3 The three diagrams A, B, and C are the same, so they will not be described again here.
[0108] In this embodiment, Figure 4 In diagram A, the fixed-size pixel region represented by the black box slides across the first image to be verified, as shown below. Figure 4 In step A, the pixel region sliding causes the first region to slide one pixel to the right, i.e., the sliding step size is step=1. This allows for the extraction of all information from the entire first image to be verified through a preset, fixed-size pixel region. Figure 4 The same operation is performed on the second image to be verified of B, and then the pixels in the first and second images to be verified are automatically verified by the aforementioned defect verification method; thereby generating a defect verification image with a high detection rate and a low false detection rate.
[0109] To improve defect verification efficiency, reduce defect verification time, and save computation, based on the above embodiments, the pixel region is further defined as a square, and the step size of the traversal is equal to the side length of the pixel region.
[0110] Please see Figure 5 , Figure 5 This is a schematic diagram of another defect verification method provided in an embodiment of this application. Figure 5 Figures A, B, and C in the middle Figure 3 The three diagrams A, B, and C are the same, so they will not be described again here.
[0111] exist Figure 5 A and Figure 5 In section B, the fixed-size pixel region represented by the black box slides across the first and second images to be verified. The specific operation method is similar to... Figure 4 The defect verification method shown is similar. The difference is that in this embodiment, the sliding step size is the same as the side length of the pixel region. For example, in Figure 5 A and Figure 5 In B, the side length of the pixel region is 3, and the sliding step size is also 3; if the side length of the pixel region is 5, the sliding step size can also be set to 5. Compared to Figure 4 The sliding step size is 1 pixel. Figure 4 The calculation method shown is in Figure 4 The same row in images A and B requires 6 calculations to capture all the image features of that row; while Figure 5 The calculation method shown is in Figure 5 In the images shown in A and B, all image features of the same row can be captured with only two calculations, enabling defect verification of all pixels in that row. This significantly reduces the computational load and time required for defect verification, thereby improving its efficiency.
[0112] Please see Figure 6 , Figure 6 A structural block diagram of a defect verification device provided in this application, the device comprising:
[0113] The image acquisition unit 610 is used to acquire a first image to be verified and a second image to be verified; wherein, the first image to be verified is a detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is a detection result obtained by comparing the image to be detected with a second reference image, and the first image to be verified and the second image to be verified include defective pixels.
[0114] The region division unit 620 is used to divide a pixel region in the first image to be verified to obtain a first region, and to divide a pixel region of the same size at the same position in the second image to be verified to obtain a second region; wherein, the pixel region is a region centered on the point to be tested;
[0115] The pixel summation unit 630 is used to sum the pixel values of the pixels in the first region to obtain a first pixel summation value; and to sum the pixel values of the pixels in the second region to obtain a second pixel summation value;
[0116] The first defect determination unit 640 is used to determine whether there is a defective pixel in the pixel region based on the sum of the first pixel value and the sum of the second pixel value.
[0117] As one possible implementation, the first defect determination unit is further configured to:
[0118] If both the sum of the first pixel value and the sum of the second pixel value are not zero, it is determined that the defective pixel point exists in the pixel region.
[0119] As one possible implementation, the device further includes:
[0120] The second defect determination unit is used to determine whether each pixel in the first region and the second region is a defective pixel if both the sum of the first pixel value and the sum of the second pixel value are not zero.
[0121] As one possible implementation, the second defect determining unit is further configured to:
[0122] The pixels with non-zero pixel values in the first region and the pixels with non-zero pixel values in the second region are identified as the defective pixels.
[0123] As one possible implementation, the first defect determination unit is further configured to:
[0124] Determine whether the sum of the first pixel values is zero; if it is not zero, determine that the defective pixel exists in the first region.
[0125] If the value is zero, it is determined that there are no defective pixels in the first region;
[0126] Determine whether the sum of the second pixel values is zero; if it is not zero, determine that the defective pixel exists in the second region.
[0127] If the value is zero, it is determined that there are no defective pixels in the second region.
[0128] As one possible implementation, the device further includes:
[0129] The third defect determination unit is used to determine defective pixels on the first image to be verified and the second image to be verified by sliding the pixel region across the first image to be verified and the second image to be verified.
[0130] As one possible implementation, the pixel region is square, and the step size of the sliding traversal is equal to the side length of the pixel region.
[0131] As can be seen from the above technical solution, the process involves obtaining a first image to be verified and a second image to be verified. The first image to be verified is the detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is the detection result obtained by comparing the image to be detected with a second reference image. Both images include defective pixels. A first region is obtained by dividing the first image to be verified into pixel regions, and a second region is obtained by dividing pixel regions of the same size at the same location in the second image to be verified. Each pixel region is centered on the point to be tested. The pixel values of the pixels in the first region are summed to obtain a first pixel summation value, and the pixel values of the pixels in the second region are summed to obtain a second pixel summation value. The presence of defective pixels within each pixel region is determined based on the first and second pixel summation values. In other words, by summing the pixel values of the pixels within each region, the presence of defective pixels within the divided pixel regions is determined, thereby improving the detection rate of defective pixels.
[0132] Please see Figure 7 , Figure 7 A structural diagram of a defect verification computer device provided in an embodiment of this application. The computer device may include a processor 710 and a memory 720.
[0133] The memory 720 is used to store program code and transmit the program code to the processor;
[0134] The processor 710 is used to execute any of the defect verification methods provided in the above embodiments according to the instructions in the program code.
[0135] This application also provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, is used to perform any of the defect verification methods provided in the above embodiments.
[0136] Understandably, this method can be applied to processing devices capable of motion control, such as terminal devices or servers with motion control functions. This method can be executed independently by a terminal device or server, or it can be applied in network scenarios where a terminal device and a server communicate, executing in cooperation. The terminal device can be a computer, mobile phone, or similar device. The server can be an application server or a web server; in actual deployment, this server can be a standalone server or a cluster server.
[0137] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk or optical disk, and other media capable of storing program code.
[0138] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0139] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A defect verification method, characterized in that, The method includes: A first image to be verified and a second image to be verified are obtained; wherein, the first image to be verified is the detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is the detection result obtained by comparing the image to be detected with a second reference image, and the first image to be verified and the second image to be verified include defective pixels; A first region is obtained by dividing the first image to be verified into pixel regions, and a second region is obtained by dividing the second image to be verified into pixel regions of the same size at the same position; wherein, the pixel region is a region centered on the point to be tested; The pixel values of the pixels in the first region are summed to obtain a first pixel sum value, and the pixel values of the pixels in the second region are summed to obtain a second pixel sum value; The presence of the defective pixel point within the pixel region is determined based on the sum of the first pixel value and the sum of the second pixel value.
2. The method according to claim 1, characterized in that, The step of determining whether the defective pixel exists within the pixel region based on the sum of the first pixel value and the sum of the second pixel value includes: If both the sum of the first pixel value and the sum of the second pixel value are not zero, it is determined that the defective pixel point exists in the pixel region.
3. The method according to claim 2, characterized in that, The method further includes: If neither the sum of the first pixel nor the sum of the second pixel is zero, then by traversing all pixels in the first region and the second region, it is determined whether each pixel is a defective pixel.
4. The method according to claim 3, characterized in that, The step of determining whether each pixel is a defective pixel includes: The pixels with non-zero pixel values in the first region and the pixels with non-zero pixel values in the second region are identified as the defective pixels.
5. The method according to claim 1, characterized in that, The step of determining whether the defective pixel exists within the pixel region based on the sum of the first pixel value and the sum of the second pixel value includes: Determine whether the sum of the first pixel values is zero; if it is not zero, determine that the defective pixel exists in the first region. If the value is zero, it is determined that there are no defective pixels in the first region; Determine whether the sum of the second pixel values is zero; if it is not zero, determine that the defective pixel exists in the second region. If the value is zero, it is determined that there are no defective pixels in the second region.
6. The method according to claim 1, characterized in that, The method further includes: By sliding the pixel region across the first image to be verified and the second image to be verified, defective pixels are determined on the first image to be verified and the second image to be verified.
7. The method according to claim 6, characterized in that, The pixel region is square, and the step size of the sliding traversal is equal to the side length of the pixel region.
8. A defect verification device, characterized in that, The device includes: An image acquisition unit is used to acquire a first image to be verified and a second image to be verified; wherein, the first image to be verified is a detection result obtained by comparing the image to be detected with a first reference image, and the second image to be verified is a detection result obtained by comparing the image to be detected with a second reference image, and the first image to be verified and the second image to be verified include defective pixels; A region division unit is used to divide a pixel region in the first image to be verified to obtain a first region, and to divide a pixel region of the same size at the same position in the second image to be verified to obtain a second region; wherein, the pixel region is a region centered on the point to be tested; A pixel summation unit is used to sum the pixel values of the pixels in the first region to obtain a first pixel summation value; and to sum the pixel values of the pixels in the second region to obtain a second pixel summation value; The first defect determination unit is used to determine whether the defective pixel exists in the pixel region based on the sum of the first pixel value and the sum of the second pixel value.
9. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the defect verification method according to any one of claims 1-7 according to the instructions in the program code.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, which, when executed by a processor, is used to perform the defect verification method according to any one of claims 1-7.
Citation Information
Patent Citations
Image processing method, device and equipment
CN111667448A
Detection result determination method, device and system
CN112184701A