Image detection method, image detection device and storage medium

By tiling and updating the grayscale value of the image to be tested in image detection, the detection error caused by uneven lighting is solved, and the accuracy of defect detection is improved.

CN118552540BActive Publication Date: 2025-03-11SKYVERSE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411021389.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2025-03-11
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

In the case of uneven light processing, the existing image detection methods can easily lead to inaccurate defect detection results on the product surface, especially when semiconductor detection, it is difficult to accurately correct the problem of uneven light of the grains.

Method used

By acquiring the image to be measured and the reference image of each sub-region on the object surface, the image to be measured is divided into multiple first chunked images, the reference image is divided into chunks to obtain the second chunked image corresponding to the first chunked image, the gray value of the pixel points of the first chunked image in the image to be measured is updated based on the gray value of the first chunked image and the gray value of the corresponding second chunked image, the gray value of the pixel points of the first chunked image in the image to be measured is obtained, and defect detection is performed based on the target image.

Benefits of technology

By correcting the uneven chromatic aberration in the image to be tested in blocks, the accuracy of defect detection results on the object surface is improved, and the detection error caused by uneven light is effectively solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552540B_ABST
    Figure CN118552540B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an image detection method, an image detection device, and a storage medium, which are used in the field of image detection technology. In the embodiment of the present application, an image to be tested of each sub-area on the surface of an object and a reference image corresponding to the sub-area are obtained; the image to be tested is divided into blocks to obtain multiple first block images, and the reference image is divided into blocks to obtain second block images corresponding to the first block images; based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain a target image; based on the target image and the reference image, defect detection is performed on the surface of the object. By updating the grayscale value of the first block image in the image to be tested and correcting the color difference of the first block image, the uneven color difference in the image to be tested can be corrected in blocks to obtain a target image, which effectively improves the accuracy of the defect detection results on the surface of the object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image detection technology, 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 on surface shape, color, etc. Products produced by mechanization need to use image detection methods to detect defects on the product surface.

[0003] In existing image detection, the images to be tested in multiple sub-areas on the surface of the product are compared with the reference images corresponding to the sub-areas, and defects on the product surface are detected based on the comparison results. However, each sub-area on the surface of the product may have uneven lighting. During image detection, there is uneven color difference in the images to be tested in the sub-areas, which can easily lead to inaccurate defect detection results on the product surface. Especially in semiconductor detection, uneven lighting may occur at each grain on the chip. At this time, the method of calculating the global average brightness of the grain image for correction cannot accurately correct the color difference problem caused by uneven illumination. Summary of the invention

[0004] The embodiments of the present application provide an image detection method, an image detection device, and a storage medium to solve the color difference problem existing in the image and effectively improve the accuracy of the defect detection results of the object surface.

[0005] The present application provides an image detection method, including:

[0006] Acquire an image to be measured of each sub-region on the surface of the object, and acquire a reference image corresponding to the sub-region;

[0007] Divide the image to be tested into blocks to obtain a plurality of first block images, and divide the reference image into blocks to obtain second block images corresponding to the first block images;

[0008] Based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain a target image;

[0009] Defect detection is performed on the surface of the object based on the target image and the reference image.

[0010] Further, obtaining a reference image corresponding to the sub-region includes:

[0011] Performing translation alignment on the plurality of images to be tested;

[0012] Based on the grayscale values ​​of the same pixel position in the aligned multiple images to be tested, the grayscale value of the same pixel position in the reference image is determined to generate the reference image.

[0013] Furthermore, dividing the image to be tested into blocks to obtain a plurality of first block images, and dividing the reference image into blocks to obtain second block images corresponding to the first block images comprises:

[0014] Acquire an image block size based on the image size of the image to be tested; wherein the image block size is smaller than the image size of the image to be tested;

[0015] The image to be tested and the reference image are respectively divided into blocks based on the image block size to obtain a plurality of first block images and second block images corresponding to the first block images.

[0016] Further, the obtaining of a preset image block size based on the image size of the image to be measured includes;

[0017] Obtaining a preset image block size, wherein the preset image block size is smaller than the image size of the image to be tested;

[0018] The preset image block size is updated based on the image size of the image to be measured to obtain the image block size.

[0019] Furthermore, the image size of the image to be tested includes image width and image height, and the preset image block size includes preset block width and preset block height;

[0020] The updating of the preset image block size based on the image size of the image to be tested to obtain the image block size comprises:

