Image detection method, image detection device and storage medium

By acquiring the area images of multiple sub-regions on the surface of the object to be tested and generating a reference map, the problem of inaccurate defect detection caused by poor imaging quality or chromatic aberration in the prior art is solved, and the accuracy of the detection results is improved.

CN120163754APending Publication Date: 2025-06-17SKYVERSE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311682634.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-07
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

The existing image detection methods lead to inaccurate defect detection results when the imaging quality is poor or the reference image has chromatic aberration.

Method used

By acquiring the area images of multiple sub-regions on the surface of the object to be tested, the grayscale value of the same pixel position is determined, and a reference map is generated based on the difference between the grayscale values, and defect detection is performed.

Benefits of technology

The accuracy of defect detection results on the object surface is improved to ensure that the reference image is more in line with the actual imaging situation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120163754A_ABST
    Figure CN120163754A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an image detection method, an image detection device and a storage medium, and is applied to the technical field of image detection. In the embodiment of the invention, area images of a plurality of sub-areas on the surface of a to-be-measured object are acquired; determining a gray value of the same pixel position in the plurality of regional images; determining the gray values of the pixel positions in the reference image corresponding to the sub-regions based on the gray difference between the gray values so as to generate the reference image; and performing defect detection on the surface of the to-be-detected object based on the reference image. The gray value of each pixel position in the reference image corresponding to the sub-region is obtained one by one according to the gray difference between the gray values of the same pixel position, so that the gray value of each pixel position in the reference image better conforms to the actual imaging condition of the sub-region, and defect detection is performed on the surface of the to-be-detected object based on the reference image. And the accuracy of the defect detection result of the object surface can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of image detection, and in particular, to an image detection method, an image detection device, and a storage medium. Background Art

[0002] With the rapid development of mechanized production, mechanical equipment, daily necessities, chip integrated circuits, etc. have achieved mechanized mass production. However, some products have high requirements for surface shape, color, etc. Products produced by mechanized production need to use image detection methods to detect defects on the product surface.

[0003] The existing image detection method is to perform a difference between the gray values of a preset area in the image to be detected on the product surface and the gray values of the adjacent area corresponding to the preset area in the reference image on the product surface, and detect the defects on the product surface based on the difference image.

[0004] However, the imaging quality on the product surface may be poor, resulting in a blurred reference image, or there may be color differences in some areas of the reference image. When performing a difference between the gray values of a preset area in the image to be detected and the gray values of the corresponding adjacent area, it is easy to cause inaccurate defect detection results on the product surface. Summary of the Invention

[0005] The embodiments of the present application provide an image detection method, an image detection device, and a storage medium, which effectively improve the accuracy of defect detection results on the surface of an object.

[0006] The embodiments of the present application provide an image detection method, including:

[0007] Obtain regional images of multiple sub-regions on the surface of the object to be measured;

[0008] Determine the gray values of the same pixel position in multiple regional images;

[0009] Based on the magnitude of the gray difference between the gray values, determine the gray value of the pixel position in the reference image corresponding to the sub-region to generate the reference image;

[0010] Perform defect detection on the surface of the object to be measured based on the reference image.

[0011] Further, the obtaining of the regional images of multiple sub-regions on the surface of the object to be measured includes:

[0012] Based on the detection imaging algorithm, sequentially detect multiple adjacent sub-regions on the surface of the object to be measured in sequence to obtain the multiple regional images.

[0013] Further, before determining the gray values of the same pixel position in multiple regional images, it further includes:

[0014] Perform template matching on the multiple regional images to determine the sub-pixel offset between the multiple regional images;

[0015] Translate and align the multiple regional images based on the sub-pixel offset; the multiple aligned regional images are used to determine the gray values at the same pixel positions.

[0016] Further, the reference image includes a first reference image and a second reference image;

[0017] Determining the gray value at the pixel position in the reference image corresponding to the sub-region based on the magnitude of the gray difference between the gray values to generate the reference image includes:

[0018] Sort the gray values by magnitude and determine the two gray values with the largest gray difference in the sorted sequence;

[0019] Use the two gray values as the gray values at the pixel position in the first reference image and the second reference image respectively to generate the first reference image and the second reference image.

[0020] Further, the defect detection of the surface of the object to be measured based on the reference image includes:

