Lens contamination detection method, device and image detection apparatus
By enhancing the details of dirt and separating the boundaries of the lens image into center and edge regions, and combining the grayscale mean change rate and binarization algorithm, the problems of low accuracy and slow speed of lens dirt detection are solved, and efficient and accurate lens dirt detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN CZTEK
- Filing Date
- 2023-06-26
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies for lens dirt detection are not sensitive to very faint dirt, which can easily lead to missed or false detections, resulting in low detection accuracy. Furthermore, the algorithm requires a large amount of computation and is slow when dealing with large image sizes.
By acquiring the original image and performing dirt detail enhancement processing, the image is separated into a central region image and an edge region image. Candidate region extraction and feature screening are performed separately. By combining the gray-scale mean change rate and binarization algorithm, different types of dirt regions are screened out.
It improves the accuracy and efficiency of lens contamination detection, effectively identifies different types of contamination, simplifies the detection process, reduces computational load, and increases detection speed.
Smart Images

Figure CN116958058B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of lens contamination detection technology, and more specifically, to a lens contamination detection method, apparatus, and image detection equipment. Background Technology
[0002] A lens is an optical device composed of lenses used to form an image on film or a screen. It is widely used in camcorders, cameras, projectors, and electronic devices with video recording capabilities such as smartphones, computers, and surveillance systems. Due to differences in manufacturing processes and environments, newly manufactured optical lenses inevitably contain some defective products with dust or other tiny particles. To ensure that these contaminated lenses do not end up in the hands of consumers, lens contamination testing is required before leaving the factory to screen out defective lenses with dirt.
[0003] In existing technologies, lens contamination detection typically involves capturing images of the lens, followed by image processing and algorithmic analysis to determine whether the lens is defective. This test is also known as POG (Positive Pollution Grade). Current technologies often rely on median or mean filtering, which is ineffective for extremely faint contamination invisible to the naked eye. They can only detect relatively visible contamination, frequently resulting in missed or false detections and low accuracy in lens contamination detection.
[0004] As can be seen from the above, the lens dirt detection technology is not sensitive to very faint dirt and is prone to missed or misjudged lens dirt. Therefore, how to improve the accuracy of lens dirt detection still needs to be solved. Summary of the Invention
[0005] This application provides a method, apparatus, image detection device, and storage medium for detecting lens contamination, which can solve the problem of low accuracy in lens contamination detection in related technologies. The technical solutions are as follows:
[0006] According to one aspect of this application, a lens contamination detection method is provided, the method comprising: acquiring an original image and performing contamination detail enhancement processing on the original image to obtain a test image, wherein the original image is a white field image captured by the lens under test; performing boundary separation processing on the test image to obtain a central region image and an edge region image; extracting candidate regions from the edge region image to obtain a candidate set of edge contamination regions, and performing contamination feature screening on the candidate set of edge contamination regions to obtain a first contamination detection result, wherein the first contamination detection result is used to indicate whether the lens under test has edge contamination; if the first contamination detection result indicates that the lens under test does not have edge contamination, then extracting candidate regions from the central region image to obtain a candidate set of central contamination regions, and performing contamination feature screening on the candidate set of central contamination regions to obtain a second contamination detection result, wherein the second contamination detection result is used to indicate the contamination category of the lens under test.
[0007] According to one aspect of this application, a lens contamination detection device includes: an enhancement module for acquiring an original image and performing contamination detail enhancement processing on the original image to obtain a test image, wherein the original image is a white field image captured by the lens under test; a boundary separation module for performing boundary separation processing on the test image to obtain a central region image and an edge region image; an edge region image detection module for extracting candidate regions from the edge region image to obtain a candidate set of edge contamination regions, and performing contamination feature screening on the candidate set of edge contamination regions to obtain a first contamination detection result, wherein the first contamination detection result is used to indicate whether the lens under test has edge contamination; and a central region image detection module for extracting candidate regions from the central region image to obtain a candidate set of central contamination regions if the first contamination detection result indicates that the lens under test does not have edge contamination, and performing contamination feature screening on the candidate set of central contamination regions to obtain a second contamination detection result, wherein the second contamination detection result is used to indicate the contamination category of the lens under test.
[0008] In an exemplary embodiment, the enhancement module includes: a grayscale processing unit, configured to perform grayscale processing and frequency domain transformation on the original image to obtain a frequency domain grayscale image; a filtering processing unit, configured to perform frequency domain filtering on the frequency domain grayscale image to obtain a first filtered image; and a spatial domain transformation unit, configured to perform spatial domain transformation on the first filtered image to obtain the image to be tested in the spatial domain.
[0009] In one exemplary embodiment, the apparatus further includes a downsampling module, configured to perform spatial domain filtering on the image to be tested and then perform downsampling processing, so that the boundary separation processing is performed based on the downsampled image to be tested.
[0010] In an exemplary embodiment, the boundary separation module includes: a gray-scale mean calculation unit, configured to calculate the gray-scale mean of each row vector and the gray-scale mean of each column vector in the image under test based on the gray-scale values of each pixel in the image under test; a change rate calculation unit, configured to calculate the mean change rate based on the gray-scale mean of each row vector and the gray-scale mean of each column vector in the image under test, respectively, to obtain the row gray-scale mean change rate and column gray-scale mean change rate of the image under test; and an image separation unit, configured to divide the image under test into the central region image and the edge region image based on the row gray-scale mean change rate and column gray-scale mean change rate of the image under test.
[0011] In an exemplary embodiment, the edge region image detection module includes: a grayscale difference processing unit, configured to perform grayscale difference processing on each pixel in the edge region image and its surrounding pixels; a first region extraction unit, configured to extract candidate regions from the processed edge region image using a binarization algorithm, and construct a candidate set of edge dirt regions based on the extracted candidate regions; and a candidate region screening unit, configured to screen the candidate regions in the candidate set of edge dirt regions using dirt determination conditions, and if a candidate region that meets the dirt characteristics is obtained, then the first dirt result indicates that the lens under test has edge dirt.
[0012] In an exemplary embodiment, the central region image detection module includes: an image segmentation processing unit, configured to perform image segmentation processing on the central region image; a second region extraction unit, configured to extract candidate regions from the processed central region image using a binarization algorithm, and construct a central contamination region candidate set based on the extracted candidate regions; a small area discrimination unit, configured to, if a candidate region in the central contamination region candidate set is determined to be a small area region, enter a small area discrimination process to obtain a second contamination detection result indicating whether the lens under test belongs to the small contamination category; and a large area discrimination unit, configured to, if a candidate region in the central contamination region candidate set is determined to be a large area region, enter a large area discrimination process to obtain a second contamination detection result indicating whether the lens under test belongs to the light contamination category.
[0013] In an exemplary embodiment, the region image includes the edge region image or the center region image; the dirty region candidate set includes the edge dirty region candidate set or the center dirty region candidate set; the second region extraction unit includes: a binarization subunit, configured to perform binarization processing on the region image according to different binarization thresholds to obtain multiple contour sets; each contour set corresponds to a binarization threshold, and the contour set contains at least one image contour; a comparison subunit, configured to compare each image contour in the multiple contour sets and identify image contours that do not exist simultaneously in the multiple contour sets as difference contours; and a candidate region determination subunit, configured to determine the region of the difference contour in the region image as a candidate region and add the determined candidate region to the record as a dirty region candidate set.
[0014] In an exemplary embodiment, the small area discrimination process includes: comparing the average gray value of inner circle pixels with the average gray value of outer circle pixels, wherein the inner circle pixels are pixels within the candidate region, and the outer circle pixels are pixels outside the candidate region and within a set range of the central region image; if the average gray value of the outer circle pixels is greater than the average gray value of the inner circle pixels, then the candidate region is determined to meet the dirt characteristics, and a second dirt detection result indicating that the dirt category of the lens under test is the small dirt category is obtained.
[0015] In an exemplary embodiment, the large-area discrimination process includes: performing edge detection on the central region image to obtain an edge detection image, and extracting candidate regions from the edge detection image to obtain a reference dirty region candidate set; comparing the image features of each candidate region in the central dirty region candidate set with the image features of each candidate region in the reference dirty region candidate set, selecting candidate regions with the same image features in different dirty region candidate sets, and constructing a large-area dirty region candidate set based on the selected candidate regions; for each candidate region in the large-area dirty region candidate set, comparing the average gray value of the inner circle pixels with the average gray value of the outer circle pixels, wherein the inner circle pixels are pixels within the candidate region, and the outer circle pixels are pixels outside the candidate region and within a set range of the central region image; if the average gray value of the outer circle pixels is greater than the average gray value of the inner circle pixels, then determining that the candidate region conforms to the dirty features, and obtaining a second dirty detection result indicating that the dirty category of the lens under test is the light dirty category.
[0016] According to one aspect of this application, an image detection device includes at least one processor and at least one memory, wherein program instructions or code are stored in the memory; the program instructions or code are loaded and executed by the processor, causing the image detection device to implement the lens dirt detection method as described above.
[0017] According to one aspect of this application, a storage medium stores program instructions or code thereon, which are loaded and executed by a processor to implement a lens dirt detection method as described above.
[0018] According to one aspect of this application, a computer program product includes program instructions or code stored in a storage medium. The processor of an image detection device reads the program instructions or code from the storage medium, loads and executes the program instructions or code, causing the image detection device to implement the lens dirt detection method as described above.
[0019] The beneficial effects of the technical solution provided in this application are:
[0020] In the above technical solution, the original image is acquired and the dirt detail enhancement processing is performed on the original image to obtain the image to be tested. The original image is a white field image captured by the lens to be tested. The image to be tested is subjected to boundary separation processing to obtain a central region image and an edge region image. Candidate regions are extracted from the edge region image to obtain a candidate set of edge dirt regions. Dirt feature screening is performed on the candidate set of edge dirt regions to obtain a first dirt detection result. The first dirt detection result is used to indicate whether there is edge dirt in the lens to be tested. If the first dirt detection result indicates that there is no edge dirt in the lens to be tested, then candidate regions are extracted from the central region image to obtain a candidate set of central dirt regions. Dirt feature screening is performed on the candidate set of central dirt regions to obtain a second dirt detection result. The second dirt detection result is used to indicate the dirt category of the lens to be tested.
[0021] Therefore, on the one hand, by enhancing the dirt details of the original image, the detailed features of the dirt are enhanced while filtering noise, thereby improving the accuracy of lens dirt detection. On the other hand, by dividing the image to be tested into a central region image and an edge region image for independent lens dirt detection, targeted detection of different dirt categories can be achieved, which further helps to improve the accuracy of lens dirt detection. Thus, it can effectively solve the problem of low accuracy of lens dirt detection in related technologies.
[0022] Furthermore, by dividing the image to be tested into a central region image and an edge region image, and first performing independent targeted lens dirt detection on the edge region image, and only performing independent targeted lens dirt detection on the central region image if no edge dirt is detected in the lens to be tested, the lens dirt detection process is simplified, which can effectively improve the efficiency of lens dirt detection. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0024] Figure 1 This is a schematic diagram based on the implementation environment involved in this application;
[0025] Figure 2 This is a flowchart illustrating a lens contamination detection method according to an exemplary embodiment;
[0026] Figure 3 This is a flowchart illustrating a process for enhancing the details of dirt in an original image according to an exemplary embodiment;
[0027] Figure 4 This is a flowchart illustrating another method for detecting lens contamination according to an exemplary embodiment;
[0028] Figure 5 This is a flowchart illustrating a boundary separation process according to an exemplary embodiment;
[0029] Figure 5a This is a structural diagram illustrating a boundary separation process according to an exemplary embodiment;
[0030] Figure 6 yes Figure 2 A flowchart of step 250 in one embodiment corresponds to the following example;
[0031] Figure 7 yes Figure 2 A flowchart of step 270 in one embodiment corresponds to the following example;
[0032] Figure 8 This is a flowchart illustrating candidate region extraction according to an exemplary embodiment;
[0033] Figure 9 This is a flowchart illustrating a small-area discrimination process according to an exemplary embodiment;
[0034] Figure 10 This is a flowchart illustrating a large-area discrimination process according to an exemplary embodiment;
[0035] Figure 10a This is a schematic diagram illustrating inner and outer ring pixels according to an exemplary embodiment;
[0036] Figure 11 This is a flowchart illustrating the specific implementation of a lens dirt detection method in an application scenario;
[0037] Figure 12 This is a structural block diagram of a lens dirt detection device according to an exemplary embodiment;
[0038] Figure 13 This is a structural block diagram of an image detection device according to an exemplary embodiment. Detailed Implementation
[0039] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0040] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0041] As mentioned earlier, current technologies are often based on median filtering or mean filtering, which are ineffective at detecting very faint dirt that is not visible to the naked eye. They can only detect relatively obvious dirt that is visible to the naked eye, often resulting in missed or false detections, leading to low accuracy in lens dirt detection.
[0042] Furthermore, when the image size is large, the computational load of existing technology algorithms is too large, resulting in slow lens dirt detection speed, easy timeout in the detection process, and low efficiency in lens dirt detection.
[0043] As can be seen from the above, the relevant technologies still suffer from low accuracy and low efficiency in detecting lens dirt.
[0044] Therefore, the lens contamination detection method provided in this application can effectively improve the accuracy of lens contamination detection. Accordingly, the lens contamination detection method is applicable to a lens contamination detection device, which can be deployed in an image detection device. The image detection device can be a computer device configured with a von Neumann architecture, such as a desktop computer, a laptop computer, a server, etc.
[0045] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0046] Figure 1 This is a schematic diagram of an implementation environment involved in an image processing method. It should be noted that this implementation environment is merely an example adapted to the present invention and should not be considered as providing any limitation on the scope of the invention.
[0047] The implementation environment includes a data acquisition terminal 110 and a server terminal 130.
[0048] Specifically, the acquisition terminal 110 can also be considered as an image acquisition device, including but not limited to image acquisition devices with shooting functions such as cameras, camcorders, and video recorders.
[0049] Server 130 can be an image inspection device such as a desktop computer, laptop computer, or server, or it can be a computer cluster consisting of multiple servers, or even a cloud computing center consisting of multiple servers. Server 130 is used to provide backend services, such as, but not limited to, lens dirt detection services.
[0050] The server 130 and the acquisition terminal 110 establish a network communication connection in advance via wired or wireless means, and data transmission between the server 130 and the acquisition terminal 110 is realized through this network communication connection. The transmitted data includes, but is not limited to, raw images, etc.
[0051] In one application scenario, through the interaction between the acquisition terminal 110 and the server terminal 130, the acquisition terminal 110 uses the lens under test to capture and acquire the image under test, and uploads the image under test to the server terminal 130 to request the server terminal 130 to provide lens dirt detection service.
[0052] For server 130, after receiving the image of the target object uploaded by acquisition terminal 110, it calls the lens dirt detection service to perform lens dirt detection on the image under test, so that the image under test can detect the type of lens dirt of the lens under test, thereby solving the problems of low accuracy and low efficiency of lens dirt detection in related technologies.
[0053] Please see Figure 2 This application provides a method for detecting lens contamination. This method is applicable to image detection equipment, which can be... Figure 1 The server 130 in the implementation environment is shown.
[0054] In the following method embodiments, for ease of description, the execution subject of each step of the method is an image detection device as an example, but this does not constitute a specific limitation.
[0055] like Figure 2As shown, the method may include the following steps:
[0056] Step 210: Obtain the original image and perform dirt detail enhancement processing on the original image to obtain the image to be tested.
[0057] The original image is a white-field image captured by the lens under test, specifically a white-field image with characteristics such as higher brightness in the central area and lower brightness in the edge area. In one application scenario, by maintaining stable ambient light during the capture of the original image and adjusting the exposure of the lens under test to control the image's exposure, an original image with an average grayscale within a certain range and moderate brightness is obtained, suitable for lens dirt detection.
[0058] In one possible implementation, the original image is taken by the lens under test in a white field environment by adjusting the exposure towards an industrial backlight or other light source, resulting in an image containing only the white field.
[0059] Please see Figure 3 In one possible implementation, the process of enhancing the details of dirt in the original image includes the following steps:
[0060] Step 310: Perform grayscale processing and frequency domain transformation on the original image to obtain a frequency domain grayscale image.
[0061] First, it's important to note that if dirt appears on the lens, the corresponding area in the original image will also show a dirt region with a grayscale difference from the surrounding area. Therefore, by detecting the grayscale of the dirt region in the original image, we can determine whether the lens is dirty and what type of dirt it is. Based on this, converting the original image to a grayscale image before performing lens dirt detection does not affect the accuracy of lens dirt detection. Furthermore, because the original image is converted from a color image with a large amount of image information to a grayscale image with less image information, the computational load in the lens dirt detection process is reduced, improving the efficiency and speed of lens dirt detection.
[0062] Furthermore, the inventors recognized that the original image is located in the spatial domain. Existing techniques for enhancing dirt details during lens dirt detection often result in simultaneous noise enhancement, leading to a decrease in both the accuracy and speed of lens dirt detection. Therefore, by transforming the original image from the frequency domain to the frequency domain, preparation is made for the subsequent lens dirt detection process, enabling the enhancement of dirt details.
[0063] Step 330: Perform frequency domain filtering on the frequency domain grayscale image to obtain the first filtered image.
[0064] In one possible implementation, frequency domain filtering is achieved through differential Gaussian filtering. The frequency domain grayscale image undergoes a first Gaussian filter to obtain the first filtered result, followed by a second Gaussian filter to obtain the second filtered result. The first filtered image is then obtained by performing a difference operation between the first and second filtered results. It should be noted that, to improve the filtering effect, the convolution kernel size of the second Gaussian filter is more than five times that of the first Gaussian filter. In this approach, differential Gaussian filtering can reduce the energy distribution in the high-frequency regions of the frequency domain grayscale image, thereby effectively removing noise mainly distributed in the high-frequency region and achieving a denoising effect.
[0065] Step 350: Perform spatial domain transformation on the first filtered image to obtain the image to be tested in the spatial domain.
[0066] In one possible implementation, the first filtered image is transformed from the frequency domain to the spatial domain via inverse Fourier transform.
[0067] Through the above process, the original image is filtered in the frequency domain to reduce noise in the original image and enhance the grayscale features of dirt, making it easier to identify dirt and dirt types in image dirt detection, thereby improving the detection accuracy and efficiency of image dirt detection.
[0068] In one possible implementation, such as Figure 4 As shown, after performing dirt detail enhancement on the original image, the following steps are also included:
[0069] Step 410: The image to be tested is filtered in the spatial domain and then downsampled so that the boundary separation process is based on the downsampled image to be tested.
[0070] The downsampling process and the filtering process in the spatial domain are linked by a trigger relationship. That is, every time a downsampling operation is required, a filtering process in the spatial domain is performed first, and then the downsampling operation is performed.
[0071] By downsampling, the overall size of the image under test is reduced, thereby reducing the computational load in the image dirt detection process and accelerating the efficiency and speed of image dirt detection.
[0072] Step 230: Perform boundary separation processing on the image to be tested to obtain the central region image and the edge region image.
[0073] It should be noted that lens contamination comes in different types, and the types of contamination present in the test image also vary. For example, areas exhibiting contamination characteristics at the edges of the test image are definitely edge-type contamination, while areas in the center of the image that do exhibit contamination characteristics may be indistinguishable noise or faint contamination. When the contamination area is small, the contamination characteristics are obvious; when the contamination area is large, the characteristics of large areas of faint contamination are not obvious and are difficult to detect. Therefore, by performing boundary separation processing on the test image, dividing it into a central region image and an edge region image, targeted detection can be performed on the different types of contamination that may appear in the central and edge regions of the test image, improving the accuracy and efficiency of lens contamination detection.
[0074] Please see Figure 5 In one possible implementation, the process of performing boundary separation on the image to be tested includes the following steps:
[0075] Step 510: Calculate the mean gray value of each row vector and the mean gray value of each column vector in the image to be tested based on the gray value of each pixel in the image to be tested.
[0076] In one possible implementation, there is a grayscale difference between the edge region and the center region of the image under test. The average grayscale value of the center region of the image under test is high, while the average grayscale value of the image is lower as it approaches the edge region of the image under test. Based on the grayscale value of each pixel in the image under test, the boundary line between the edge region and the center region of the image under test can be determined, thus enabling the boundary separation operation.
[0077] Specifically, based on the grayscale values of each pixel in the image under test, the sum of the grayscale values of all pixels in each row and the sum of the grayscale values of all pixels in each column are calculated. Then, the average grayscale value of all pixels in each row is calculated from the sum of the grayscale values of all pixels in each row, and the average grayscale value of all pixels in each column is calculated from the sum of the grayscale values of all pixels in each column. It should be noted that all pixels in each row can also be considered as a row vector in the image under test, and similarly, all pixels in each column can be considered as a column vector in the image under test.
[0078] Step 530: Calculate the mean change rate based on the mean gray value of each row vector and the mean gray value of each column vector in the image to be tested, and obtain the mean change rate of the row gray value and the mean change rate of the column gray value of the image to be tested.
[0079] First, it should be noted that the change rate of grayscale mean can reflect the brightness changes in the image under test. This is because the image under test has image characteristics such as higher brightness in the central area and lower brightness in the edge area. Therefore, the grayscale mean of each row vector and the grayscale mean of each column vector are greater closer to the edge of the image.
[0080] For example, by iterating through each row vector in the image under test and performing derivative operations on the gray-level mean of each row vector with respect to the gray-level mean of its adjacent row vectors, the rate of change of the gray-level mean of each row vector can be obtained. Similarly, by iterating through each column vector in the image under test and performing derivative operations on the gray-level mean of each column vector with respect to the gray-level mean of its adjacent column vectors, the rate of change of the gray-level mean of each column vector can be obtained. The rate of change of the gray-level mean of each row vector and the rate of change of the gray-level mean of each column vector constitute the row gray-level mean change rate and column gray-level mean change rate of the image under test, thereby reflecting the magnitude of the change in the gray-level mean of the image under test in the corresponding direction.
[0081] Step 550: Based on the mean change rate of row grayscale and the mean change rate of column grayscale of the image to be tested, the image to be tested is divided into a central region image and an edge region image.
[0082] In one possible implementation, such as Figure 5a As shown, by setting a boundary value in advance, when the gray-scale mean change rate of one row vector and the gray-scale mean change rate of one column vector exceed the set boundary value, the corresponding row vector and column vector are determined as the boundary lines between the central region image and the edge region image, respectively, so as to divide the image under test into the central region image and the edge region image, thus completing the boundary separation process.
[0083] Through the above process, the image to be tested is divided into a central region image and an edge region image, enabling lens dirt detection to be performed for different types of dirt and improving the accuracy of lens dirt detection.
[0084] Step 250 extracts candidate regions from the edge region image to obtain a candidate set of edge dirt regions, and performs dirt feature screening on the candidate set of edge dirt regions to obtain a first dirt detection result. The first dirt detection result is used to indicate whether there is edge dirt in the lens under test.
[0085] Please see Figure 6 In one possible implementation, candidate region extraction of an edge region image includes the following steps:
[0086] Step 610: Perform grayscale difference processing on each pixel in the edge region image and its surrounding pixels.
[0087] In one possible implementation, grayscale difference processing is achieved through grayscale compensation. For example, by compensating the grayscale values of the four corner regions of the edge region image, the grayscale values of the edge region image are enhanced in areas with low grayscale values, so that there are no areas in the edge region image where the grayscale value differs too much from the average grayscale value of the edge region. This reduces the misjudgment of dirt type caused by low grayscale values in the region when performing lens dirt detection.
[0088] Step 630: Extract candidate regions from the processed edge region image using a binarization algorithm, and construct a candidate set of edge dirty regions based on the extracted candidate regions.
[0089] Among them, extracting candidate regions using binarization algorithms refers to processing the image by inverting its colors and then using binarization algorithms to extract candidate regions that may be dirty areas.
[0090] In one possible implementation, such as Figure 8 As shown, a binarization algorithm is used to extract candidate regions from the processed region image to obtain a candidate set of dirty regions, including the following steps:
[0091] Step 810: Binarize the region image according to different binarization thresholds to obtain multiple contour sets.
[0092] In this process, multiple binarization thresholds are set, and binarization is performed once for each binarization threshold to obtain multiple contour sets. Each contour set corresponds to a binarization threshold, and each contour set contains at least one image contour.
[0093] In one possible implementation, the binarization threshold is adjusted by comparing the number of image contours in each contour set until it is determined that the binarization threshold satisfies the binarization condition.
[0094] For example, two different binarization thresholds are set: threshold a and threshold b, where threshold a is less than threshold b. The image is binarized twice, setting pixels with gray values greater than the threshold to 1 and pixels with gray values less than or equal to the threshold to 0. By binarizing the pixels in the image under test, pixels with gray values greater than 1 are extracted as image contours in the image under test. Two contour sets are obtained corresponding to the two binarization thresholds: contour set a and contour set b. Because threshold a is less than threshold b, the binarization process based on threshold b extracts fewer image contours. Therefore, the number of image contours in contour set a is greater than that in contour set b. By comparing the difference in the number of image contours in contour set a and contour set b, the binarization performance of thresholds a and b can be reflected. The above process is repeated for thresholds a and b. If the number of image contours in contour set a is greater than twice the number of image contours in contour set b, then threshold a is increased until the number of image contours in contour set a is less than twice the number of image contours in contour set b. At this point, thresholds a and threshold b are determined to be binarization thresholds that satisfy the binarization conditions.
[0095] After determining the binarization threshold, the image to be tested can be binarized to display pixels in the image that have grayscale differences from surrounding pixels. By comparing the pixels in each region, multiple pixels in the image that have significant grayscale differences from surrounding pixels are extracted and identified as the image contour.
[0096] Step 830: By comparing the image contours in multiple contour sets, the image contours that do not exist in multiple contour sets at the same time are taken as the difference contours.
[0097] The multiple contour sets are sets containing multiple image contours obtained based on different binarization thresholds. In one embodiment, using a single binarization threshold may extract image contours generated by noise. However, since the gray values of pixels generated by noise in the image are random, while the gray values of pixels generated by dirt in the image are stable, using different binarization thresholds to extract image contours multiple times can extract image contours with stable gray values. Image contours with unstable gray values will not be extracted continuously. By obtaining contour sets through multiple binarizations, image contours generated by dirt in the image under test can be repeatedly obtained, while image contours generated by noise can be excluded.
[0098] Step 850: Determine the regions with different contours in the region image as candidate regions, and add the determined candidate regions to the record as a candidate set of dirty regions.
[0099] In the above process, by comparing image contours in multiple contour sets, noise points with random gray values in the contour sets can be eliminated, thereby improving the accuracy of image dirt detection.
[0100] Step 650: Use the dirt determination criteria to screen the candidate regions in the candidate set of edge dirt regions. If a candidate region that meets the dirt characteristics is found, then the first dirt result indicates that the lens under test has edge dirt.
[0101] First, it should be noted that the type of dirt appearing in the edge dirt area is a dense dirt type with obvious dirt characteristics. The candidate area can be identified as an edge dirt and a dense dirt type based on the dirt determination criteria.
[0102] In one possible implementation, the contamination determination criteria are the pre-defined geometric and image features of the contaminated area. For example, the contamination features may include the pre-defined centroid coordinates, aspect ratio, and average grayscale value of the contaminated area. If the first contamination detection result indicates that the lens under test does not have edge contamination, then step 270 is executed to continue lens contamination detection for the central region image.
[0103] Conversely, if the first dirt detection result indicates that the lens under test has edge dirt, the dirt type of the lens under test is determined to be heavy dirt and the lens dirt detection is stopped.
[0104] Step 270: If the first dirt detection result indicates that there is no edge dirt in the lens under test, then the candidate region is extracted from the central region image to obtain a central dirt region candidate set, and dirt feature screening is performed on the central dirt region candidate set to obtain a second dirt detection result. The second dirt detection result is used to indicate the dirt category of the lens under test.
[0105] Please see Figure 7 In one possible implementation, the dirt detection process for the central region image includes the following steps:
[0106] Step 710: Perform image segmentation processing on the central region image.
[0107] In one possible implementation, the background image is obtained by mean filtering the central region image, and then the foreground image is obtained by difference operation between the central region image and the background image.
[0108] In order to make the image outline in the foreground image more clearly visible, in this embodiment, the foreground image is enhanced. Specifically, the grayscale value range of the foreground image is expanded by performing grayscale stretching on the foreground image to obtain an enhanced foreground image.
[0109] For example, the lowest gray value of the foreground image is marked as 'a', and the highest gray value of the foreground image is marked as 'b'. A gray value range [a, b] for the foreground image is established, and a target gray value range [c, d] is set that is larger than the gray value range of the foreground image. For example, the gray value of a pixel is changed to 'c', and the gray value of a pixel is changed to 'd'. The linear relationship between the gray value ranges [a, b] and [c, d] of pixels with gray values between a and b is stretched into the target gray value range, thereby obtaining the foreground enhanced image.
[0110] In this approach, by applying mean filtering to the central region image and enhancing the foreground image, the grayscale range of the foreground image can be improved to a range suitable for lens dirt detection. This improves the image quality of the central region image while enhancing the grayscale mathematical features of the dirt, making it easier to determine candidate regions and thus improving the accuracy of lens dirt detection.
[0111] Step 730: The candidate regions are extracted from the processed central region image using a binarization algorithm, and a candidate set of central contamination regions is constructed based on the extracted candidate regions.
[0112] Please refer back to step 810. Using the same method as in step 810, candidate regions are extracted from the central region image to identify potential contaminated areas, thus constructing a candidate set of contaminated central region areas. This will not be repeated here. The difference lies in the input image used for candidate region extraction; here it is the processed central region image, which can also be understood as the foreground enhancement image from step 710. Correspondingly, the output candidate set of contaminated areas is different; here it is the candidate set of contaminated central region areas.
[0113] Step 750: If the candidate region in the candidate set of the central contamination region is determined to be a small area, then the small area discrimination process is entered to obtain the second contamination detection result used to indicate whether the lens under test belongs to the small contamination category.
[0114] In one possible implementation, such as Figure 9 As shown, the small area discrimination process includes the following steps.
[0115] Step 910: Compare the average grayscale value of the inner circle pixels with the average grayscale value of the outer circle pixels.
[0116] First, it should be noted that the region image includes either the edge region image or the center region image. The dirty region candidate set includes either the edge dirty region candidate set or the center dirty region candidate set.
[0117] Pixels within the candidate area of the dirty area candidate set are inner circle pixels, and pixels outside the candidate area but within the set range of the central area image are outer circle pixels.
[0118] Step 930: If the average gray value of the outer ring pixels is greater than the average gray value of the inner ring pixels, then the candidate region is determined to meet the dirt characteristics, and a second dirt detection result indicating that the dirt type of the lens under test is a minor dirt category is obtained.
[0119] As can be seen from the above, the second dirt detection result represents the evaluation of the candidate regions in the candidate set of central dirt regions based on dirt characteristics. By detecting whether the candidate regions meet the dirt characteristics, it is determined whether the candidate regions are identified as small dirt categories.
[0120] Step 770: If the candidate area in the candidate set of the central contamination area is determined to be a large area, then the large area discrimination process is entered to obtain the second contamination detection result used to indicate whether the lens under test belongs to the light contamination category.
[0121] In one possible implementation, such as Figure 10 As shown, the large-area discrimination process includes the following steps.
[0122] Step 1010: Perform edge detection on the central region image to obtain an edge detection image, and extract candidate regions from the edge detection image to obtain a candidate set of contaminated regions for comparison.
[0123] The edge detection algorithm is used to detect geometric features of large-area dirt types, thereby enabling targeted detection of the geometric features of the boundaries of large-area dirt types during candidate region extraction, improving the accuracy of candidate region detection. Before edge detection, in one possible implementation, the central region image can be filtered in the spatial domain, for example, by Gaussian smoothing filtering, to reduce noise in the central region image, thus enabling more accurate edge detection.
[0124] Step 1030: Compare the image features of each candidate region in the candidate set of contaminated areas with the image features of each candidate region in the candidate set of control contaminated areas, select candidate regions with the same image features in different contaminated area candidate sets, and construct a large-area contaminated area candidate set based on the selected candidate regions.
[0125] It is understandable that candidate regions in the control dirty region candidate set extracted by edge detection algorithms will certainly have geometric features belonging to the dirty type at their edges, but their grayscale features may not be obvious. Similarly, candidate regions in the central dirty region candidate set extracted by binarization algorithms will certainly meet the grayscale feature of a significant grayscale difference between the dirty region and surrounding pixels, but their edges may not have geometric features of the dirty type. Therefore, by comparing the features of the central dirty region candidate set with the control dirty region candidate set, we can integrate candidate regions with common image features from both sets—that is, candidate regions with geometric features of the dirty type at their edges and grayscale features of a significant grayscale difference between the dirty region and surrounding pixels—thus completing the screening of the central region candidate set and eliminating noise from it.
[0126] Step 1050: For each candidate region in the candidate set of large-area dirty areas, compare the gray-scale mean of the inner circle pixels with the gray-scale mean of the outer circle pixels.
[0127] The inventors recognized that the geometric features of the candidate region's edges are irregular, and the shape of the candidate region is unpredictable. Therefore, in order to obtain the inner and outer pixels of the candidate region, it is necessary to fit the candidate region to determine the range of the inner and outer pixels within the candidate region.
[0128] In one possible implementation, when determining the inner and outer pixels of a candidate region, the candidate region is fitted using a mask of a circular region.
[0129] Specifically, such as Figure 10a As shown, a circular region 1 with a slightly larger radius and a circular region 2 with a slightly smaller radius are created centered on the candidate region to ensure that circular regions 1 and 2 can best fit the candidate region. The pixels between these two circular regions and the candidate region are the inner and outer ring pixels, respectively. The inner ring pixels are the pixels within the candidate region, and the outer ring pixels are the pixels outside the candidate region but within a defined range of the central region image. By performing a difference operation, the average grayscale values of the outer and inner ring pixels of the candidate region can be obtained. Fitting the candidate region with circular regions can completely preserve the edges of the geometric features of the candidate region containing dirt types within the fitting region, maximize the pixels near the candidate region, improve the accuracy of dirt detection, and facilitate the calculation of the average grayscale values of the inner and outer ring pixels, thus improving the efficiency of dirt detection.
[0130] Step 1070: If the average gray value of the outer ring pixels is greater than the average gray value of the inner ring pixels, then the candidate region is determined to meet the dirt characteristics, and a second dirt detection result indicating that the dirt category of the lens under test is light dirt category is obtained.
[0131] As shown above, candidate regions are determined by the difference in the mean grayscale values of the inner and outer pixels within the dirty region. One possible implementation involves performing a least-squares method to fit circles to the candidate regions in the candidate set, obtaining a mask for the center region of each candidate region. Then, two slightly larger and slightly smaller radii are set, and two new circular regions are established based on these radii. Finally, the outer and inner pixels of the candidate regions are obtained through a difference operation.
[0132] Under the above embodiments, targeted dirt discrimination is performed on candidate regions with different sizes of candidate concentration areas in the central dirt region, which improves the targeting of different types of dirt discrimination in the central region image during lens dirt detection, and improves the accuracy and detection efficiency of lens dirt detection.
[0133] Figure 11 This is a schematic diagram illustrating the specific implementation of a lens contamination detection method in an application scenario. In this scenario, a white field image is captured by a camera module using the lens under test. The white field image is then processed into a grayscale image, followed by DOG filtering and downsampling to obtain the image under test, thereby reducing noise in the image under test.
[0134] The image to be tested is adaptively separated into a center image and an edge image. First, blind spot compensation is performed on the edge image to reduce noise. Candidate regions are extracted from the edge image to obtain a candidate set of dense dirt. The candidate set of dense dirt is then screened for dirt features to determine whether each candidate region in the candidate set meets the edge dirt features. If a candidate region that meets the edge dirt features is found, it is directly determined that there is dirt on the lens to be tested, and it is a defective product.
[0135] If no candidate region matching the edge dirt characteristics is found in the candidate set of dense dirt, candidate regions are extracted from the central image to obtain candidate sets of large and small dirt. Dirt feature screening is then performed on these candidate sets to determine if each candidate region matches the central dirt characteristics. If a candidate region matching the central dirt characteristics is found, the lens under test is directly determined to have dirt and is considered a defective product. If no candidate region matching the central dirt characteristics is found, the lens under test is determined to be free of dirt and is considered a qualified product.
[0136] In this application scenario, the lens dirt detection results are shown in Table 1. With input test image resolutions of 1600×1200, 2592×1944, and 4096×3072, the lens dirt detection method used in this application can accurately detect the type of dirt appearing in the test lens in the test image. Furthermore, in the comparison of detection time between Algorithm 1 and Algorithm 2 (which do not use the above method) and the method used in this application, the detection time of this application is shorter than that of Algorithm 1 and Algorithm 2. This not only improves the accuracy of lens dirt detection but also effectively improves the efficiency of lens dirt detection.
[0137] Table 1
[0138]
[0139] The following are embodiments of the apparatus described in this application, which can be used to execute the lens contamination detection method involved in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments of the lens contamination detection method involved in this application.
[0140] Please see Figure 12 This application provides a lens dirt detection device 1200, including but not limited to: an enhancement module 1210, a boundary separation module 1230, an edge region image detection module 1250, and a center region image detection module 1270.
[0141] The enhancement module 1210 is used to acquire the original image and perform dirt detail enhancement processing on the original image to obtain the image to be tested. The original image is a white field image captured by the lens to be tested.
[0142] The boundary separation module 1230 is used to perform boundary separation processing on the image to be tested, and obtain the central region image and the edge region image.
[0143] The edge region image detection module 1250 is used to extract candidate regions from the edge region image to obtain a candidate set of edge dirt regions, and to screen the edge dirt region candidate set for dirt features to obtain a first dirt detection result. The first dirt detection result is used to indicate whether there is edge dirt in the lens under test.
[0144] The central region image detection module 1270 is used to extract candidate regions from the central region image to obtain a central contamination region candidate set if the first contamination detection result indicates that there is no edge contamination in the lens under test, and to screen the central contamination region candidate set for contamination features to obtain a second contamination detection result. The second contamination detection result is used to indicate the contamination category of the lens under test.
[0145] It should be noted that the lens dirt detection device provided in the above embodiments is only illustrated by the division of the above functional modules when performing lens dirt detection. In actual applications, the above functions can be assigned to different functional modules as needed. That is, the internal structure of the lens dirt detection device will be divided into different functional modules to complete all or part of the functions described above.
[0146] Furthermore, the lens dirt detection device and lens dirt detection method provided in the above embodiments belong to the same concept, and the specific way in which each module performs its operation has been described in detail in the method embodiments, and will not be repeated here.
[0147] Please see Figure 13 This application provides an image detection device 4000, which may include a desktop computer, a laptop computer, a server, etc.
[0148] exist Figure 13 The image detection device 4000 includes at least one processor 4001 and at least one memory 4003.
[0149] The data interaction between the processor 4001 and the memory 4003 can be achieved through at least one communication bus 4002. This communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 13 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0150] Optionally, the image detection device 4000 may further include a transceiver 4004, which can be used for data interaction between the image detection device and other image detection devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one unit, and the structure of the image detection device 4000 does not constitute a limitation on the embodiments of this application.
[0151] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0152] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program instructions or code in the form of instructions or data structures and accessible by the image detection device 4000, but not limited thereto.
[0153] The memory 4003 stores program instructions or code, and the processor 4001 can read the program instructions or code stored in the memory 4003 through the communication bus 4002.
[0154] When the program instructions or code are executed by the processor 4001, the lens dirt detection method in the above embodiments is implemented.
[0155] Furthermore, this application provides a storage medium storing program instructions or code, which is loaded and executed by a processor to implement the lens dirt detection method as described above.
[0156] This application provides a computer program product, which includes program instructions or code. The program instructions or code are stored in a storage medium. The processor of the image detection device reads the program instructions or code from the storage medium, loads and executes the program instructions or code, so that the image detection device implements the lens dirt detection method as described above.
[0157] Compared with related technologies, this application solves the problems of insensitivity to extremely faint dirt, easy to miss or misjudge lens dirt, low detection accuracy, and low detection efficiency in related technologies, and improves the accuracy and speed of lens dirt detection, thereby increasing detection efficiency.
[0158] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0159] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for detecting lens contamination, characterized in that, include: The original image is acquired and the dirt detail enhancement process is performed on the original image to obtain the image to be tested. The original image is a white field image captured by the lens to be tested. Based on the grayscale values of each pixel in the image to be tested, calculate the average change rate of the row grayscale value and the average change rate of the column grayscale value in the image to be tested. Based on the mean change rate of the row grayscale and the mean change rate of the column grayscale, the image to be tested is divided into a central region image and an edge region image; Candidate regions are extracted from the edge region image to obtain a candidate set of edge dirt regions, and dirt feature screening is performed on the candidate set of edge dirt regions to obtain a first dirt detection result. The first dirt detection result is used to indicate whether there is edge dirt in the lens under test. If the first dirt detection result indicates that the lens under test has edge dirt, then the dirt type of the lens under test is determined to be heavy dirt and the lens dirt detection is stopped; If the first dirt detection result indicates that the lens under test does not have edge dirt, then candidate regions are extracted from the central region image to obtain a central dirt region candidate set, and dirt feature screening is performed on the central dirt region candidate set to obtain a second dirt detection result. The second dirt detection result is used to indicate the dirt category of the lens under test.
2. The method as described in claim 1, characterized in that, The process of enhancing the dirt details of the original image to obtain the image to be tested includes: The original image is subjected to grayscale processing and frequency domain transformation to obtain a frequency domain grayscale image; The frequency domain grayscale image is filtered in the frequency domain to obtain a first filtered image; The first filtered image is transformed in the spatial domain to obtain the image to be tested in the spatial domain.
3. The method as described in claim 1, characterized in that, After performing dirt detail enhancement processing on the original image to obtain the image to be tested, the method further includes: The image to be tested is filtered in the spatial domain and then downsampled so that the process of dividing the image to be tested into a central region image and an edge region image is based on the downsampled image to be tested.
4. The method as described in claim 1, characterized in that, The step of performing boundary separation on the image under test by calculating the mean change rate of row grayscale and the mean change rate of column grayscale in the image under test based on the grayscale values of each pixel in the image under test, and obtaining the central region image and the edge region image, includes: Based on the gray values of each pixel in the image to be tested, calculate the mean gray value of each row vector and the mean gray value of each column vector in the image to be tested. The mean change rate of the row grayscale and the mean change rate of the column grayscale of the image under test are calculated based on the mean grayscale values of each row vector and each column vector in the image under test, respectively.
5. The method as described in claim 1, characterized in that, The step of extracting candidate regions from the edge region image to obtain a candidate set of edge dirt regions, and then performing dirt feature screening on the candidate set of edge dirt regions to obtain a first dirt detection result, includes: Gray-scale difference processing is performed on each pixel in the edge region image and its surrounding pixels; Candidate regions are extracted from the processed edge region image using a binarization algorithm, and a candidate set of edge dirt regions is constructed based on the extracted candidate regions. Candidate regions in the candidate set of edge dirt regions are screened using dirt determination criteria. If a candidate region that meets the dirt characteristics is obtained, the first dirt detection result indicates that the lens under test has edge dirt.
6. The method as described in claim 1, characterized in that, The process of extracting candidate regions from the central region image to obtain a candidate set of contaminated regions in the central region, and then performing contamination feature screening on the candidate set of contamination regions in the central region to obtain a second contamination detection result, includes: The central region image is subjected to image segmentation processing; Candidate regions are extracted from the processed central region image using a binarization algorithm, and a candidate set of central contamination regions is constructed based on the extracted candidate regions. If the candidate region in the candidate set of the central contamination region is determined to be a small area, then the small area discrimination process is entered to obtain the second contamination detection result used to indicate whether the lens under test belongs to the small contamination category; If the candidate region in the candidate set of the central contamination region is determined to be a large area, then the large area discrimination process is entered to obtain the second contamination detection result used to indicate whether the lens under test belongs to the light contamination category.
7. The method as described in claim 5 or 6, characterized in that, The region image includes either the edge region image or the center region image; the dirty region candidate set includes either the edge dirty region candidate set or the center dirty region candidate set; Candidate regions are extracted from the processed region image using a binarization algorithm, and a candidate set of dirty regions is constructed based on the extracted candidate regions, including: The region image is binarized according to different binarization thresholds to obtain multiple contour sets; each contour set corresponds to a binarization threshold, and the contour set contains at least one image contour. By comparing each image contour in multiple contour sets, image contours that do not exist simultaneously in multiple contour sets are identified as difference contours. The regions in the image with the difference contours are identified as candidate regions, and the identified candidate regions are added to the dirty region candidate set.
8. The method as described in claim 6, characterized in that, The small area discrimination process includes: The average gray value of the inner circle pixels is compared with the average gray value of the outer circle pixels, wherein the inner circle pixels are the pixels within the candidate region, and the outer circle pixels are the pixels outside the candidate region and within a set range of the central region image. If the average gray value of the outer ring pixels is greater than the average gray value of the inner ring pixels, then the candidate region is determined to meet the dirt characteristics, and the second dirt detection result indicating that the dirt category of the lens under test is the small dirt category is obtained. The large-area discrimination process includes: Edge detection is performed on the central region image to obtain an edge detection image, and candidate regions are extracted from the edge detection image to obtain a candidate set of contaminated regions for comparison. The image features of each candidate region in the central contaminated area candidate set are compared with the image features of each candidate region in the control contaminated area candidate set. Candidate regions with the same image features in different contaminated area candidate sets are selected, and a large-area contaminated area candidate set is constructed based on the selected candidate regions. For each candidate region in the candidate set of the large-area dirty area, the average gray value of the inner circle pixels and the average gray value of the outer circle pixels are compared. The inner circle pixels are the pixels within the candidate region, and the outer circle pixels are the pixels outside the candidate region and within the set range of the central region image. If the average gray value of the outer ring pixels is greater than the average gray value of the inner ring pixels, then the candidate region is determined to meet the dirt characteristics, and a second dirt detection result indicating that the dirt category of the lens under test is the light dirt category is obtained.
9. A lens dirt detection device, characterized in that, include: An enhancement module is used to acquire the original image and perform dirt detail enhancement processing on the original image to obtain the image to be tested. The original image is a white field image captured by the lens to be tested. The boundary separation module is used to calculate the average change rate of row grayscale and the average change rate of column grayscale in the image under test based on the grayscale values of each pixel in the image under test; and to divide the image under test into a central region image and an edge region image based on the average change rate of row grayscale and the average change rate of column grayscale. An edge region image detection module is used to extract candidate regions from the edge region image to obtain a candidate set of edge dirt regions, and to screen the edge dirt region candidate set for dirt features to obtain a first dirt detection result. The first dirt detection result is used to indicate whether the lens under test has edge dirt. The central region image detection module is used to determine that the lens under test is heavily soiled and stop lens soiling detection if the first soiling detection result indicates that the lens under test has edge soiling; if the first soiling detection result indicates that the lens under test does not have edge soiling, the module extracts candidate regions from the central region image to obtain a central soiling region candidate set, and performs soiling feature screening on the central soiling region candidate set to obtain a second soiling detection result, which is used to indicate the soiling category of the lens under test.
10. An image detection device, comprising at least one processor and at least one memory, characterized in that, The memory stores program instructions or code; the program instructions or code are loaded and executed by the processor, enabling the image detection device to implement the lens dirt detection method as described in any one of claims 1-8.
Citation Information
Patent Citations
Lens dirt detection method, device and equipment
CN111970506A
Dirt detection method based on concentric circle segmentation positioning
CN112862832A