[0021] Determine the number of width blocks of the image to be tested based on the image width of the image to be tested and the preset block width of the preset image block size; determine the number of height blocks of the image to be tested based on the image height of the image to be tested and the preset block height of the preset image block size;

[0022] Based on the image width of the image to be tested and the number of width blocks, the target image block width is obtained; based on the image height of the image to be tested and the number of height blocks, the target image block height is obtained; based on the target image block width and the target image block height, the image block size is obtained.

[0023] Furthermore, the determining the number of width blocks of the image to be tested based on the image width of the image to be tested and the preset block width of the preset image block size includes:

[0024] The image width of the image to be tested is divided by the preset block width of the preset image block size to obtain a width quotient; the width quotient is rounded to obtain the number of width blocks of the image to be tested.

[0025] Further, the updating of the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image to obtain the target image includes:

[0026] Obtaining a grayscale ratio between an average grayscale value of the first block image and an average grayscale value of the corresponding second block image;

[0027] Based on the grayscale ratio, the grayscale value of each pixel in the first block image is updated to obtain the target image.

[0028] Furthermore, the grayscale value of each pixel in the first block image is updated based on the grayscale ratio, and the target image is obtained, including:

[0029] Multiplying the grayscale value of each pixel in the first block image by the grayscale ratio to obtain the product of the grayscale values;

[0030] The grayscale value of each pixel in the first block image is updated to the product of the grayscale values ​​corresponding to the pixel to obtain the target image.

[0031] Further, the updating of the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image to obtain the target image includes:

[0032] Obtaining a grayscale difference between an average grayscale value of the first block image and an average grayscale value of the corresponding second block image;

[0033] If the grayscale difference is greater than a preset grayscale threshold, the grayscale values ​​of the pixels of the first block image in the image to be tested are updated to obtain the target image.

[0034] Further, the performing defect detection on the surface of the object based on the target image and the reference image includes:

[0035] Performing image difference between the target image and the reference image to obtain a difference image;

[0036] A defective pixel area in the target image is determined based on the differential image.

[0037] The present application also provides an image detection device, which includes:

[0038] An acquisition unit, used to acquire an image to be measured of each sub-region on the surface of the object, and to acquire a reference image corresponding to the sub-region;

[0039] A blocking unit, configured to block the image to be tested to obtain a plurality of first blocked images, and block the reference image to obtain second blocked images corresponding to the first blocked images;

[0040] An updating unit, configured to update the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image, so as to obtain a target image;

[0041] A detection unit is used to perform defect detection on the surface of the object based on the target image and the reference image.

[0042] An embodiment of the present application further provides a computer-readable storage medium, which includes instructions. When the instructions are executed by a processor on a computer, the method described above is implemented.

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

[0044] In an embodiment of the present application, an image to be tested of each sub-region on the surface of an object and a reference image corresponding to the sub-region are obtained; the image to be tested is divided into blocks to obtain a plurality of first block images, and the reference image is divided into blocks to obtain a second block image corresponding to the first block image; based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain a target image; and defect detection is performed on the surface of the object based on the target image and the reference image. By updating the grayscale value of the first block image in the image to be tested and correcting the color difference of the first block image, the uneven color difference in the image to be tested can be corrected in blocks to obtain the target image. When the target image is used to perform defect detection on the surface of the object, the accuracy of the defect detection result on the surface of the object is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0046] Figure 1 An image detection flow chart disclosed in an embodiment of the present application;

[0047] Figure 2 Another image detection flow chart disclosed in an embodiment of the present application;

[0048] Figure 3 A diagram of an image detection device disclosed in an embodiment of the present application;

[0049] Figure 4 A diagram of another image detection device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] In the description of the embodiments of the present application, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the embodiments of the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on the embodiments of the present application.

[0052] In the description of the embodiments of the present application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the embodiments of the present application can be understood according to specific circumstances.

[0053] In existing image detection, the images of multiple sub-areas on the product surface are compared with the reference images corresponding to the sub-areas, and defects on the product surface are detected based on the comparison results. However, each sub-area on the product surface may have uneven lighting, and there will be uneven color differences in the images of the sub-areas during image detection, which can easily lead to inaccurate defect detection results on the product surface.

[0054] In the existing image detection, chromatic aberration correction is performed. The commonly used chromatic aberration correction method is to calculate the global average brightness of the image to be tested, and perform chromatic aberration correction on the image to be tested based on the average brightness. However, due to the uneven chromatic aberration of the images to be tested in the sub-areas, the illumination size and illumination distribution in the images to be tested corresponding to each sub-area will be different. Using the average brightness to perform chromatic aberration correction on the images to be tested is prone to correction errors. Therefore, the embodiment of the present application provides an image detection method that effectively improves the accuracy of defect detection results on the surface of an object, such as Figure 1 As shown, the specific steps include:

[0055] 101. Acquire an image to be measured of each sub-region on the surface of an object, and acquire a reference image corresponding to the sub-region.

[0056] In an embodiment of the present application, the image detection device needs to obtain the image to be tested of each sub-area on the surface of the object before performing defect detection on the surface of the object. The images to be tested of each sub-area on the surface of the object correspond to each other; the surface of the object is generally a flat surface of an object, such as a glass surface, a film surface or a wafer surface, which is not specifically limited here. Preferably, the shape and size of each sub-area on the surface of the object to be tested are the same, the size and shape of the pattern on each sub-area are also the same, and the pattern of each sub-area corresponds to each other. For example, when the object to be tested is a wafer, the corresponding sub-area can be the area where a single die is located on the wafer.

[0057] The image to be tested is a single-channel grayscale image of the sub-region. Each pixel in the image to be tested uses a grayscale value to represent the color of the pixel. The grayscale value (pixel value) refers to the different degrees of gray at each point on a black-and-white photo or a black-and-white image reproduced by a TV due to the different colors and brightness of each point in the scene. The logarithmic relationship between white and black is divided into several levels, called grayscale levels, which generally range from 0 to 225.

[0058] Preferably, the adjacent sub-regions on the surface of the object are continuous, and multiple adjacent sub-regions on the surface of the object can be detected in sequence based on the detection imaging algorithm to obtain the image to be tested, which can make the obtained image to be tested more representative. The detection imaging algorithm can be a floating point algorithm, an integer method, a shift method, or an average method, and the color image of the sub-region is converted into a corresponding grayscale image to obtain the image to be tested of the sub-region, which is not specifically limited here.

[0059] In the embodiment of the present application, it is also necessary to obtain a reference image (golden image) corresponding to the sub-region, which is used to detect the image to be tested in the sub-region to determine whether a defect occurs in the sub-region. Among them, a reference image corresponding to the image to be tested in the sub-region can be created, and the size and type of the reference image are the same as those of the image to be tested. When the reference image is initially created, the gray value of each pixel in the reference image can be preset to 0, and then the gray value of the pixel position in the reference image is determined by the gray value of the same pixel position in multiple images to be tested, so as to determine the gray value of the pixel corresponding to the pixel position. The same pixel position refers to the corresponding pixel points in multiple images to be tested. Multiple sub-regions are generally repeated regions, and multiple images to be tested have corresponding corresponding relationships. Multiple images to be tested can be aligned to determine the same pixel position of multiple images to be tested. For example, when the surface of the object is a wafer, the sub-region is a grain on the wafer, and the size and color of each grain correspond. The grains can be aligned and overlapped to determine the same pixel position on the grains. For example, the median grayscale value can be taken from multiple grayscale values ​​at the same pixel position as the grayscale value of the pixel position in the reference image. By traversing all pixel positions in the reference image, the grayscale value of each pixel position in the reference image can be determined one by one to generate a reference image.

[0060] 102. Divide the image to be tested into blocks to obtain a plurality of first block images, and divide the reference image into blocks to obtain second block images corresponding to the first block images.

[0061] After obtaining the image to be tested and the reference image, the image to be tested can be divided into blocks to obtain multiple first block images, and the reference image can be divided into blocks to obtain second block images corresponding to the first block images. It can be understood that in the process of dividing the image to be tested into blocks, the image to be tested is divided into multiple small areas, the area of ​​the small area is smaller than the area of ​​the sub-area corresponding to the image to be tested, and each small area corresponds to a first block image; the shape of the multiple first block images can be square or circular, which is not specifically limited here, and the shape and image size of the multiple first block images can be the same or different, which is not specifically limited here. In the block process, different images to be tested can use different block methods, that is, the first block images at the same pixel position after different images to be tested are divided into blocks may be different.

[0062] When the reference image is divided into blocks, it needs to correspond to the first block image of the image to be tested, that is, the shape and size of the second block image corresponding to the first block image at the same pixel position must be the same, and when the image to be tested is aligned with the reference image, the first block image can overlap with the corresponding second block image. That is, when the reference image is divided into blocks, multiple second block images corresponding to the first block image are obtained.

[0063] 103. Based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, update the grayscale value of the pixel of the first block image in the image to be tested to obtain a target image.