[0021] Perform difference between the first reference image and the regional image of any sub-region among the multiple sub-regions to obtain a first difference image, and perform difference between the second reference image and the regional image of the any sub-region to obtain a second difference image;

[0022] Perform difference between the first difference image and a preset template image to obtain a first defect pixel image, and perform difference between the second difference image and the preset template image to obtain a second defect pixel image;

[0023] Regard the region where the same positions in the first defect pixel image and the second defect pixel image are both identified as defects as the target defect position of the any sub-region.

[0024] Further, the reference image includes a first reference image and a second reference image;

[0025] Determining the gray value at the pixel position in the reference image corresponding to the sub-region based on the magnitude of the gray difference between the gray values to generate the reference image includes:

[0026] Obtain the target gray value at the pixel position of the regional image of the target sub-region among the multiple sub-regions;

[0027] Determine the two gray values with the smallest gray difference from the gray values to the target gray value;

[0028] Use the two grayscale values as the grayscale values of the pixel positions in the first reference image and the second reference image respectively to generate the first reference image and the second reference image.

[0029] Further, determining the two grayscale values with the smallest grayscale difference from the target grayscale value among the grayscale values includes:

[0030] Sort the grayscale values by size, and select the two grayscale values with the smallest grayscale difference from the target grayscale value on both adjacent sides of the target grayscale value in the sorted sequence.

[0031] Further, performing defect detection on the surface of the object to be measured based on the reference image includes:

[0032] Perform a difference operation between the first reference image and the regional image of the target sub-region to obtain a first difference image, and perform a difference operation between the second reference image and the regional image of the target sub-region to obtain a second difference image;

[0033] Perform a difference operation between the first difference image and a preset template image to obtain a first defect pixel image, and perform a difference operation between the second difference image and the preset template image to obtain a second defect pixel image;

[0034] Regard the region where the same positions in the first defect pixel image and the second defect pixel image are both identified as defects as the target defect position of the target sub-region.

[0035] An embodiment of the present application further provides an image detection device, including:

[0036] An acquisition unit, configured to acquire regional images of multiple sub-regions on the surface of the object to be measured;

[0037] A determination unit, configured to determine the grayscale values of the same pixel position in multiple regional images;

[0038] A generation unit, configured to determine the grayscale values of the pixel positions in the reference image corresponding to the sub-region based on the magnitude of the grayscale difference between the grayscale values, so as to generate the reference image;

[0039] A detection unit, configured to perform defect detection on the surface of the object to be measured based on the reference image.

[0040] An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium includes instructions, and when the instructions are run on a computer by a processor, the above-mentioned method is implemented.

[0041] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0042] In the embodiments of the present application, regional images of multiple sub-regions on the surface of the object to be measured are obtained; the gray values at the same pixel positions in multiple regional images are determined; based on the magnitude of the gray difference between the gray values, the gray value at the pixel position in the reference image corresponding to the sub-region is determined to generate a reference image; and defect detection is performed on the surface of the object to be measured based on the reference image. By obtaining the gray value at each pixel position in the reference image corresponding to the sub-region one by one according to the magnitude of the gray difference between the gray values at the same pixel positions, the gray value at each pixel position in the reference image can better conform to the actual imaging situation of the sub-region. Defect detection is performed on the surface of the object to be measured based on the reference image, which can effectively improve the accuracy of the defect detection result of the object surface. Description of the Drawings

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments recorded in the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

[0044] Figure 1 It is a flowchart of an image detection disclosed in the embodiments of the present application;

[0045] Figure 2 It is a flowchart of an image detection based on gray difference disclosed in the embodiments of the present application;

[0046] Figure 3 It is another flowchart of an image detection based on gray difference disclosed in the embodiments of the present application;

[0047] Figure 4 It is a schematic diagram of the sorting of gray values at the same pixel position disclosed in the embodiments of the present application;

[0048] Figure 5 It is a schematic diagram of a double detection disclosed in the embodiments of the present application;

[0049] Figure 6 It is a diagram of an image detection device disclosed in the embodiments of the present application;

[0050] Figure 7 It is another diagram of an image detection device disclosed in the embodiments of the present application. Detailed Embodiments

[0051] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.

