Defect detection method, defect detection device, electronic equipment and storage medium

文档序号:1506356 发布日期:2020-02-07 浏览:19次 中文

阅读说明:本技术 缺陷检测方法、装置、电子设备以及存储介质 (Defect detection method, defect detection device, electronic equipment and storage medium ) 是由 刘小磊 王云奇 彭项君 赵晨曦 楚明磊 陈丽莉 于 2019-10-29 设计创作,主要内容包括:本发明公开了一种缺陷检测方法、装置、电子设备以及存储介质,包括:基于背景图像对目标图像进行矫正;将矫正后的所述目标图像分割成多个局部区域,对每个所述局部区域进行局部增强处理;对局部增强处理后的所述目标图像进行全局增强处理,对全局增强处理后的所述目标图像进行二值化分割,以提取出二值化待测区域的轮廓;根据所述二值化待测区域的轮廓,计算所述二值化待测区域在所述目标图像中的相对灰度,从而根据所述相对灰度进行缺陷检测。本发明通过局部增强处理和全局增强处理,能够有效地对大面积的暗缺陷进行提取,从而准确地进行缺陷检测。(The invention discloses a defect detection method, a defect detection device, electronic equipment and a storage medium, wherein the defect detection method comprises the following steps: correcting the target image based on the background image; dividing the corrected target image into a plurality of local areas, and performing local enhancement processing on each local area; carrying out global enhancement processing on the target image subjected to the local enhancement processing, and carrying out binarization segmentation on the target image subjected to the global enhancement processing so as to extract the outline of a binarization region to be detected; and calculating the relative gray scale of the binaryzation to-be-detected area in the target image according to the outline of the binaryzation to-be-detected area, so as to detect the defect according to the relative gray scale. According to the invention, through local enhancement processing and global enhancement processing, large-area dark defects can be effectively extracted, so that defect detection can be accurately carried out.)

1. A method of defect detection, comprising:

correcting the target image based on the background image;

dividing the corrected target image into a plurality of local areas, and performing local enhancement processing on each local area;

carrying out global enhancement processing on the target image subjected to the local enhancement processing, and carrying out binarization segmentation on the target image subjected to the global enhancement processing so as to extract the outline of a binarization region to be detected;

and calculating the relative gray scale of the binaryzation to-be-detected area in the target image according to the outline of the binaryzation to-be-detected area, so as to detect the defect according to the relative gray scale.

2. The defect detection method of claim 1, wherein performing the local enhancement processing on each of the local regions comprises:

enhancing each local image by histogram equalization;

and carrying out bilinear interpolation on the boundary of the local area.

3. The defect detection method according to claim 1, further comprising, before dividing the corrected target image into a plurality of local regions:

performing de-texture processing on the corrected target image by using minimum filtering;

and smoothing the target image after the texture removal processing.

4. The defect detection method according to claim 1, wherein performing binarization segmentation on the target image after global enhancement processing to extract a contour of a binarized region to be detected comprises:

performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram;

determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram;

and performing binarization segmentation on the target image subjected to global enhancement processing based on the binarization threshold value to obtain a binarization image, and extracting the outline of the binarization to-be-detected region from the binarization image.

5. The defect detection method according to claim 1, wherein calculating a relative gray level of the binarized region-to-be-detected in the target image based on the contour of the binarized region-to-be-detected, thereby performing defect detection based on the relative gray level, comprises:

generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area;

matching a detection area corresponding to the position of the external rectangle from the target image so as to match a to-be-detected area and a non-defect area in the detection area;

and calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, so as to detect the defect according to the relative gray value.

6. The defect detection method of claim 5, wherein calculating a relative gray value according to the gray value of the region to be detected in the detection area and the gray value of the non-defect area comprises:

calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively;

and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region.

7. The defect detection method of claim 5, wherein performing defect detection based on the relative gray scale values comprises:

if the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region;

and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect.

8. The defect detection method of claim 1, wherein the rectifying the target image based on the background image comprises:

for each pixel point in the target image, the following method is adopted for correction:

performing gray level normalization on the pixel points according to the gray values of the pixel points at the corresponding positions of the pixel points in the background image;

and stretching the pixel points after the gray level normalization.

9. A defect detection apparatus, comprising:

a rectification module configured to rectify a target image based on a background image;