[0064] It is understandable that when uneven color difference appears in each sub-region, there will be differences in the corresponding illumination magnitude and illumination distribution in the multiple images to be tested, and there will also be differences in the color difference of the first block image in the image to be tested. At this time, the grayscale value of the pixel point of the first block image in the image to be tested can be updated based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, and the color difference of the multiple first block images in the image to be tested can be corrected to obtain the target image. That is, the block color difference calibration is performed on the image to be tested to obtain the target image.

[0065] Among them, the grayscale value of the first block image and the grayscale value of the corresponding second block image can be a grayscale median or a grayscale average, that is, the grayscale value of each pixel in the first block image can be counted to obtain the grayscale median of the first block image, or the grayscale value of all pixels in the first block image can be divided by the number of pixels to obtain the grayscale average of the first block image; the specific details are not limited here.

[0066] Based on the grayscale value of the first block image and the grayscale value of the second block image corresponding to the first block image, the grayscale adjustment value of the pixel in the first block image can be obtained, the grayscale value of the pixel in the first block image is multiplied by the grayscale adjustment value, the color difference of the pixel in the first block image is offset calibrated, the target grayscale value is used as the updated grayscale value of the pixel, the grayscale value of each pixel in the first block image is updated one by one, and the color difference of the first block image is corrected. It can be understood that the image to be tested in each sub-area uses the same reference image to perform color difference correction on the first block image, that is, for the first block image at the same pixel position of multiple images to be tested, the second block image corresponding to the same pixel position can be used for color difference correction, so that the illumination of each first block image in the multiple images to be tested can be made corresponding, and after the color difference correction, the illumination size and illumination distribution in the multiple target images can be made the same.

[0067] 104. Perform defect detection on the surface of the object based on the target image and the reference image.

[0068] After obtaining the target image, the surface of the object can be inspected for defects based on the target image and the reference image, that is, the target image can be used to detect whether the sub-area corresponding to the target image has defects. Specifically, the target image and the reference image can be differentiated to obtain a differential image; that is, the grayscale values ​​of the target image and the reference image at the same pixel position can be subtracted to obtain the grayscale difference of the pixel position, and the corresponding differential image can be obtained by traversing all pixel positions. Then, the defective pixel area in the target image can be determined based on the differential image. That is, the pixel area identified as defective in the differential image can be determined as the defective pixel area in the target image.

[0069] It can be seen that in the embodiment of the present application, the image to be tested of each sub-region on the surface of the object and the reference image corresponding to the sub-region are obtained; the image to be tested is divided into blocks to obtain multiple first block images, and the reference image is divided into blocks to obtain second block images corresponding to the first block images; based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain the target image; based on the target image and the reference image, the surface of the object is subjected to defect detection. By updating the grayscale value of the first block image in the image to be tested and correcting the color difference of the first block image, the uneven color difference in the image to be tested can be corrected in blocks to obtain the target image. When the target image is used to perform defect detection on the surface of the object, the accuracy of the defect detection result on the surface of the object is effectively improved.

[0070] In the embodiment of the present application, the image to be tested and the reference image can be divided into first and second block images of the same image size according to the image block size, so as to facilitate the use of the first block image and the corresponding second block image when performing chromatic aberration correction, thereby improving the efficiency of chromatic aberration correction. Figure 2 As shown, the specific steps include:

[0071] 201. Generate a reference image based on the grayscale value of the same pixel position in the aligned multiple images to be tested.

[0072] It is understandable that the multiple images to be tested are grayscale images of multiple sub-areas on the surface of the object, and there may be pixel deviations between the multiple images to be tested. In the embodiment of the present application, multiple images to be tested can be translated and aligned; wherein, multiple images to be tested can be template matched to determine the sub-pixel offset between the multiple images to be tested, such as any image to be tested can be selected as a template image (reference image), and other images to be tested can be template matched with the template image, and multiple images to be tested can be translated and aligned based on the sub-pixel offset. After sub-pixel offset alignment, there is no pixel deviation in the alignment of multiple images to be tested. For example, when the object to be tested 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, which is not limited here; the first grain image is selected as the reference image (based on the order of scanning), and the remaining N-1 images are aligned with the first image as the reference.

[0073] Next, the grayscale value of the pixel position in the reference image can be determined based on the grayscale value of the same pixel position in the aligned multiple images to be tested to generate a reference image. Among them, multiple grayscale values ​​of the same pixel position in the aligned multiple images to be tested can be counted, and the grayscale median value of the multiple grayscale values ​​or the grayscale average value of the multiple grayscale values ​​can be used as the grayscale value of the same pixel position in the reference image, which is not limited to the specifics here.