[0052] In the description of the embodiments of this application, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the embodiments of this application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the embodiments of this application.

[0053] The existing image detection method is to perform a difference between the gray values of a preset region in the image to be measured on the surface of the product and the gray values of the adjacent region corresponding to the preset region in the reference image on the surface of the product, and detect the defects on the surface of the product based on the difference image. However, there may be poor imaging quality on the surface of the product, resulting in a blurred reference image, or there may be color differences in some regions of the reference image. When performing a difference between the gray values of the preset region in the image to be measured and the gray values of the corresponding adjacent region, it is easy to cause inaccurate defect detection results on the surface of the product. Therefore, the embodiments of this application provide an image detection method, which effectively improves the accuracy of the defect detection results on the surface of an object. The method is as Figure 1 shown and specifically includes the following steps:

[0054] 101. Obtain the regional images of multiple sub-regions on the surface of the object to be measured.

[0055] In the embodiments of this application, before the image detection device detects the defects on the surface of the object to be measured, it is necessary to obtain the regional images of multiple sub-regions on the surface of the object to be measured. Among them, the multiple sub-regions are any two or more sub-regions on the surface of the object to be measured, and the regional images of the sub-regions correspond to each other; the surface of the object to be measured is generally a flat object surface, such as the surface of glass, the surface of a film, or the surface of a wafer, and specific limitations are not made here. Preferably, the shape and size of each sub-region on the surface of the object to be measured are the same, the size and shape of the patterns on each sub-region are also the same, and the patterns on each sub-region correspond to each other. For example, when the object to be measured is a wafer, the corresponding sub-region can be the area where a single die on the wafer is located.

[0056] The regional image is a single-channel grayscale image of the sub-region. In the regional image, each pixel point uses a grayscale value to represent the color of that pixel point. The grayscale value (pixel value) refers to the fact that due to the different colors and brightness of each point in the scene, each point on the black-and-white photo taken or the black-and-white image received and reproduced by the TV presents different degrees of gray. The logarithmic relationship between white and black is divided into several levels, called grayscale levels, generally ranging from 0 to 225.

[0057] Preferably, the adjacent sub-regions on the surface of the object to be measured are continuous. Multiple adjacent sub-regions on the surface of the object to be measured can be sequentially detected according to the detection imaging algorithm in sequence, and the regional image can be obtained, which can make the obtained regional image more representative. The detection imaging algorithm can be a floating-point algorithm, an integer method, a shift method or an averaging method, which converts the color image of the sub-region into the corresponding grayscale image to obtain the regional image of the sub-region, and the specific details are not limited here.

[0058] 102. Determine the grayscale values of the same pixel positions in multiple regional images.

[0059] After obtaining multiple regional images, the grayscale values of the same pixel positions in multiple regional images can be determined. The same pixel position refers to the corresponding pixel points in multiple regional images. Generally, multiple sub-regions are repeated regions, and multiple regional images have corresponding relationships. Multiple regional images can be aligned to determine the same pixel positions of multiple regional images. For example, when the object to be measured is a wafer, the sub-region is the die on the wafer, and the size and color of each die correspond to each other. The dies can be aligned and overlapped to determine the same pixel position on the die. Due to the influence of factors such as color difference or imaging quality, the grayscale values of the same pixel positions in multiple regional images may be different.

[0060] Among them, the target pixel point can be located in one regional image first to obtain the grayscale value of the target pixel point, and then the corresponding pixel points of the target pixel point in other regional images can be determined, and the grayscale values of the corresponding pixel points can be determined, so as to obtain the grayscale values of the same pixel positions in multiple regional images.

[0061] 103. Based on the magnitude of the grayscale difference between grayscale values, determine the grayscale value of the pixel position in the reference map corresponding to the sub-region to generate a reference map.

[0062] After determining the gray values of the same pixel position in multiple regional images, the gray value of the pixel position in the reference image corresponding to the sub-region can be determined based on the magnitude of the gray difference between the gray values, so as to generate a reference image. This gray difference is the difference value between the gray values, which can be understood as the differential value between the gray values. Generally, the smaller the gray difference of the gray values at the same pixel position, the closer the colors of the sub-regions corresponding to the multiple regional images at this pixel position; the larger the gray difference of the gray values at the same pixel position, the less close the colors of the sub-regions corresponding to the multiple regional images at this pixel position.