a local enhancement module configured to segment the rectified target image into a plurality of local regions, and perform local enhancement processing on each local region;

the global enhancement module is configured to perform global enhancement processing on the target image after the local enhancement processing, and perform binarization segmentation on the target image after the global enhancement processing so as to extract the outline of a binarization region to be detected;

and the detection module is configured to calculate the relative gray scale of the binarization area to be detected in the target image according to the outline of the binarization area to be detected, so as to detect defects according to the relative gray scale.

10. An electronic device comprising a processor and a memory, the memory storing computer instructions, wherein the computer instructions, when executed by the processor, perform the defect detection method of any one of claims 1-8.

11. A storage medium storing computer instructions adapted to be executed by a processor, the computer instructions, when executed by the processor, performing a defect detection method according to any one of claims 1-8.

Technical Field

The present invention relates to the field of image processing technologies, and in particular, to a defect detection method and apparatus, an electronic device, and a storage medium.

Background

With the increasing complexity of semiconductor process flow, the requirements of each link in the middle of the production of the liquid crystal screen on the process are higher and higher, if a certain process flow does not meet the preset requirements, the defect similar to 'dirty' feeling can occur, and the defect is characterized in that: the area is large and is distributed in each place of the whole screen; the contrast is low, and the human eyes are difficult to accurately identify; the shapes are different and there is no clear shape. These screen defects have a great influence on the perception of human eyes, especially on the viewing experience of dynamic scenes. For process improvement, the first step is to detect all defects on the screen.

The existing defect detection method can only detect the defect with high contrast, but can not effectively and completely extract the outline of the dark defect with large area and low contrast, so that the detection result is inaccurate.

Disclosure of Invention

In view of the above, an object of the present invention is to provide a defect detection method, apparatus, electronic device and storage medium, so as to solve the technical problems in the prior art.

According to a first aspect of the present invention, there is provided a defect detection method comprising:

correcting the target image based on the background image;

dividing the corrected target image into a plurality of local areas, and performing local enhancement processing on each local area;

carrying out global enhancement processing on the target image subjected to the local enhancement processing, and carrying out binarization segmentation on the target image subjected to the global enhancement processing so as to extract the outline of a binarization region to be detected;

and calculating the relative gray scale of the binaryzation to-be-detected area in the target image according to the outline of the binaryzation to-be-detected area, so as to detect the defect according to the relative gray scale.

In some embodiments of the present invention, the local enhancement processing is performed on each of the local regions, and includes:

enhancing each local image by histogram equalization;

and carrying out bilinear interpolation on the boundary of the local area.

In some embodiments of the present invention, before segmenting the rectified target image into a plurality of local regions, the method further includes:

performing de-texture processing on the corrected target image by using minimum filtering;

and smoothing the target image after the texture removal processing.

In some embodiments of the present invention, performing binarization segmentation on the target image after global enhancement processing to extract a contour of a binarized region to be measured, includes:

performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram;

determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram;

and performing binarization segmentation on the target image subjected to global enhancement processing based on the binarization threshold value to obtain a binarization image, and extracting the outline of the binarization to-be-detected region from the binarization image.

In some embodiments of the present invention, calculating a relative gray scale of the binarized region-to-be-detected in the target image according to the contour of the binarized region-to-be-detected, so as to perform defect detection according to the relative gray scale, includes:

generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area;

matching a detection area corresponding to the position of the external rectangle from the target image so as to match a to-be-detected area and a non-defect area in the detection area;

and calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, so as to detect the defect according to the relative gray value.

In some embodiments of the present invention, calculating a relative gray-scale value according to the gray-scale value of the region to be detected in the detection region and the gray-scale value of the non-defect region includes:

calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively;

and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region.

In some embodiments of the present invention, performing defect detection according to the relative gray-scale values comprises:

if the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region;

and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect.

In some embodiments of the invention, rectifying the target image based on the background image comprises:

for each pixel point in the target image, the following method is adopted for correction:

performing gray level normalization on the pixel points according to the gray values of the pixel points at the corresponding positions of the pixel points in the background image;

and stretching the pixel points after the gray level normalization.

According to a second aspect of the present invention, there is provided a defect detecting apparatus comprising:

a rectification module configured to rectify a target image based on a background image;