[0074] 202. Obtain image block size based on the image size of the image to be measured.

[0075] In the embodiment of the present application, before the image to be tested is divided into blocks, the image block size can be obtained based on the image size of the image to be tested, and the image block size is used to specify the image size of the first block image and the second block image after the division. It can be understood that the image block size is smaller than the image size of the image to be tested; the image to be tested and the reference image are divided into blocks by the image block size, so that the image size of the first block image in the image to be tested is the same as the image size of the second block image in the reference image, which is more convenient to compare the first block image with the second block image, and to correct the chromatic aberration of the first block image.

[0076] In order to use the image block size to divide the image to be tested into a plurality of first block images, obtaining the image block size may specifically include step 21 and step 22:

[0077] 2021. Get the preset image block size.

[0078] In the embodiment of the present application, a preset image block size can be obtained, that is, the block size of each small area during block division can be preset, wherein the preset image block size is smaller than the image size of the image to be tested; it can be understood that the image to be tested can be a quadrilateral image, the image size of the image to be tested includes an image width w and an image height h, and the corresponding preset image block size is also a quadrilateral size, the preset image block size includes a preset block width Blocksiz_w and a preset block height Blocksiz_h, and the preset image block size is smaller than the image size of the image to be tested, which can be: the preset block width is smaller than the image width of the image to be tested and the preset block height is smaller than the image height of the image to be tested, or the preset block width is smaller than the image width of the image to be tested and the preset block height is equal to the image height of the image to be tested, or the preset block width is equal to the image width of the image to be tested and the preset block height is smaller than the image height of the image to be tested, and the specific details are not limited here.

[0079] For example, when the surface of the object is a wafer surface, the image to be measured is a grain image, and the image width and image height of the grain image are generally greater than 1000 pixels. At this time, the preset image block size can be set to a preset block width and a preset block height of 200 pixels.

[0080] Specifically, the preset image block size can be obtained based on the illumination distribution in the image to be tested. If the illumination distribution is more uniform, the preset image block size is larger; if the illumination distribution is more uneven (dispersed), the preset image block size is smaller. If the color difference between the adjacent multiple pixel points of the image to be tested is smaller, it is determined that the illumination distribution is more uniform. At this time, a larger preset image block size can be set to reduce the number of blocks of the image to be tested and improve the efficiency of color difference correction; if the color difference between the adjacent multiple pixel points of the image to be tested is larger, it is determined that the illumination distribution is more uneven. At this time, a smaller preset image block size can be set to increase the number of blocks of the image to be tested and improve the accuracy of color difference correction; the preset image block size is obtained based on the illumination distribution in the image to be tested, so that the preset image block size can be made to conform to the illumination distribution in the image to be tested, and color difference correction can be performed more targeted.

[0081] 2022. Update the preset image block size based on the image size of the image to be tested to obtain the image block size.

[0082] After obtaining the preset image block size, the preset image block size can be updated based on the image size of the image to be tested to obtain the image block size; the image to be tested is evenly divided into multiple first block images to avoid blocks with too small size, so as to more accurately perform chromatic aberration correction on the first block images of the image to be tested.

[0083] Preferably, when updating the preset image block size, the image size of the image to be tested can be made an integer multiple of the image block size by rounding operation, so that when the image to be tested is blocked based on the image block size, the image to be tested can be evenly blocked. Specifically, based on the image width w of the image to be tested and the preset block width Blocksize_w of the preset image block size, the number of width blocks Block_w of the image to be tested can be determined; that is, the image width w of the image to be tested can be divided by the preset block width Blocksize_w of the preset image block size to obtain a width quotient; the width quotient is rounded to obtain the number of width blocks of the image to be tested, that is, the number of width blocks can be calculated as Block_w=w / Blocksize_w, and if the obtained number of width blocks is not an integer, it is rounded down. Based on the image height h of the image to be tested and the preset block height Blocksize_h of the preset image block size, the height block number Block_h of the image to be tested is determined; that is, the height block number Block_h can be calculated as h / Blocksize_h. If the obtained height block number is not an integer, it is rounded down.

[0084] Next, the target image block width Blocksize_w-new can be obtained based on the image width w of the image to be measured and the number of width blocks Block_w, that is, Blocksize_w-new=w / Block_w. If the obtained target image block width is not an integer, it is rounded up. Based on the image height h of the image to be measured and the number of height blocks Block_h, the target image block height Blocksize_h-new can be obtained, that is, Blocksize_h-new=h / Block_h. If the obtained target image block height is not an integer, it is rounded up. The image block size is obtained based on the target image block width and the target image block height, that is, the block width of the image block size is set to the target image block width, and the block height of the image block size is set to the target image block height.