[0063] Among them, a reference image corresponding to the regional image of the sub-region can be created, and the size and type of this reference image are the same as those of the regional image. When initially creating the reference image, the gray value of each pixel point in the reference image can be preset to 0, and then the gray value of this pixel position in the reference image can be determined based on the magnitude of the gray difference between the gray values at the same pixel position, that is, the gray value of the pixel point corresponding to this pixel position can be determined. For example, among the multiple gray values at the same pixel position, the gray value with the largest gray difference can be taken as the gray value of this pixel position in the reference image. By traversing all the pixel positions in the regional image, the gray value of each pixel position in the reference image can be determined one by one to generate a reference image.

[0064] 104. Perform defect detection on the surface of the object to be measured based on the reference image.

[0065] After generating the reference image, defect detection can be performed on the surface of the object to be measured based on the reference image, that is, the reference image can be used to perform defect detection on the image to be measured corresponding to the sub-region on the surface of the object to be measured. The process of this defect detection can be to perform image difference between the reference image and the image to be measured to obtain the corresponding difference image; then determine the defective pixel positions in the image to be measured, that is, determine the pixel points corresponding to the defects in the image to be measured.

[0066] It can be seen that in the embodiments of the present application, regional images of multiple sub-regions on the surface of the object to be measured are obtained; the gray values of the same pixel position in multiple regional images are determined; based on the magnitude of the gray difference between the gray values, the gray value of the pixel position in the reference image corresponding to the sub-region is determined to generate a reference image; defect detection is performed on the surface of the object to be measured based on the reference image. By obtaining the gray value of each pixel position in the reference image corresponding to the sub-region one by one based on the magnitude of the gray difference between the gray values at the same pixel position, the gray value of each pixel position in the reference image can be made more in line with the actual imaging situation of the sub-region. Performing defect detection on the surface of the object to be measured based on the reference image can effectively improve the accuracy of the defect detection result of the object surface.

[0067] Further, in order to make the obtained reference images have a better contrast effect, the first reference image and the second reference image can be generated based on the two gray values with the largest gray difference, which can effectively reduce noise interference when using the first reference image and the second reference image for defect detection. As Figure 2 shown, the specific steps are as follows:

[0068] 201. Obtain the regional images of multiple sub-regions on the surface of the object to be measured.

[0069] It can be understood that step 201 is similar to the above step 101, and the details are not elaborated here.

[0070] 202. Translate and align multiple regional images based on the sub-pixel offset.

[0071] It can be understood that the multiple regional images are the gray images of multiple sub-regions on the surface of the object to be measured. There may be pixel deviations between the multiple regional images, and translation and alignment are required. After obtaining the regional images of multiple sub-regions, in order to more accurately determine the same pixel position in the multiple regional images, the multiple regional images can be translated and aligned based on the sub-pixel offset. Among them, the multiple regional images can be subjected to template matching to determine the sub-pixel offset between the multiple regional images. For example, any one of the regional images can be selected as the template image (reference image), and the other regional images are subjected to template matching with the template image, and the sub-pixel offset (offset offset) is calculated for the region of interest (roi region); the multiple regional images are translated and aligned based on the sub-pixel offset; the multiple regional images after alignment are used to determine the gray value of the same pixel position. Among them, the translation and alignment can be understood as the patterns on the multiple regional images being matched, or the image boundaries being matched, and the specific details are not limited here.

[0072] When performing template matching, the correlation matrix of other regional images can be calculated to find the maximum value of the correlation matrix or the centroid of the correlation matrix to obtain the sub-pixel offset. Based on the sub-pixel offset, sub-pixel translation is performed on other regional images so that other regional images are aligned with the template image, that is, other regional images are Fourier-transformed into the frequency domain, and then phase modulation is performed based on the sub-pixel offset to achieve sub-pixel translation. After sub-pixel offset alignment, there are no pixel deviations in the alignment of the multiple regional images. For example, when the object to be measured is a wafer, a row of grains on the wafer can be scanned, and N grains are taken as a group of wafer units. N can be 6 or 8, and the specific details are not limited here; the first grain image is selected as the reference image (in the order of scanning), and the remaining N-1 images are aligned with the first image as the reference.