a local enhancement module configured to segment the rectified target image into a plurality of local regions, and perform local enhancement processing on each local region;

the global enhancement module is configured to perform global enhancement processing on the target image after the local enhancement processing, and perform binarization segmentation on the target image after the global enhancement processing so as to extract the outline of a binarization region to be detected;

and the detection module is configured to calculate the relative gray scale of the binarization area to be detected in the target image according to the outline of the binarization area to be detected, so as to detect defects according to the relative gray scale.

In some embodiments of the invention, the local boost module is further configured to:

enhancing each local image by histogram equalization;

and carrying out bilinear interpolation on the boundary of the local area.

In some embodiments of the invention, the local boost module is further configured to:

before the corrected target image is divided into a plurality of local areas, performing de-texture processing on the corrected target image by using minimum value filtering;

and smoothing the target image after the texture removal processing.

In some embodiments of the invention, the global augmentation module is further configured to:

performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram;

determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram;

and performing binarization segmentation on the target image subjected to global enhancement processing based on the binarization threshold value to obtain a binarization image, and extracting the outline of the binarization to-be-detected region from the binarization image.

In some embodiments of the invention, the detection module is further configured to:

generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area;

matching a detection area corresponding to the position of the external rectangle from the target image so as to match a to-be-detected area and a non-defect area in the detection area;

and calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, so as to detect the defect according to the relative gray value.

In some embodiments of the invention, the detection module is further configured to:

calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively;

and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region.

In some embodiments of the invention, the detection module is further configured to:

if the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region;

and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect.

In some embodiments of the invention, the orthotic module is further configured to: for each pixel point in the target image, the following method is adopted for correction:

performing gray level normalization on the pixel points according to the gray values of the pixel points at the corresponding positions of the pixel points in the background image;

and stretching the pixel points after the gray level normalization.

According to a third aspect of the present invention, there is provided an electronic device comprising a processor and a memory, the memory storing computer instructions, wherein the computer instructions, when executed by the processor, perform the defect detection method described in any of the above embodiments.

According to a fourth aspect of the present invention, there is provided a storage medium storing computer instructions adapted to be executed by a processor, the computer instructions, when executed by the processor, performing a defect detection method according to any of the above embodiments.

The defect detection method and the defect detection device provided by the embodiment of the invention can effectively extract the large-area dark defect through local enhancement processing and global enhancement processing, thereby accurately detecting the defect and overcoming the technical problems of low contrast of the dark defect and incapability of identifying human eyes. Therefore, the defect detection method provided by the embodiment of the invention can accurately detect the defects on the screen, is particularly suitable for detecting the dark defects with large area and low contrast, and provides reliable basis for subsequent process improvement and yield improvement.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.

FIG. 1 is a flow chart of a defect detection method according to an embodiment of the present invention;

FIG. 2 is a schematic diagram of a circumscribed rectangle in an embodiment of the invention;

FIG. 3 is a flow chart of a defect detection method according to another embodiment of the present invention;

FIG. 4 is an image of a target image after stretching in an embodiment of the present invention;

FIG. 5 is an image after de-texturing and smoothing a target image according to an embodiment of the present invention;

FIG. 6 is a diagram illustrating an image after local enhancement processing and bilinear interpolation are performed on a target image according to an embodiment of the present invention;

FIG. 7 is an image after global enhancement processing is performed on a target image in an embodiment of the present invention;

FIG. 8 is an image after binarization segmentation is performed on a target image according to an embodiment of the present invention;

FIG. 9 shows the result of defect detection on a target image according to an embodiment of the present invention;

FIG. 10 is a schematic structural diagram of a defect detection apparatus according to an embodiment of the present invention;

fig. 11 is a schematic diagram of an internal structure of an electronic device according to an embodiment of the present invention.

Detailed Description

In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

In an embodiment of the present invention, as shown in fig. 1, an embodiment of the present invention provides a defect detection method, including:

step 101, rectifying a target image based on a background image.

Firstly, a screen to be detected is lightened, and the screen to be detected is shot by an industrial camera according to a certain sampling rate to obtain a target image. Then, the white paper or the white board is shot by an industrial camera to obtain a background image. Note that attention is paid to removing the influence of moire or the like on the detection result when capturing an image. The moire removing operation can be performed on the image after the image is shot so as to avoid the influence on the detection result. It should be noted that, in the embodiment of the present invention, both the target image and the background image are binarized images.