[0085] In an implementable manner, if the preset block width Blocksiz_w in the preset image block size is less than 1 pixel, or the preset block height Blocksiz_h is less than 1 pixel, in order to facilitate the subsequent update of the grayscale value of the pixel point in the first block image, the preset block width Blocksiz_w can be set to 1 pixel or the preset block height Blocksiz_h can be set to 1 pixel. At this time, the block width or block height of the image block size can be directly determined to be 1 pixel. That is, when Blocksize_w is less than 1 pixel, Blocksize_w-new=1; when Blocksize_h is less than 1, Blocksize_h-new=1 pixel.

[0086] It can be understood that the image block size is used to block the image to be tested, and the image block size needs to be smaller than the image size of the image to be tested. Therefore, if the preset block width Blocksiz_w in the preset image block size is greater than the image width w of the image to be tested, the block width of the image block size can be directly determined as the image width w of the image to be tested; if the preset block height Blocksiz_h in the preset image block size is greater than the image height h of the image to be tested, the block height of the image block size can be directly determined as the image height h of the image to be tested.

[0087] 203 . Divide the image to be tested and the reference image into blocks based on image block sizes to obtain a plurality of first block images and second block images corresponding to the first block images.

[0088] After obtaining the image block size, the image to be tested and the reference image can be divided into blocks based on the image block size to obtain multiple first block images and second block images corresponding to the first block images; wherein the image size of the first block images and the corresponding second block images is the same as the image block size.

[0089] That is, the image to be tested can be divided into small areas of Blocksize_w-new*Blocksize_h-new, and the reference image can also be divided into small areas of Blocksize_w-new*Blocksize_h-new. When dividing the image to be tested into blocks, the blocks can be divided from the image edge of the image to be tested based on the image block size, or from the image center of the image to be tested, which is not limited here.

[0090] 204. Based on the average grayscale value of the first block image and the corresponding average grayscale value of the second block image, update the grayscale value of the pixel points of the first block image in the image to be tested to obtain a target image.

[0091] After the first block image and the second block image are obtained by block division, the grayscale value of the pixel points of the first block image in the image to be tested can be updated based on the average grayscale value of the first block image and the average grayscale value of the corresponding second block image to obtain the target image. Wherein, when updating the pixel points of the first block image in the image to be tested, the pixel points of the first block images contained in the image to be tested can be updated, that is, the first block images contained in the image to be tested can be all chromatic aberration corrected, and the chromatic aberration correction is performed comprehensively on multiple first block images in the image to be tested to improve the accuracy of chromatic aberration correction, as shown in step 2041; it is also possible to only perform chromatic aberration correction on the first block image with larger chromatic aberration in the image to be tested, and perform chromatic aberration correction on the first block image in the image to be tested in a targeted manner to improve the efficiency of chromatic aberration correction, as shown in step 2042.

[0092] 2041. Update the grayscale value of each pixel of the first sub-block image in the image to be tested.

[0093] In the embodiment of the present application, the grayscale ratio between the average grayscale value of the first block image and the average grayscale value of the corresponding second block image can be obtained; wherein, the average grayscale value Ls of the first block image is obtained by dividing the grayscale value of all pixels in the first block image by the total number of pixels in the first block image; the grayscale average value Ls of each first block image in the image to be tested can be obtained, the grayscale average value Lg of each second block image in the reference image can be obtained, and the grayscale ratio Lg / Ls between the grayscale average value Ls of the first block image and the grayscale average value Ls of the corresponding second block image can be obtained, and the grayscale ratio is the grayscale adjustment value of the pixel.

[0094] Based on the grayscale ratio, the grayscale value of the pixel in each first block image is updated to obtain the target image. Specifically, the grayscale value of each pixel in the first block image can be multiplied by the grayscale ratio to obtain the product of the grayscale values; the grayscale value of the pixel in each first block image is updated to the product of the grayscale values ​​corresponding to the pixel to obtain the target image. That is, the grayscale value of each pixel in the first block image is updated to: I*Lg / Ls, where I is the grayscale value before the pixel is updated. When the grayscale values ​​of the pixels in each first block image in the image to be tested are updated, the target image is obtained. By updating the grayscale values ​​of the pixels in each first block image in the image to be tested, the chromatic aberration of multiple first block images in the image to be tested is comprehensively corrected to improve the accuracy of chromatic aberration correction.