[0073] 203. Determine the gray values of the same pixel positions in the multiple regional images.

[0074] It can be understood that step 203 is similar to the above-mentioned step 103, and specific details will not be elaborated here.

[0075] 204. Sort the grayscale values by size, and generate a first reference image and a second reference image based on the two grayscale values with the largest grayscale difference in the sorted sequence.

[0076] In the embodiments of the present application, the reference images include a first reference image and a second reference image. The grayscale values at the same pixel position can be sorted by size, and the two grayscale values with the largest grayscale difference can be determined in the sorted sequence; that is, the grayscale values of the same pixel position in the multiple regional images are obtained, and the two grayscale values with the largest grayscale difference are determined at this pixel position; the two grayscale values are respectively used as the grayscale values of the pixel position in the first reference image and the second reference image to generate the first reference image and the second reference image.

[0077] Specifically, a first reference image and a second reference image with the same size and type as the regional image can be created, and then the grayscale value of each pixel position in the first reference image and the second reference image is determined one by one to generate the first reference image and the second reference image. For example, when the object to be measured is a wafer, sub-regions can be obtained: N die images of the die. Two reference images with the same size and similar to the die image can be created: the first reference image ref_low and the second reference image ref_high. Starting from the starting pixel position (i.e., the first pixel point) of the die image, the grayscale values of the N die images at the same pixel position are determined, and the die images are sorted according to the grayscale values from small to large; as Figure 4 shown, 8 die images are sorted. Pn represents the size of the grayscale value at the same pixel position, In represents the nth die image, n ranges from 0 to 7, and the grayscale values P0 ≤ P1 ≤... ≤ P7. The two grayscale values with the largest grayscale difference, P0 and P7, can be determined in this sorted sequence. The smaller grayscale value P0 is used as the grayscale value of this pixel position in the first reference image ref_low, and the larger grayscale value P7 is used as the grayscale value of this pixel position in the second reference image ref_high.

[0078] It can be understood that the pixel values in the obtained regional images may not be accurate. After obtaining the grayscale values of the same pixel position in the multiple regional images, the maximum and minimum grayscale values can be excluded first to reduce errors. For example, in the sorted sequence: grayscale values P0 ≤ P1 ≤... ≤ P7, the two endpoints, the abnormal pixel values P0 and P7, are removed first. At this time, P1 can be used as the grayscale value of this pixel position in the first reference image ref_low, and the larger grayscale value P6 can be used as the grayscale value of this pixel position in the second reference image ref_high.

[0079] 205. Based on the first reference image and the second reference image, perform double defect detection on the multiple sub-regions on the surface of the object to be measured.

[0080] After obtaining the first reference image and the second reference image, double defect detection can be performed on the multiple sub-regions on the surface of the object to be measured based on the first reference image and the second reference image. The specific process of this double defect detection is as Figure 5 shown. Image acquisition can be performed on the multiple sub-regions to obtain multiple regional images. Based on the multiple regional images, the first reference image and the second reference image are generated. The first reference image (reference Figure 1 ) is differenced from the regional image (image to be measured) of any sub-region in the multiple sub-regions to obtain a first difference image (difference Figure 1 ), and the second reference image (reference Figure 1 ) is differenced from the image to be measured to obtain a second difference image (difference Figure 2 ). A pixel grouping map (golden map) corresponding to the image to be measured is obtained. There are multiple pixel groups in the pixel grouping map, and the gray values of the pixel points in each pixel group are the same. This pixel grouping map is the preset template image corresponding to the image to be measured. Based on the DTH algorithm (directory tree hash), the first difference image and the second difference image are respectively differenced from the preset template image to obtain two corresponding defect pixel images; that is, the first difference image is differenced from the preset template image to obtain a first defect pixel image, and the second difference image is differenced from the preset template image to obtain a second defect pixel image; the region where the same positions in the first defect pixel image and the second defect pixel image are both identified as defects is used as the target defect position of any sub-region. Traverse the multiple sub-regions one by one, and defect detection can be performed on the multiple sub-regions.