In step 101, for each pixel point in the target image, based on the corresponding pixel point in the background image, normalization and stretching are performed, thereby completing the correction of the target image.

Optionally, for each pixel point in the target image, the following method is adopted for correction:

performing gray level normalization on the pixel points according to the gray values of the pixel points at the corresponding positions of the pixel points in the background image; and stretching the pixel points after the gray level normalization.

Optionally, for each pixel point in the target image, performing gray level normalization by using the following formula:

Pixcorrection=PixTarget/PixBackground

Wherein, PixCorrectionNormalized gray value, PixTargetFor the ith pixel point in the target image,PixbackgroundIs the ith pixel point in the background image.

Alternatively, multiplying the normalized gray scale value by 255 may stretch the target image by a total of 256 gray scale levels from 0 to 255.

Step 102, dividing the corrected target image into a plurality of local areas, and performing local enhancement processing on each local area.

Optionally, before step 102, further comprising: performing de-texture processing on the corrected target image by using minimum filtering; and smoothing the target image after the texture removal processing. Optionally, the rectified target image is subjected to a convolution de-texturing operation by using minimum value filtering (such as a convolution kernel of 3 × 3 or 5 × 5), so as to remove pixel textures of the target image, and simultaneously retain defects in the target image. After the texture removing operation, the target image is subjected to Gaussian filtering once, so that the image can be further smoothed.

Optionally, in step 102, the target image is segmented into a plurality of local regions according to the size W × H of the target image. For example, the target image is segmented into local regions of 5 × 5, 8 × 8, 10 × 10, or the like. Then, the enhancement processing is performed on each local region, so as to avoid the non-uniformity of the image being highlighted after the global enhancement processing is performed on the target image, and the defects cannot be accurately extracted by a segmentation algorithm performed later. Optionally, histogram equalization may be adopted to perform enhancement processing on each local image separately.

Because each local region is subjected to enhancement processing, so that (W/8) × (H/8) local regions are inevitably generated on an image, bilinear interpolation is required to be carried out on the boundary of each local region, and the phenomenon of image 'gridding' caused by the region segmentation processing is eliminated.

And 103, carrying out global enhancement processing on the target image subjected to the local enhancement processing, and carrying out binarization segmentation on the target image subjected to the global enhancement processing so as to extract the outline of the binarization area to be detected.

The target image after the local enhancement processing can be subjected to global enhancement processing by histogram equalization so as to highlight the defects in the target image, but the background in the target image is not affected.

Optionally, a maximum entropy threshold segmentation method is adopted to perform binarization segmentation on the target image after the global enhancement processing so as to extract the outline of the binarization to-be-detected region. Specifically, the method may include: performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram; determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram; and performing binarization segmentation on the target image subjected to global enhancement processing based on the binarization threshold value to obtain a binarization image, and extracting the outline of the binarization to-be-detected region from the binarization image.

Optionally, before step 103, further comprising: and performing Fast Fourier Transform (FFT) and Inverse Fast Fourier Transform (IFFT) on the target image after the local enhancement processing. Specifically, information in the image frequency domain is obtained, filtering is carried out by using a band-pass filter in the frequency domain, high-frequency noise of the image is eliminated, low-frequency information of the image is suppressed, and the processed image can be better subjected to defect extraction.

And 104, calculating the relative gray level of the binarization to-be-detected area in the target image according to the outline of the binarization to-be-detected area, thereby detecting the defect according to the relative gray level.

It should be noted that there may be a plurality of defects on the screen to be detected, so the outlines of a plurality of binarized regions to be detected can be extracted through step 103, and for each binarized region to be detected, defect detection is performed through step 104.

Optionally, step 104 comprises: generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area; matching a detection area corresponding to the position of the external rectangle from the target image so as to match a to-be-detected area and a non-defect area in the detection area; and calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, so as to detect the defect according to the relative gray value. In the embodiment of the invention, for each binarized region to be measured, a circumscribed rectangle is generated outside the binarized region to be measured, so that only one binarized region to be measured is in each circumscribed rectangle. Optionally, the length and the width of the binarized region to be measured may be respectively lengthened by 10% as the length and the width of the circumscribed rectangle, or may be respectively lengthened by 8% as the length and the width of the circumscribed rectangle, or may be respectively lengthened by 15% as the length and the width of the circumscribed rectangle, which is not limited in this embodiment of the present invention. After the circumscribed rectangle is generated, a non-defect area and an area to be detected in the circumscribed rectangle are found in the original target image. According to the embodiment of the invention, the non-defect area in the original target image is matched through the external rectangle, so that the interference of the defect in the external rectangle is eliminated, and the interference of other adjacent defects is eliminated.