[0095] 2042. Update the grayscale values ​​of the pixels of the first sub-block image in the image to be tested based on a preset grayscale threshold.

[0096] In an embodiment of the present application, a first block image with a larger color difference can be selected from the image to be tested based on a preset grayscale threshold, and only the first block image with a larger color difference in the image to be tested is updated. Specifically, the grayscale difference between the average grayscale value of the first block image and the average grayscale value of the corresponding second block image can be obtained. If the grayscale difference is greater than the preset grayscale threshold, it can be determined as the first block image with a larger color difference, and the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain the target image. By performing color difference correction only on the first block image with a larger color difference in the image to be tested, the color difference correction is performed on the first block image in the image to be tested in a targeted manner, thereby improving the efficiency of color difference correction.

[0097] 205. Perform defect detection on the surface of the object based on the target image and the reference image.

[0098] It is understandable that step 205 is similar to the above step 104, and the details are not repeated here.

[0099] The present application embodiment provides an image detection device, such as Figure 3 As shown, including:

[0100] An acquisition unit 301 is used to acquire an image to be measured of each sub-region on the surface of an object, and acquire a reference image corresponding to the sub-region;

[0101] A blocking unit 302 is used to block the image to be tested to obtain a plurality of first blocked images, and block the reference image to obtain second blocked images corresponding to the first blocked images;

[0102] An updating unit 303, configured to update the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image, so as to obtain a target image;

[0103] The detection unit 304 is used to perform defect detection on the surface of the object based on the target image and the reference image.

[0104] Furthermore, the blocking unit 302 is specifically used to obtain an image blocking size based on the image size of the image to be tested; and to block the image to be tested and the reference image based on the image blocking size to obtain multiple first blocking images and second blocking images corresponding to the first blocking images.

[0105] Furthermore, the updating unit 303 is specifically used to obtain the grayscale ratio between the average grayscale value of the first block image and the average grayscale value of the corresponding second block image; based on the grayscale ratio, the grayscale value of each pixel in the first block image is updated to obtain the target image.

[0106] Furthermore, the updating unit 303 is specifically used to obtain the grayscale difference between the average grayscale value of the first block image and the average grayscale value of the corresponding second block image; if the grayscale difference is greater than the preset grayscale threshold, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain the target image.

[0107] The present application also provides an image detection device 400, such as Figure 4 As shown, the image detection device 400 of the embodiment of the present application may include one or more central processing units (CPU) 401 and a memory 402 , in which one or more application programs or data are stored.

[0108] The memory 402 may be a volatile storage or a persistent storage. The program stored in the memory 402 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Furthermore, the central processing unit 401 may be configured to communicate with the memory 402 and execute a series of instruction operations in the memory 402 on the image detection device 400.

[0109] The image detection device 400 may also include one or more power supplies 405, one or more wired or wireless network interfaces 404, one or more input and output interfaces 403, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0110] The central processing unit 401 can execute the operations performed by any of the above-mentioned specific method embodiments, and the details will not be repeated here.

[0111] 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 aforementioned method embodiments and will not be repeated here.

[0112] In the 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 only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

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

[0115] If the 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 is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. An image detection method, characterized in that: include: Acquire an image to be measured of each sub-region on the surface of the object, and acquire a reference image corresponding to the sub-region; Divide the image to be tested into blocks to obtain a plurality of first block images, and divide the reference image into blocks to obtain second block images corresponding to the first block images; Based on the grayscale value of the first block image and the grayscale value of the corresponding second block image, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain a target image; Perform defect detection on the surface of the object based on the target image and the reference image; The updating of the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image to obtain the target image comprises: Obtaining a grayscale ratio between an average grayscale value of the first block image and an average grayscale value of the corresponding second block image; Multiplying the grayscale value of each pixel in the first block image by the grayscale ratio to obtain the product of the grayscale values; The grayscale value of each pixel in the first block image is updated to the product of the grayscale values ​​corresponding to the pixel to obtain the target image.

2. The image detection method according to claim 1, characterized in that: Acquiring a reference image corresponding to the sub-region includes: Performing translation alignment on the plurality of images to be tested; Based on the grayscale values ​​of the same pixel position in the aligned multiple images to be tested, the grayscale value of the same pixel position in the reference image is determined to generate the reference image.