[0081] It can be understood that the first reference image and the second reference image are reference images corresponding to the multiple sub-regions; that is, the first reference image and the second reference image can only perform defect detection on the multiple sub-regions. When detecting sub-regions outside the multiple sub-regions, it is necessary to re-obtain the regional images of other multiple sub-regions to obtain the corresponding first reference image and the second reference image. For example, when the object to be measured is a wafer, 8 grains can be taken as a group. For the 8 grain images in this group, only one reference image needs to be generated once. The obtained first reference image and the second reference image can be used to perform defect detection on the 8 grain images in this group, that is, all subsequent detections of the 8 grain images in this group can use the first reference image and the second reference image. For the 8 grain images in this group, there is no need to generate reference images multiple times, that is, for the multiple regional images corresponding to each group of sub-regions, only one reference image needs to be generated once, and there is no need to generate a reference image for each sub-region, effectively improving the detection efficiency.

[0082] Further, in order to make the obtained reference images close to the imaging of the sub-region itself, the first reference image and the second reference image can be generated based on the two gray values with the smallest gray difference, so as to further improve the accuracy of the defect detection result when using the first reference image and the second reference image for defect detection. As Figure 3 shown, the specific steps are as follows:

[0083] 301. Obtain the regional images of multiple sub-regions on the surface of the object to be measured.

[0084] 302. Translate and align multiple regional images based on the sub-pixel offset.

[0085] 303. Determine the gray values of the same pixel position in multiple regional images.

[0086] It can be understood that steps 301 to 303 are similar to steps 201 to 203 above, and will not be elaborated here specifically.

[0087] 304. Determine the two gray values with the smallest gray difference from the target gray value of the target sub-region, and generate the first reference image and the second reference image.

[0088] The reference images include the first reference image and the second reference image. After determining the gray values of the same pixel position in multiple regional images, the target sub-region can be selected from multiple sub-regions, and the two gray values with the smallest gray difference from the target gray value of the target sub-region can be determined to generate the first reference image and the second reference image. Specifically, the target gray value of the target sub-region in the regional image of the multiple sub-regions can be obtained at the pixel position; the two gray values with the smallest gray difference from the target gray value can be determined from the gray values; the two gray values are respectively used as the gray values at the pixel position in the first reference image and the second reference image to generate the first reference image and the second reference image. That is, among the gray values of the same pixel position, the two gray values with the smallest gray difference from the target gray value of the target sub-region are determined, and the two gray values are used as the gray values at the pixel position in the first reference image and the second reference image. After traversing all the pixel positions corresponding to the target sub-region, the first reference image and the second reference image are generated.

[0089] Among them, the gray values of the same pixel position can be sorted by size, and the two gray values with the smallest gray difference from the target gray value can be selected from the adjacent sides of the target gray value in the sorting sequence; for example, in Figure 4In the sorting sequence of the gray values, two gray values on the adjacent sides of the target gray value in the sorting sequence can be selected as the gray values of the first reference image and the second reference image at this pixel position; for example, when the image to be measured is the fourth grain image I4, the gray value of the first reference image ref_low at this pixel position is P5, and the gray value of the second reference image ref_high at this pixel position is P7; by traversing all pixel positions on the fourth grain image I4, the first reference image and the second reference image corresponding to the fourth grain image I4 can be generated. Another example is when the image to be measured is the fifth grain image I5, the gray value of the first reference image ref_low at this pixel position is P1, and the gray value of the second reference image ref_high at this pixel position is P3; by traversing all pixel positions on the fifth grain image I5, the first reference image and the second reference image corresponding to the fifth grain image I5 can be generated.

[0090] It can be seen that by selecting, from the adjacent sides of the target gray value in the sorting sequence, two gray values with the smallest gray difference from the target gray value, it is not necessary to compare the target gray value with other gray values one by one among the gray values at the same pixel position, effectively improving the selection efficiency of gray values to improve the efficiency of generating reference images; and this sorting sequence can be used not only when generating reference images for the target sub-region, but also when generating reference images for other sub-regions outside the target sub-region among multiple sub-regions, that is, this sorting sequence can be reused for generating reference images for multiple sub-regions, further improving the efficiency of generating reference images.

[0091] 305. Based on the first reference image and the second reference image, perform double defect detection on the target sub-region.