Optionally, calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, including: calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively; and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region. As shown in FIG. 2, assume that the average gray-scale value of the region to be measured found in the original target image is C1The average gray value of the non-defect area found in the original target image is C2Then the following formula can be used to calculate the relative gray-scale value Cx

Relative gray value Cx=|C1-C2|/C2

Optionally, performing defect detection according to the relative gray value includes: if the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region; and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect. Can also preFirst, a first gray threshold X and a second gray threshold Y are set, and then, for each region to be measured extracted in step 103, if the relative gray value C of the region to be measured is the same as the gray value C of the region to be measuredxIf less than X, judging the region to be detected as non-defect, if the relative gray value C of the region to be detectedxIf the detected area is larger than Y, the area to be detected is judged to be a defect.

The defect detection method provided by the embodiment of the invention can effectively extract the large-area dark defect through local enhancement processing and global enhancement processing, thereby accurately detecting the defect and overcoming the technical problems that the contrast of the dark defect is low and the human eyes cannot distinguish. Therefore, the defect detection method provided by the embodiment of the invention can accurately detect the defects on the screen, is particularly suitable for detecting the dark defects with large area and low contrast, and provides reliable basis for subsequent process improvement and yield improvement.

As another embodiment of the present invention, as shown in fig. 3, the defect detecting method may include the steps of:

step 301, performing gray level normalization on the target image based on the background image.

And for each pixel point in the target image, carrying out gray level normalization on the pixel point according to the gray level value of the pixel point at the corresponding position of the pixel point in the background image. Optionally, the following formula is used for gray level normalization:

Pixcorrection=PixTarget/PixBackground

Wherein, PixCorrectionNormalized gray value, PixTargetIs the ith pixel point, Pix, in the target imageBackgroundIs the ith pixel point in the background image.

And 302, stretching the target image after the gray level normalization.

The normalized gray value is multiplied by 255 to stretch the target image by 256 gray levels as shown in fig. 4.

And 303, performing de-texture processing on the corrected target image by using minimum filtering, and performing smoothing processing on the de-texture processed target image.

Optionally, the rectified target image is subjected to a convolution de-texturing operation by using minimum value filtering (such as a convolution kernel of 3 × 3 or 5 × 5), so as to remove pixel textures of the target image, and simultaneously retain defects in the target image. The de-texturing operation is followed by a gaussian filtering of the target image to further smooth the image, as shown in fig. 5.

And 304, dividing the smoothed target image into a plurality of local areas, respectively performing enhancement processing on each local area by histogram equalization, and performing bilinear interpolation on the boundary of each local area.

Firstly, dividing a target image into a plurality of local areas according to the size W x H of the target image; then, each local area is subjected to enhancement processing by histogram equalization, so that defects can be accurately extracted in the subsequent steps; finally, bilinear interpolation is performed on the boundary of each local area to eliminate the image 'grid' phenomenon, as shown in fig. 6.

And 305, performing fast Fourier transform and inverse fast Fourier transform on the target image after bilinear interpolation.

And step 306, performing global enhancement processing on the target image after the inverse fast Fourier transform.

Histogram equalization may be used to perform global enhancement processing on the target image after the ifft to highlight defects in the target image, as shown in fig. 7.

And 307, performing binarization segmentation on the target image subjected to the global enhancement by adopting a maximum entropy threshold segmentation method to extract the outline of the binarization to-be-detected region.

Specifically, the method may include: performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram; determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram; and performing binarization segmentation on the target image subjected to the global enhancement processing based on the binarization threshold value to obtain a binarization image, as shown in fig. 8, and then extracting the outline of the binarization to-be-detected region from the binarization image.

And 308, generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area.