3. The image detection method according to claim 1, characterized in that: The step of dividing the image to be tested into blocks to obtain a plurality of first block images, and dividing the reference image into blocks to obtain second block images corresponding to the first block images comprises: Acquire the image block size based on the image size of the image to be measured; The image to be tested and the reference image are respectively divided into blocks based on the image block size to obtain a plurality of first block images and second block images corresponding to the first block images.

4. The image detection method according to claim 3, characterized in that: The obtaining of the image block size based on the image size of the image to be measured comprises: Obtaining a preset image block size, wherein the preset image block size is smaller than the image size of the image to be tested; The preset image block size is updated based on the image size of the image to be measured to obtain the image block size.

5. The image detection method according to claim 4, characterized in that: The image size of the image to be tested includes image width and image height, and the preset image block size includes preset block width and preset block height; The updating of the preset image block size based on the image size of the image to be tested to obtain the image block size comprises: Determine the number of width blocks of the image to be tested based on the image width of the image to be tested and the preset block width of the preset image block size; determine the number of height blocks of the image to be tested based on the image height of the image to be tested and the preset block height of the preset image block size; Based on the image width of the image to be tested and the number of width blocks, the target image block width is obtained; based on the image height of the image to be tested and the number of height blocks, the target image block height is obtained; based on the target image block width and the target image block height, the image block size is obtained.

6. The image detection method according to claim 5, characterized in that: The determining the number of width blocks of the image to be tested based on the image width of the image to be tested and the preset block width of the preset image block size comprises: Dividing the image width of the image to be tested by the preset block width of the preset image block size to obtain a width quotient value; The width quotient is rounded to an integer to obtain the number of width blocks of the image to be tested.

7. The image detection method according to claim 4, characterized in that: The step of obtaining a preset image block size includes: Based on the illumination distribution in the image to be tested, the preset image block size is set; if the illumination distribution is more uniform, the preset image block size is set to be larger, and if the illumination distribution is more dispersed, the preset image block size is set to be smaller; If the color difference between the adjacent pixels of the image to be tested is smaller, it is determined that the illumination distribution is more uniform; if the color difference between the adjacent pixels of the image to be tested is larger, it is determined that the illumination distribution is more dispersed.

8. The image detection method according to claim 1, characterized in that: The updating of the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image to obtain the target image comprises: Obtaining a grayscale difference between an average grayscale value of the first block image and an average grayscale value of the corresponding second block image; If the grayscale difference is greater than a preset grayscale threshold, the grayscale values ​​of the pixels of the first block image in the image to be tested are updated to obtain the target image.

9. The image detection method according to claim 1, characterized in that: The performing defect detection on the surface of the object based on the target image and the reference image comprises: Performing image difference between the target image and the reference image to obtain a difference image; A defective pixel area in the target image is determined based on the differential image.

10. An image detection device, characterized in that: include: An acquisition unit, used to acquire an image to be measured of each sub-region on the surface of the object, and to acquire a reference image corresponding to the sub-region; A blocking unit, configured to block the image to be tested to obtain a plurality of first blocked images, and block the reference image to obtain second blocked images corresponding to the first blocked images; An updating unit, configured to update the grayscale values ​​of the pixels of the first block image in the image to be tested based on the grayscale values ​​of the first block image and the corresponding grayscale values ​​of the second block image, so as to obtain a target image; A detection unit, configured to perform defect detection on the surface of the object based on the target image and the reference image; The updating unit is specifically used to obtain a grayscale ratio between an average grayscale value of the first block image and an average grayscale value of the corresponding second block image; multiply the grayscale value of each pixel in the first block image by the grayscale ratio to obtain a product of the grayscale values; The grayscale value of each pixel in the first block image is updated to the product of the grayscale values ​​corresponding to the pixel to obtain the target image.

11. The image detection device according to claim 10, characterized in that: The blocking unit is specifically used to obtain an image blocking size based on the image size of the image to be tested; and to block the image to be tested and the reference image based on the image blocking size to obtain a plurality of first blocking images and second blocking images corresponding to the first blocking images.

12. The image detection device according to claim 10, characterized in that: The updating unit is specifically used to obtain the grayscale difference between the average grayscale value of the first block image and the average grayscale value of the corresponding second block image; if the grayscale difference is greater than a preset grayscale threshold, the grayscale value of the pixel point of the first block image in the image to be tested is updated to obtain the target image.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes instructions, and when the instructions are executed by a processor on a computer, the image detection method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Image brightness adjustment method, computer program product, electronic device and medium

    CN115082291A

  • Image processing method, electronic equipment and storage medium

    CN116777767A

  • Image detection method and detection device, and storage medium

    CN117392046A