[0092] After obtaining the first reference image and the second reference image, double defect detection can be performed on the target sub-region based on the first reference image and the second reference image. The specific process of double defect detection is similar to step 205 above, and will not be elaborated here specifically. It can be understood that the gray difference between the gray values at the pixel positions in the first reference image and the second reference image and the gray values at the same pixel positions in the regional image of the target sub-region is the smallest, and the first reference image and the second reference image are closest to the original imaging of the target sub-region. When using the first reference image and the second reference image to perform defect detection on the target sub-region, the accuracy of the defect detection result on the object surface can be effectively improved.

[0093] It can be understood that the first reference image and the second reference image correspond to the target sub-region, that is, they are only used to detect the target sub-region; when detecting the regional images of other sub-regions, corresponding reference images need to be regenerated; for each sub-region on the surface of the object to be measured, corresponding reference images are generated respectively, and then the reference images are used to detect the corresponding sub-regions, which can effectively improve the accuracy of defect detection.

[0094] An embodiment of the present application further provides an image detection device, as Figure 6 shown, including:

[0095] An acquisition unit 601, configured to acquire regional images of multiple sub-regions on the surface of the object to be measured;

[0096] A determination unit 602, configured to determine the gray values at the same pixel position in multiple regional images;

[0097] A generation unit 603, configured to determine the gray value at the pixel position in the reference map corresponding to the sub-region based on the magnitude of the gray difference between the gray values, so as to generate the reference map;

[0098] A detection unit 604, configured to perform defect detection on the surface of the object to be measured based on the reference map.

[0099] Further, the image detection device further includes: a registration unit;

[0100] The registration unit is configured to perform template matching on the multiple regional images to determine the sub-pixel offset amount between the multiple regional images; perform translational registration on the multiple regional images based on the sub-pixel offset amount; the multiple registered regional images are used to determine the gray values at the same pixel position.

[0101] Further, the reference map includes a first reference map and a second reference map; the generation unit 601 is specifically configured to sort the gray values by magnitude, and determine the two gray values with the largest gray difference in the sorted sequence; use the two gray values as the gray values at the pixel position in the first reference map and the second reference map respectively, so as to generate the first reference map and the second reference map.

[0102] Further, the detection unit 604 is specifically configured to perform difference between the first reference map and the regional image of any sub-region in the multiple sub-regions to obtain a first difference map, and perform difference between the second reference map and the regional image of the any sub-region to obtain a second difference map; perform difference between the first difference map and a preset template image to obtain a first defective pixel image, and perform difference between the second difference map and the preset template image to obtain a second defective pixel image; regard the region where the same positions in the first defective pixel image and the second defective pixel image are both identified as defects as the target defect position of the any sub-region.

[0103] Further, the reference images include a first reference image and a second reference image; the generating unit 603 is specifically configured to obtain a target gray value of a region image of a target sub-region among the multiple sub-regions at the pixel position; determine two gray values with the smallest gray difference from the gray values; and use the two gray values as the gray values at the pixel position in the first reference image and the second reference image respectively, so as to generate the first reference image and the second reference image.

[0104] Further, the detecting unit 604 is specifically configured to perform difference operation between the first reference image and the region image of the target sub-region to obtain a first difference image, and perform difference operation between the second reference image and the region image of the target sub-region to obtain a second difference image; perform difference operation between the first difference image and a preset template image to obtain a first defective pixel image, and perform difference operation between the second difference image and the preset template image to obtain a second defective pixel image; and determine a region where the same positions in the first defective pixel image and the second defective pixel image are both identified as defects as the target defective position of the target sub-region.

[0105] An image detection device 700 according to an embodiment of the present application is further provided, as Figure 7 shown. The image detection device 700 according to the embodiment of the present application may include one or more central processing units CPU (CPU, central processing units) 701 and a memory 702, and one or more application programs or data are stored in the memory 702.

[0106] Among them, the memory 702 may be volatile storage or persistent storage. The program stored in the memory 702 may include one or more modules, and each module may include a series of instruction operations on the electronic device. Further, the central processing unit 701 may be configured to communicate with the memory 702 and execute a series of instruction operations in the memory 702 on the image detection device 700.

[0107] The image detection device 700 may further include one or more power supplies 705, one or more wired or wireless network interfaces 704, one or more input / output interfaces 703, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0108] The central processing unit 701 may perform the operations executed in any of the foregoing specific method embodiments, which will not be elaborated herein.