For each binarization to-be-detected area, a circumscribed rectangle is generated outside the binarization to-be-detected area, so that only one binarization to-be-detected area exists in each circumscribed rectangle. Optionally, the length and the width of the binarized region to be measured are respectively lengthened by 10% to be used as the length and the width of the circumscribed rectangle.

Step 309, matching a detection area corresponding to the position of the circumscribed rectangle from the target image, thereby matching a region to be detected and a non-defect region in the detection area.

After the circumscribed rectangle is generated, a non-defect area and an area to be detected in the circumscribed rectangle are found in the original target image. According to the embodiment of the invention, the non-defect area in the original target image is matched through the external rectangle, so that the interference of the defect in the external rectangle is eliminated, and the interference of other adjacent defects is eliminated.

And 310, calculating a relative gray value according to the gray value of the region to be detected in the detection area and the gray value of the non-defect area, so as to detect the defect according to the relative gray value.

Calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively; and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region. As shown in FIG. 2, assume that the average gray-scale value of the region to be measured found in the original target image is C1The average gray value of the non-defect area found in the original target image is C2Then the following formula can be used to calculate the relative gray-scale value Cx

Relative gray value Cx=|C1-C2|/C2

If the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region; and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect.

There may be a plurality of defects on the screen to be detected, so the outlines of a plurality of binarized regions to be detected can be extracted through step 307, and for each binarized region to be detected, the step 308-310 is adopted to perform defect detection, and the detection result is shown in fig. 9.

In one embodiment, as shown in fig. 10, a defect detection apparatus is provided, the defect detection apparatus 1000 comprising a rectification module 1001, a local enhancement module 1002, a global enhancement module 1003, and a detection module 1004. Wherein the rectification module 1001 is configured to rectify the target image based on the background image; the local enhancement module 1002 is configured to segment the rectified target image into a plurality of local regions, and perform local enhancement processing on each local region; the global enhancement module 1003 is configured to perform global enhancement processing on the target image after the local enhancement processing, and perform binarization segmentation on the target image after the global enhancement processing to extract a contour of a binarization region to be detected; the detection module 1004 is configured to calculate a relative gray scale of the binarized region-to-be-detected in the target image according to the contour of the binarized region-to-be-detected, so as to perform defect detection according to the relative gray scale.

In some embodiments of the invention, the local boost module 1002 is further configured to:

enhancing each local image by histogram equalization;

and carrying out bilinear interpolation on the boundary of the local area.

In some embodiments of the invention, the local boost module 1002 is further configured to:

before the corrected target image is divided into a plurality of local areas, performing de-texture processing on the corrected target image by using minimum value filtering;

and smoothing the target image after the texture removal processing.

In some embodiments of the invention, the global boost module 1003 is further configured to:

performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram;

determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram;

and performing binarization segmentation on the target image subjected to global enhancement processing based on the binarization threshold value to obtain a binarization image, and extracting the outline of the binarization to-be-detected region from the binarization image.

In some embodiments of the invention, the detection module 1004 is further configured to:

generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area;

matching a detection area corresponding to the position of the external rectangle from the target image so as to match a to-be-detected area and a non-defect area in the detection area;

and calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, so as to detect the defect according to the relative gray value.

In some embodiments of the invention, the detection module 1004 is further configured to:

calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively;

and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region.

In some embodiments of the invention, the detection module 1004 is further configured to:

if the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region;

and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect.

In some embodiments of the invention, the remediation module 1001 is further configured to: for each pixel point in the target image, the following method is adopted for correction:

performing gray level normalization on the pixel points according to the gray values of the pixel points at the corresponding positions of the pixel points in the background image;

and stretching the pixel points after the gray level normalization.

The defect detection device provided by the embodiment of the invention can effectively extract the large-area dark defect through local enhancement processing and global enhancement processing, thereby accurately detecting the defect and overcoming the technical problems that the contrast of the dark defect is low and the human eyes cannot distinguish. Therefore, the defect detection device provided by the embodiment of the invention can accurately detect the defects on the screen, is particularly suitable for detecting the dark defects with large area and low contrast, and provides reliable basis for subsequent process improvement and yield improvement.

It will be understood by those skilled in the art that the division of the modules and units in the defect detection apparatus is merely illustrative, and in other embodiments, the defect detection apparatus may be divided into different modules and units as required to perform all or part of the functions of the defect detection apparatus.

