Defect verification method and device, computer equipment and readable storage medium
By demarcating the pixel area in defect detection and calculating the pixel value sum, we can judge whether there are defective pixel points in the region, and solve the problem of defect point miss detection in the prior art, and improve the accuracy and credibility of defect detection.
Patent Information
- Application Number
- CN202310795102.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2043-06-30
AI Technical Summary
The existing defect detection methods cannot avoid the problem of defect point miss detection caused by the lack of defect pixel point detection, which causes the problem of defect point miss detection.
By demarcating the pixel areas for area defect verification, the first image to be verified and the second image to be verified are obtained, the image to be detected and the reference image respectively, the pixel areas of the same size are divided, the pixel values of the pixel points are summed, and the pixel values of the pixels are calculated, and the judgment is made Whether there are defective pixels in the area.
The detection rate of defective pixel points is improved, the occurrence of missed detection is reduced, and the credibility of defect detection is enhanced.
Smart Images

Figure CN119269498A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of detection technology, and in particular to a defect verification method, apparatus, computer equipment and readable storage medium. Background Art
[0002] Since industrial products need to go through multiple steps such as manufacturing, transportation or storage, defects are inevitable. Therefore, a high-reliability defect detection method is needed to detect defects in industrial products in order to determine the approximate location of the defect points on the industrial products in order to achieve further accurate detection of the defect points.
[0003] Related technologies often improve the credibility of defect detection through a double-verification defect verification method, that is, obtaining multiple images to be verified by detecting the same image to be detected through multiple defect detection methods, and then performing a pixel-by-pixel "AND" operation on the multiple images to be verified, so as 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 missed defect detection caused by the lack of defect pixel detection, which results in fewer defect points after verification. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a defect verification method, apparatus, computer equipment and readable storage medium, which improves the detection rate of defective pixels by demarcating pixel areas for regional defect verification.
[0006] The embodiments of the present application disclose the following technical solutions:
[0007] In a first aspect, an embodiment of the present application discloses a defect verification method, the method comprising:
[0008] Obtaining 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, 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;
[0009] Divide the first image to be verified into pixel areas to obtain a first area, and divide the second image to be verified into pixel areas of the same size at the same position to obtain a second area; wherein the pixel area is an area centered on the point to be tested;
[0010] Summing the pixel values of the pixels in the first area to obtain a first pixel sum value, and summing the pixel values of the pixels in the second area to obtain a second pixel sum value;
[0011] It is determined whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value.
[0012] Optionally, judging whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value includes:
[0013] If both the first pixel sum value and the second pixel sum value are not zero, it is determined that the defective pixel point exists in the pixel area.
[0014] Optionally, the method further includes:
[0015] If both the first pixel sum value and the second pixel sum value are not zero, all pixel points in the first area and the second area are traversed to determine whether they are defective pixels one by one.
[0016] Optionally, the step of determining whether each pixel is a defective pixel includes:
[0017] Pixels with non-zero pixel values in the first area and pixels with non-zero pixel values in the second area are determined as defective pixels.
[0018] Optionally, judging whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value includes:
[0019] Determine whether the first pixel sum value is zero; if not zero, determine that the defective pixel exists in the first area;
[0020] If it is zero, it is determined that the defective pixel does not exist in the first area;
[0021] Determine whether the second pixel sum value is zero; if not zero, determine that the defective pixel exists in the second area;
[0022] If it is zero, it is determined that the defective pixel does not exist in the second area.
[0023] Optionally, the method further includes:
[0024] Defective pixel points are determined on the first image to be verified and the second image to be verified by sliding the pixel area on the first image to be verified and the second image to be verified.
[0025] Optionally, the pixel area is a square, and the step length of the sliding traversal is equal to the side length of the pixel area.
[0026] In a second aspect, an embodiment of the present application discloses a defect verification device, the device comprising:
[0027] An image acquisition unit, configured 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, used for dividing the first image to be verified into pixel regions to obtain a first region, and dividing the pixel regions of the same size at the same position of 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 summing unit, configured to sum the pixel values of the pixels in the first area to obtain a first pixel sum value; and sum the pixel values of the pixels in the second area to obtain a second pixel sum value;
[0030] The first defect determination unit is configured to determine whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value.
[0031] Optionally, the first defect determination unit is further configured to:
[0032] If both the first pixel sum value and the second pixel sum value are not zero, it is determined that the defective pixel point exists in the pixel area.
[0033] Optionally, the device further comprises:
[0034] A second defect determination unit is configured to determine whether all pixels in the first area and the second area are defective pixels one by one by traversing all pixels in the first area and the second area if both the first pixel sum value and the second pixel sum value are not zero.
[0035] Optionally, the second defect determination unit is further used to:
[0036] Pixels with non-zero pixel values in the first area and pixels with non-zero pixel values in the second area are determined as defective pixels.
[0037] Optionally, the first defect determination unit is further configured to:
[0038] Determine whether the first pixel sum value is zero; if not zero, determine that the defective pixel exists in the first area;
[0039] If it is zero, it is determined that the defective pixel does not exist in the first area;
[0040] Determine whether the second pixel sum value is zero; if not zero, determine that the defective pixel exists in the second area;
[0041] If it is zero, it is determined that the defective pixel does not exist in the second area.
[0042] Optionally, the device further comprises:
[0043] The third defect determination unit is configured to slide and traverse the first image to be verified and the second image to be verified through the pixel area to determine defective pixel points on the first image to be verified and the second image to be verified.
[0044] Optionally, the pixel area is a square, and the step length of the sliding traversal is equal to the side length of the pixel area.
[0045] In a third aspect, an embodiment of the present application discloses a computer device, wherein the computer device 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 used to execute the defect verification method as described in the first aspect or any optional implementation manner of the first aspect according to the instructions in the program code.
[0048] In a fourth aspect, an embodiment of the present application discloses a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it is used to execute the defect verification method described in the first aspect or any optional implementation of the first aspect.
[0049] It can be seen from the above technical scheme that by obtaining the first image to be verified and the second image to be verified; wherein the first image to be verified is the detection result obtained by comparing the image to be detected with the first reference image, and the second image to be verified is the detection result obtained by comparing the image to be detected with the second reference image, and the first image to be verified and the second image to be verified include defective pixels; the first image to be verified is divided into pixel areas to obtain the first area, and the pixel areas of the same size are divided at the same position of the second image to be verified to obtain the second area; wherein the pixel area is an area centered on the point to be tested; the pixel values of the pixels in the first area are summed to obtain the first pixel summation value, and the pixel values of the pixels in the second area are summed to obtain the second pixel summation value; according to the first pixel summation value and the second pixel summation value, it is judged whether there are defective pixels in the pixel area. That is, by summing the pixel values of the pixels in the area, and then judging whether there are defective pixels in the divided pixel area according to the summation value, it is determined whether there are defective pixels in the divided pixel area, so as to improve the detection rate of defective pixels and reduce the occurrence of missed detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 A schematic diagram of a defect verification method provided for related technologies;
[0052] Figure 2 A flow chart of a defect verification method provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of a defect verification method provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of another defect verification method provided in an embodiment of the present application;
[0055] Figure 5 A schematic diagram of another defect verification method provided in an embodiment of the present application;
[0056] Figure 6 A structural block diagram of a defect verification device provided in an embodiment of the present application;
[0057] Figure 7 A structural diagram of a computer device for defect verification provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The embodiments of the present application are described below in conjunction with the accompanying drawings.
[0059] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is merely a way of distinguishing objects with the same attributes when describing them in the embodiments of this application.
[0060] In order to facilitate understanding of the technical solution of the present application, some technical terms involved in the present application are introduced below.
[0061] Defect detection is a prerequisite for industrial product defect processing. Only after the defect location is determined can further operations be performed on the defect location. Generally, image detection is used to locate the defect points on the image to achieve defect detection.
[0062] In order to improve the credibility of defect detection, related technologies use defect verification methods to detect images through multiple detection methods to obtain multiple images to be verified, and then verify the defect points in the images to be verified by verifying the multiple images to be verified, thereby improving the credibility of the defect points. Among them, defect verification of detection images through double verification methods has been widely used.
[0063] See also Figure 1 , Figure 1 A schematic diagram of a defect verification method provided for related technologies, that is, a schematic diagram of a method for defect verification of a detection image by a double verification method. Wherein: Figure A is the image to be verified obtained by detecting the detection image through a certain reference image, and Figure B is the image to be verified obtained by detecting the detection image through another reference image. In the figure, 255 is the pixel value of the defective pixel point, and 0 is the pixel value of the non-defective pixel point; the "+" and "=" on the figure indicate that the related technology double-verifies each pixel on the image by performing a pixel-by-pixel "AND" method on the defective image A and the defective image B to determine the defective pixel point.
[0064] If the coordinate system is expanded with the lower left corner as the origin (0,0), the pixel value of the pixel point (1,1) in the image A to be verified is 255, and the pixel value of the pixel point (1,1) in the image B to be verified is 255. Only then can the point (1,1) be identified as a defective pixel; while the value of the pixel point (0,3) in the image A to be verified is 255, and the value of the pixel point (0,3) in the image B to be verified is 0. At this time, the pixel value of the pixel is determined to be 0 through the "AND" operation, and the point (0,3) is identified as a non-defective point, resulting in possible defective pixels being mistakenly verified as non-defective pixels, which leads to the problem of missed detection.
[0065] In order to solve the above technical problems, the present application provides a defect detection method, which sets a pixel area of a fixed size, sums the pixel values in the same pixel area of different images to be verified to obtain multiple pixel sum values, and then determines whether there are defective pixel points in the delineated pixel area based on the multiple pixel sum values obtained from different images to be verified, so as to determine the position of the defective pixel point on the image to be verified, thereby improving the point detection rate of defective pixels and reducing the occurrence of missed detection.
[0066] Next, a defect detection method provided by an embodiment of the present application will be introduced in conjunction with the accompanying drawings. In the embodiment of the present application, the defective pixel point can exist in the form of any pixel value that is different from the non-defective pixel point, or can appear in the form of a multi-channel image.
[0067] See also Figure 2 , Figure 2 A flowchart of a defect detection method provided in an embodiment of the present application, the method comprising:
[0068] S201: Obtain a first image to be verified and a 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 by 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 performing defect detection on the image to be detected by a machine learning image detection method; the second image to be verified is obtained by comparing the second reference image with the image to be detected, or performing defect detection on the image to be detected by a deep learning image detection method.
[0070] In some implementations of the embodiments of the present application, the number of images to be verified may be two, or three or more. In some high-precision industrial product image inspections, due to the requirement for extremely high completion accuracy, product defects are generally detected through a variety of methods or by comparing the image to be inspected with multiple reference images to obtain multiple images to be verified. In this case, defect verification needs to be performed on three or more images to be verified to ensure the product qualification rate.
[0071] In the embodiment of the present application, the defective pixel is the pixel where the defect of the detected object is located on the generated image. Generally speaking, the center of the defect of the detected object is relatively obvious on the image, and the defective pixel corresponding to the center of the defect can be detected by a variety of defect detection methods; while the defective edge 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 defective edge. In the image to be verified obtained after the detection, the pixels detected as defective points are mostly represented by non-zero values, and the pixels detected as non-defective points are mostly represented by zero values. For the convenience of description, this application will take a single-channel image as the image reference, and take the defective point pixels as 255 and the non-defective point pixels as 0 as an example to introduce the method provided in this application.
[0072] S202: Divide the first image to be verified into pixel regions to obtain a first region, and divide the second image to be verified into pixel regions of the same size at the same position to obtain a second region.
[0073] Among them, the pixel area is the area centered on the point to be tested. The size of the preset pixel area is generally based on the size of the pixel area occupied by the conventional defect in the image to be verified. For example: in a general defect detection scenario, the size of the 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, so the size of the preset pixel area is also mostly 3×3 or 5×5.
[0074] See also Figure 3 , Figure 3 A schematic diagram of a defect verification method provided in an embodiment of the present 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 is the defect verification image obtained after the judgment is completed. Figure 3 In A, the bold black box represents the pixel area, where the size of the pixel area is 3×3, and the center of the divided area is located at the edge of the image. At this time, the pixel area has only 6 pixels in the figure. Figure 3 The same pixel area is also used to divide the same position in B. Figure 3 The area inside the black frame in A is the first area. Figure 3 The black frame area in B is the second area. In some implementations of this embodiment, a padding operation may be used, that is, the missing pixels in the first area and the second area are filled with 0 to make up for the missing pixels in the pixel area, so as to facilitate the automatic summation calculation of pixel values in subsequent steps.
[0075] Please review Figure 2, S203: summing up the pixel values of the pixel points in the first area to obtain a first pixel sum value, and summing up the pixel values of the pixel points in the second area to obtain a second pixel sum value.
[0076] In some implementations of this embodiment, please refer to Figure 3 , Figure 3 The pixel values of each pixel in the first area of A from left to right and from top to bottom are (0,0,255,255,0,255). Figure 3 The pixel values of each pixel point in the second area of B from left to right and from top to bottom are (0, 0, 255, 0, 0, 255). After the pixel values of the corresponding pixel points are calculated, the first pixel sum value and the second pixel sum value obtained are 765 and 510 respectively.
[0077] Please review Figure 2 , S204: Determine whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value.
[0078] Corresponding to the specific description of summing in step S203, as a possible implementation, judging whether there is a defective pixel point in the pixel area according to the first pixel summation value and the second pixel summation value includes:
[0079] If both the first pixel sum value and the second pixel sum value are not zero, it is determined that there is a defective pixel in the pixel area.
[0080] Still Figure 3 As an example: Figure 3 In the black frame area of A, that is, in the first area of the first image to be verified, the obtained first pixel sum value is 765; Figure 3 The black frame area of B, that is, the second pixel sum value of the second image to be verified is 510; that is, the first pixel sum value and the second pixel sum value are not zero, so it can be determined that there is a defective pixel point in the pixel area.
[0081] By verifying the first pixel sum value and the second pixel sum value, it is judged whether there are defective pixels in the pixel area. When the reference image focuses on different directions and the detection result obtained by comparing the image to be detected with the reference image misjudges some pixels as defective pixels, the pixels in the first area and the second area are cross-validated through the judgment of the pixel sum value to further determine whether the pixels in the pixel area are defective pixels, thereby improving the accuracy of defect verification.
[0082] In order to further accurately determine the specific position of the defective pixel on the image to be verified based on the position of the defective pixel, based on the above embodiment, the method further includes:
[0083] If both the first pixel sum value and the second pixel sum value are not zero, all the pixels in the first area and the second area are traversed to determine whether they are defective pixels one by one.
[0084] In some possible implementations of this embodiment, the point to be tested may be verified first, and then the points around the point to be tested may be verified. Figure 4 , Figure 4 A schematic diagram of another defect verification method provided in an embodiment of the present application. Figure 4 In the pixel area of the upper left 9 pixels shown, the center point of the pixel area is the point to be tested.
[0085] by Figure 4 For example, in this implementation, Figure 4 The pixel value of the test point of A is 255, and Figure 4 The pixel value of the tested point of B is zero, so the tested point is determined to be a defective pixel. At this time, defect verification is performed on other pixel points in the first area and the second area.
[0086] Since defects generally do not appear in the form of a defective pixel, but in the form of a defective pixel block, which generally occupies several adjacent pixels on the image to be verified, when a defective pixel is detected, the probability that the pixels in its neighborhood are also defective pixels is greatly increased. Therefore, by first verifying the point to be tested, and then verifying whether other pixels in the same pixel area as the point to be tested are defective pixels, we can focus on the neighboring pixels of the detected defective pixel and improve the efficiency of defect verification.
[0087] In order to reduce false detection of defective pixels, based on the above embodiment, further, the step of determining whether each pixel is a defective pixel includes:
[0088] Pixels with non-zero pixel values in the first area and pixels with non-zero pixel values in the second area are determined as defective pixels.
[0089] Still Figure 3 As shown in the figure, after determining that there are defective pixels in the first area or the second area, the pixel values of each pixel in the first area and the second area are verified, and the pixels with zero pixel values are determined as non-defective pixels, and the pixels with non-zero pixel values are determined as defective pixels, and the following is formed: Figure 3 The image shown in C.
[0090] In some possible implementations of this embodiment, after determining that the first pixel sum value and the second pixel sum value are both not zero, a pixel-by-pixel “OR” operation may be directly performed on the first region and the second region to determine the actual position of the defective pixel. Figure 3 In A, the pixel value of the upper left corner pixel is zero; similarly, in Figure 3 In B, the pixel value of the upper left corner pixel is also zero, so after performing the "or" operation on this pixel, the calculated pixel value of this point is zero, so this point is identified as a non-defective pixel. Figure 3 In A, the pixel value of the upper right corner pixel is zero, but Figure 3 In B, the pixel value of the upper right corner pixel is 255. Therefore, after performing the "or" operation on the pixel, the calculated pixel value of the pixel is 255, so the pixel is identified as a defective pixel. This implementation method is simple and easy to implement, and it is convenient to set a computer program to perform a defect verification process.
[0091] In order to reduce the phenomenon of false detection and improve the efficiency of defect verification on the basis of reducing missed detection, in some other implementations of the embodiments of the present application, the pixel values of each pixel point in the first area and the second area can be summed to determine the situation of the pixel sum value, and then whether each pixel point inside is a defective pixel point can be determined, which specifically includes steps S2041-S2044. For the convenience of description, the same method is used. Figure 3 The defect verification method shown is used as an example for explanation.
[0092] S2041: Determine whether the sum of the first pixels is zero; if not zero, determine whether there is a defective pixel in the first area.
[0093] From the above steps, it can be seen that the sum of the first pixels is not zero, and it is determined that there are defective pixels in the first area. Since it is known that there are defective pixels in the first area, it is not necessary to judge whether there are defective pixels in the second area at this time, and it is directly determined that there are defective pixels in the pixel area of the image to be verified.
[0094] S2042: If it is zero, determine that there is no defective pixel in the first area.
[0095] The sum value is zero, indicating that the pixel values of all pixels in the first region are zero, that is, there are no defective pixels in the first region.
[0096] S2043: Determine whether the second pixel sum value is zero; if not, determine whether there is a defective pixel in the second area.
[0097] If the first pixel sum value is 0, it is determined that there is no defective pixel in the first area, and it is necessary to determine whether there is a defective pixel in the second area. The method for summing the pixel values of the pixels in the second area and performing defective pixel determination is the same as the method performed in the first area. For the same method, please refer to the description of the corresponding calculation method for the first area, which will not be repeated here.
[0098] S2044: If it is zero, determine that there is no defective pixel in the second area.
[0099] When it is determined that the first pixel sum value and the second pixel sum value are both 0, it is determined that there are no defective pixels in the first area and the second area, that is, there are no defective pixels in the pixel area in the image to be verified.
[0100] By first judging whether there are defective pixels in the first image to be verified; if so, it is determined that there are defective pixels in the pixel area of the image to be verified; if not, it is judged whether there are defective pixels in the same pixel area of the second image to be verified or even more images to be verified, thereby reducing the computing power required for defect verification in the same pixel area and improving the efficiency of defect verification.
[0101] In order to improve the image accuracy of the image to be verified and further improve the accuracy of subsequent defect verification, based on the above embodiment, after obtaining 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 image to be verified and the second image to be verified.
[0103] In some possible implementations, the image to be verified can be preprocessed by conventional image preprocessing methods, such as image sharpening or light and dark transformation, to increase the prominence of image features, thereby facilitating better feature expression of defective pixels relative to non-defective pixels and improving the accuracy of defect verification.
[0104] In some other possible implementations, image cropping can be used to reduce the number of defective pixels in each image and the amount of computation for a single defect verification calculation. A processor capable of parallel computing, such as a central processing unit (CPU), a graphics processing unit (GPU), or a tensor processing unit (TPU), can be used to perform parallel computations on multiple images for defect verification. Finally, the defect feature images obtained separately are spliced according to the corresponding cropping positions, thereby making full use of the processor's parallel processing of the defect verification algorithm, reducing the time consumed in reasoning and improving the efficiency of algorithm execution.
[0105] To facilitate the operation of the defect verification method and realize defect verification automation, based on the above embodiment, the method further includes:
[0106] Defective pixel points are determined on the first image to be verified and the second image to be verified by sliding the pixel area on the first image to be verified and the second image to be verified.
[0107] See also Figure 4 , Figure 4 A schematic diagram of another defect verification method provided in an embodiment of the present application, Figure 4 The three pictures A, B, and C are Figure 3 The three figures A, B, and C are the same and will not be repeated here.
[0108] In this embodiment, Figure 4 The fixed-size pixel area represented by the black box in A slides on the first image to be verified, such as Figure 4 The pixel area in A slides so that the first area slides one pixel to the right, that is, the sliding step size step = 1, so that all the information in the entire first image to be verified is extracted through the preset fixed-size pixel area. Figure 4 The same operation is performed on the second image to be verified of B, and then the pixels in the first image to be verified and the second image 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] In order to improve the defect verification efficiency, reduce the time consumed by defect verification, and save the amount of calculation, based on the above embodiment, further: the pixel area is a square, and the traversal step length is equal to the side length of the pixel area.
[0110] See also Figure 5 , Figure 5 , is a schematic diagram of another defect verification method provided in an embodiment of the present application, Figure 5 The three pictures A, B, and C are Figure 5 The three figures A, B, and C are the same and will not be repeated here.
[0111] exist Figure 5 A and Figure 5 In B, the pixel area of fixed size represented by the black box slides on the first image to be verified and the second image to be verified. The specific operation mode is the same as Figure 4 The difference is that in this embodiment, the sliding step length step is the same as the side length of the pixel area. Figure 5 A and Figure 5 In B, the side length of the pixel area is 3, and the sliding step is also 3; if the side length of the pixel area is 5, the sliding step can also be set to 5. Figure 4 A sliding step of 1 pixel is used in Figure 4 The calculation method shown in Figure 4 The same row on the images shown in A and B requires 6 calculations to capture all the image features of the row; Figure 5 The calculation method shown in Figure 5 The same row on the images shown in A and B only needs two calculations to capture all the image features of the row and realize defect verification for all the pixels in the row. This can greatly reduce the amount of calculation of the defect verification method, reduce the time consumed by defect verification, and improve the efficiency of defect verification.
[0112] See also Figure 6 , Figure 6 This is a structural block diagram of a defect verification device provided by the present application, the device comprising:
[0113] The image acquisition unit 610 is used to obtain 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 the first image to be verified into pixel regions to obtain a first region, and divide the pixel regions of the same size at the same position of 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] A pixel summing unit 630, configured to sum the pixel values of the pixels in the first area to obtain a first pixel sum value; and sum the pixel values of the pixels in the second area to obtain a second pixel sum value;
[0116] The first defect determination unit 640 is configured to determine whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value.
[0117] As a possible implementation manner, the first defect determination unit is further configured to:
[0118] If both the first pixel sum value and the second pixel sum value are not zero, it is determined that the defective pixel point exists in the pixel area.
[0119] As a possible implementation manner, the device further includes:
[0120] A second defect determination unit is configured to determine whether all pixels in the first area and the second area are defective pixels one by one by traversing all pixels in the first area and the second area if both the first pixel sum value and the second pixel sum value are not zero.
[0121] As a possible implementation manner, the second defect determination unit is further configured to:
[0122] Pixels with non-zero pixel values in the first area and pixels with non-zero pixel values in the second area are determined as defective pixels.
[0123] As a possible implementation manner, the first defect determination unit is further configured to:
[0124] Determine whether the first pixel sum value is zero; if not zero, determine that the defective pixel exists in the first area;
[0125] If it is zero, it is determined that the defective pixel does not exist in the first area;
[0126] Determine whether the second pixel sum value is zero; if not zero, determine that the defective pixel exists in the second area;
[0127] If it is zero, it is determined that the defective pixel does not exist in the second area.
[0128] As a possible implementation manner, the device further includes:
[0129] The third defect determination unit is configured to slide and traverse the first image to be verified and the second image to be verified through the pixel area to determine defective pixel points on the first image to be verified and the second image to be verified.
[0130] As a possible implementation manner, the pixel area is a square, and the step length of the sliding traversal is equal to the side length of the pixel area.
[0131] It can be seen from the above technical scheme that by obtaining the first image to be verified and the second image to be verified; wherein the first image to be verified is the detection result obtained by comparing the image to be detected with the first reference image, and the second image to be verified is the detection result obtained by comparing the image to be detected with the second reference image, and the first image to be verified and the second image to be verified include defective pixels; the first image to be verified is divided into pixel areas to obtain the first area, and the pixel areas of the same size are divided at the same position of the second image to be verified to obtain the second area; wherein the pixel area is an area centered on the point to be tested; the pixel values of the pixels in the first area are summed to obtain the first pixel summation value, and the pixel values of the pixels in the second area are summed to obtain the second pixel summation value; according to the first pixel summation value and the second pixel summation value, it is judged whether there are defective pixels in the pixel area. That is, by summing the pixel values of the pixels in the area, and then judging whether there are defective pixels in the divided pixel area according to the summation value, it is determined whether there are defective pixels in the divided pixel area, so as to improve the detection rate of defective pixels.
[0132] See also Figure 7 , Figure 7 A structural diagram of a computer device for defect verification provided in an embodiment of the present application. The computer device may include a processor 710 and a memory 720:
[0133] The memory 720 is used to store program codes and transmit the program codes to the processor;
[0134] The processor 710 is configured to execute any one of the defect verification methods provided in the above embodiments according to the instructions in the program code.
[0135] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, it is used to execute any one of the defect verification methods provided in the above embodiments.
[0136] It is understandable that the method can be applied to a processing device, which is a processing device capable of performing motion control, for example, a terminal device or a server with a motion control function. The method can be executed independently by a terminal device or a server, or can be applied to a network scenario in which a terminal device and a server communicate, and is executed by the cooperation of the terminal device and the server. Among them, the terminal device can be a computer, a mobile phone and other devices. The server can be understood as an application server or a Web server. In actual deployment, the server can be an independent server or a cluster server.
[0137] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the above-mentioned storage medium can be at least one of the following media: read-only memory (English: read-only memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc. Various media that can store program codes.
[0138] It should be noted that each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can refer to each other, and each embodiment focuses on 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 refer to the partial description of the method embodiments. The device and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0139] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A defect verification method, characterized in that: The method comprises: Obtaining 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, 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; Divide the first image to be verified into pixel areas to obtain a first area, and divide the second image to be verified into pixel areas of the same size at the same position to obtain a second area; wherein the pixel area is an area centered on the point to be tested; Summing the pixel values of the pixels in the first area to obtain a first pixel sum value, and summing the pixel values of the pixels in the second area to obtain a second pixel sum value; It is determined whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value.
2. The method according to claim 1, characterized in that The determining whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value comprises: If both the first pixel sum value and the second pixel sum value are not zero, it is determined that the defective pixel point exists in the pixel area.
3. The method according to claim 2, characterized in that The method further comprises: If both the first pixel sum value and the second pixel sum value are not zero, all pixel points in the first area and the second area are traversed to determine whether they are defective pixels one by one.
4. The method according to claim 3, characterized in that The step of determining whether each pixel is a defective pixel comprises: Pixels with non-zero pixel values in the first area and pixels with non-zero pixel values in the second area are determined as defective pixels.
5. The method according to claim 1, characterized in that The determining whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value comprises: Determine whether the first pixel sum value is zero; if not zero, determine that the defective pixel exists in the first area; If it is zero, it is determined that the defective pixel does not exist in the first area; Determine whether the second pixel sum value is zero; if not zero, determine that the defective pixel exists in the second area; If it is zero, it is determined that the defective pixel does not exist in the second area.
6. The method according to claim 1, characterized in that The method further comprises: Defective pixel points are determined on the first image to be verified and the second image to be verified by sliding the pixel area 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 area is a square, and the step length of the sliding traversal is equal to the side length of the pixel area.
8. A defect verification device, characterized in that: The device comprises: An image acquisition unit, configured 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, used for dividing the first image to be verified into pixel regions to obtain a first region, and dividing the pixel regions of the same size at the same position of 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 summing unit, configured to sum the pixel values of the pixels in the first area to obtain a first pixel sum value; and sum the pixel values of the pixels in the second area to obtain a second pixel sum value; The first defect determination unit is configured to determine whether the defective pixel point exists in the pixel area according to the first pixel sum value and the second pixel sum value.
9. A computer device, characterized in that: The computer device comprises a processor and a 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 described in any one of claims 1 to 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, and when the computer program is executed by a processor, it is used to execute the defect verification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image processing method, device and equipment
CN111667448A
Detection result determination method, device and system
CN112184701A
Defect detection method and device, computer equipment and storage medium
CN112750116A
Intelligent yarn clearing control method and system for bobbin winder
CN113638104A
Defect detection method and device
WO2020133046A1