[0109] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be repeated here.

[0110] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0111] 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 can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0112] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0113] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, read-only memory), random access memories (RAM, random access memory), magnetic disks, or optical discs that can store program codes.

Claims

1. An image detection method, characterized in that, Including: Obtaining regional images of multiple sub-regions on the surface of the object to be measured; Determining the gray values of the same pixel position in multiple regional images; Based on the magnitude of the gray difference between the gray values, determining the gray value of the pixel position in the reference image corresponding to the sub-region to generate the reference image; Performing defect detection on the surface of the object to be measured based on the reference image.

2. The image detection method according to claim 1, characterized in that, The obtaining of regional images of multiple sub-regions on the surface of the object to be measured includes: Sequentially detecting multiple adjacent sub-regions on the surface of the object to be measured based on the detection imaging algorithm to obtain the multiple regional images.

3. The image detection method according to claim 1, characterized in that, Before determining the gray values of the same pixel position in multiple regional images, it further includes: Performing template matching on the multiple regional images to determine the sub-pixel offset between the multiple regional images; Performing translational alignment on the multiple regional images based on the sub-pixel offset; the aligned multiple regional images are used to determine the gray values of the same pixel position.

4. The image detection method according to claim 1, characterized in that, The reference image includes a first reference image and a second reference image; The determining of the gray value of the pixel position in the reference image corresponding to the sub-region based on the magnitude of the gray difference between the gray values to generate the reference image includes: Sorting the gray values by magnitude and determining the two gray values with the largest gray difference in the sorted sequence; Using the two gray values as the gray values of the pixel position in the first reference image and the second reference image respectively to generate the first reference image and the second reference image.

5. The image detection method according to claim 4, characterized in that, The performing of defect detection on the surface of the object to be measured based on the reference image includes: Performing difference between the first reference image and the regional image of any sub-region among the multiple sub-regions to obtain a first difference image, and performing difference between the second reference image and the regional image of the any sub-region to obtain a second difference image; Performing difference between the first difference image and a preset template image to obtain a first defect pixel image, and performing difference between the second difference image and the preset template image to obtain a second defect pixel image; Regarding the region where the same positions in the first defect pixel image and the second defect pixel image are both identified as defects as the target defect position of the any sub-region.

6. The image detection method according to claim 1, characterized in that, The reference image includes a first reference image and a second reference image; The determining of the gray value of the pixel position in the reference image corresponding to the sub-region based on the magnitude of the gray difference between the gray values to generate the reference image includes: Obtaining the target gray value of the regional image of the target sub-region among the multiple sub-regions at the pixel position; Determining the two gray values with the smallest gray difference from the gray values with respect to the target gray value; Using the two gray values as the gray values of the pixel position in the first reference image and the second reference image respectively to generate the first reference image and the second reference image.

7. The image detection method according to claim 6, characterized in that, The determining of the two gray values with the smallest gray difference from the gray values with respect to the target gray value includes: Sorting the gray values by magnitude and selecting the two gray values with the smallest gray difference from the adjacent sides of the target gray value in the sorted sequence.

8. The image detection method according to claim 6, characterized in that, The defect detection of the surface of the object to be measured based on the reference image includes: Performing a difference operation between the first reference image and the regional image of the target sub-region to obtain a first difference image, and performing a difference operation between the second reference image and the regional image of the target sub-region to obtain a second difference image; Performing a difference operation between the first difference image and a preset template image to obtain a first defective pixel image, and performing a difference operation between the second difference image and the preset template image to obtain a second defective pixel image; Regarding the region where the same positions in the first defective pixel image and the second defective pixel image are both identified as defects as the target defect position of the target sub-region.

9. An image detection device, characterized in that, It includes: An acquisition unit for acquiring the regional images of multiple sub-regions on the surface of the object to be measured; A determination unit for determining the gray values of the same pixel positions in multiple regional images; A generation unit for determining the gray value of the pixel position in the reference image corresponding to the sub-region based on the magnitude of the gray difference between the gray values, so as to generate the reference image; A detection unit for performing defect detection on the surface of the object to be measured based on the reference image.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when run on a computer by a processor, implement the method according to any one of claims 1 to 8.