There is also provided, according to an embodiment of the present invention, an electronic device, as shown in fig. 11, comprising a processor 1101 and a memory 1102, the memory 1102 being configured to store computer program instructions, the computer program instructions being adapted to be loaded by the processor 1101 and to perform the method of: correcting the target image based on the background image; dividing the corrected target image into a plurality of local areas, and performing local enhancement processing on each local area; carrying out global enhancement processing on the target image subjected to the local enhancement processing, and carrying out binarization segmentation on the target image subjected to the global enhancement processing so as to extract the outline of a binarization region to be detected; and calculating the relative gray scale of the binaryzation to-be-detected area in the target image according to the outline of the binaryzation to-be-detected area, so as to detect the defect according to the relative gray scale.

The processor may be any suitable processor, for example, implemented in the form of a central processing unit, a microprocessor, an embedded processor, or the like, and may employ an architecture such as X86, ARM, or the like; the memory 1102 may be any of a variety of suitable memory devices including, but not limited to, magnetic memory devices, semiconductor memory devices, optical memory devices, and the like, which are not limited by the embodiments of the present invention.

Any reference to memory, storage, database, or other medium used by the invention may include non-volatile and/or volatile memory. Suitable non-volatile Memory can include Read-Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash Memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: enhancing each local image by histogram equalization; and carrying out bilinear interpolation on the boundary of the local area.

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: before the corrected target image is divided into a plurality of local areas, performing de-texture processing on the corrected target image by using minimum value filtering; and smoothing the target image after the texture removal processing.

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: performing histogram calculation on the target image subjected to the global enhancement processing to obtain a two-dimensional gray level histogram; determining a binarization threshold value according to a Rayleigh entropy maximum principle by using the two-dimensional gray level histogram; and performing binarization segmentation on the target image subjected to global enhancement processing based on the binarization threshold value to obtain a binarization image, and extracting the outline of the binarization to-be-detected region from the binarization image.

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: generating a circumscribed rectangle outside the binarization to-be-detected area according to the outline of the binarization to-be-detected area; matching a detection area corresponding to the position of the external rectangle from the target image so as to match a to-be-detected area and a non-defect area in the detection area; and calculating a relative gray value according to the gray value of the region to be detected in the detection region and the gray value of the non-defect region, so as to detect the defect according to the relative gray value.

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: calculating the average gray value of the region to be detected and the average gray value of the non-defect region according to the gray values of all pixel points of the region to be detected and the non-defect region in the detection region respectively; and calculating a relative gray value according to the average gray value of the region to be detected and the average gray value of the non-defect region.

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: if the relative gray value is smaller than a first gray threshold value, judging the region to be detected in the detection region as a non-defect region; and if the relative gray value is larger than a second gray threshold value, judging the region to be detected in the detection region as a defect.

Further, according to an embodiment of the present invention, the processor 1101 may further load and execute: for each pixel point in the target image, the following method is adopted for correction:

performing gray level normalization on the pixel points according to the gray values of the pixel points at the corresponding positions of the pixel points in the background image; and stretching the pixel points after the gray level normalization.

Therefore, the embodiment of the invention can effectively extract the large-area dark defect through the local enhancement processing and the global enhancement processing, thereby accurately detecting the defect and overcoming the technical problems that the contrast of the dark defect is low and the human eyes cannot distinguish. Therefore, the defect detection method provided by the embodiment of the invention can accurately detect the defects on the screen, is particularly suitable for detecting the dark defects with large area and low contrast, and provides reliable basis for subsequent process improvement and yield improvement.

It should be noted that, for the sake of simplicity, the above-mentioned embodiments of the system, method and electronic device are all described as a series of acts or a combination of modules, but those skilled in the art should understand that the present invention is not limited by the described order of acts or the connection of modules, because some steps may be performed in other orders or simultaneously and some modules may be connected in other manners according to the present invention.

It should also be understood by those skilled in the art that the embodiments described in the specification are included in one embodiment, the number of the above embodiments is merely for description, and the actions and modules involved are not necessarily essential to the invention.

In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

In the embodiments provided in the present invention, it should be understood that the disclosed technical contents can be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes volatile storage medium or non-volatile storage medium, such as various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements and the like that may be made without departing from the spirit and principles of the invention are intended to be included within the scope of the invention.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:训练深度估计模型的方法和设备以及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!