Lens surface defect detection method and apparatus, and device and readable storage medium

By processing the RAW diagrams collected by the lens imaging module, the mirror defects are automatically detected, which solves the problems of high detection cost, high workload and low accuracy in the prior art, and achieves efficient and accurate mirror defect detection.

WO2025054982A1PCT designated stage expired Publication Date: 2025-03-20AAC TECHNOLOGIES PTE LTD +1

Patent Information

Application Number
PCT/CN2023/119182
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-09-15
Publication Date
2025-03-20

AI Technical Summary

Technical Problem

The existing mirror defect detection methods have high detection cost, high workload and low accuracy.

Method used

By obtaining the RAW map collected by the imaging module equipped with the lens to be detected, it is separated into a single-channel image and is subjected to mean filtering, then performs subtraction and binarization processing, the image communication domain is acquired and merged, and whether there is a mirror defect is judged based on the number of pixels.

Benefits of technology

Automatic mirror defect detection is realized, reducing inspection costs and workloads, and improving detection accuracy, avoiding dependence on complex detection instruments and manual identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023119182_20032025_PF_FP_ABST
    Figure CN2023119182_20032025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a lens surface defect detection method and apparatus, and a device and a readable storage medium. The specific implementation solution comprises: acquiring a RAW image captured by an imaging module that carries a lens to be tested; separating the RAW image into four single-channel images, and performing mean filtering processing on each single-channel image; performing a subtraction operation on each filtered image and a corresponding single-channel image, so as to obtain a difference image, and performing binarization processing on each difference image; acquiring a corresponding image connected component on the basis of each binarized difference image, and mapping the image connected components of all channels to the RAW image for merging; and if the total number of pixel points of a merged connected component is greater than or equal to a preset threshold value, outputting a lens surface defect detection result on the basis of image position information of the merged connected component. In the present application, lens surface defect detection is performed by means of computer vision without the need for a complex detection instrument and without the need for relying on manual labor to identify a lens surface defect, thereby effectively reducing the detection cost and the detection workload, and improving the detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Mirror defect detection method, device, equipment and readable storage medium Technical Field

[0001] This application relates to the field of detection technology, particularly lens detection technology, and can be applied to lens mirror defect detection scenarios. Specifically, this application discloses a mirror defect detection method, device, equipment, and readable storage medium. Background Art

[0002] With the continuous development of smart terminal technology, people's requirements for the image quality of terminal imaging components are becoming increasingly higher. The image quality of imaging components is closely related to both software and hardware. In other words, it depends not only on the image processing process of the image signal processing unit (ISP), but also on the quality of hardware such as the lens. However, some processing errors are inevitable during the manufacturing process of the imaging component lens, and the mirror surface is more susceptible to dust and stains during the subsequent assembly and testing process, all of which can lead to reduced image quality.

[0003] In order to improve the yield rate of lenses and factory delivery efficiency, it is usually necessary to perform mirror defect detection before the lens leaves the factory. The lens defect detection method used in related technologies is usually to manually identify and detect the mirror surface under a microscope. On the one hand, this method requires the use of complex detection instruments, which has high detection costs. On the other hand, it needs to rely on manual identification, which has a large detection workload and low detection accuracy.

[0004] It is important to note that the techniques described in this section are not necessarily those that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any technique described in this section is prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized as prior art. Technical issues

[0005] The present application provides a mirror defect detection method, device, equipment and readable storage medium, which can at least solve the problems of high detection cost, large detection workload and low detection accuracy of the mirror defect detection method provided in the related art. Technical Solutions

[0006] To solve the above technical problems, the first aspect of the present application provides a mirror defect detection method, including: obtaining a RAW image captured by an imaging module equipped with a lens to be inspected; separating the RAW image into four single-channel images, and performing mean filtering on each of the single-channel images to obtain a filtered image; performing a subtraction operation on each of the filtered images and the corresponding single-channel image to obtain a difference image, and binarizing each of the difference images to obtain a binarized difference image; obtaining a corresponding first image connected domain based on each of the binarized difference images, and mapping the first image connected domains of all channels to the RAW image for merging to obtain a merged connected domain corresponding to the RAW image; if the total number of pixels included in the merged connected domain is greater than or equal to a preset first threshold, outputting a first mirror defect detection result corresponding to the lens to be inspected based on the image position information of the merged connected domain.

[0007] To solve the above technical problems, the second aspect of the present application provides a mirror defect detection device, comprising: an image acquisition module for acquiring a RAW image captured by an imaging module equipped with a lens to be inspected; a filtering processing module for separating the RAW image into four single-channel images, and performing mean filtering on each of the single-channel images to obtain a filtered image; a binarization processing module for performing a subtraction operation on each of the filtered images and the corresponding single-channel image to obtain a difference image, and performing binarization on each of the difference images to obtain a binary difference image; a connected domain acquisition module for acquiring a corresponding first image connected domain based on each of the binarized difference images, and mapping the first image connected domains of all channels to the RAW image for merging to obtain a merged connected domain corresponding to the RAW image; and a result output module for outputting a first mirror defect detection result corresponding to the lens to be inspected based on the image position information of the merged connected domain if the total number of pixels included in the merged connected domain is greater than or equal to a preset first threshold.

[0008] The third aspect of the present application provides an electronic device, comprising: a memory and a processor, wherein the processor is used to execute a computer program stored on the memory; when the processor executes the computer program, it implements each step of the mirror defect detection method provided in the first aspect of the present application.

[0009] The fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the mirror defect detection method provided in the first aspect of the present application are implemented. Beneficial effects

[0010] As can be seen from the above, according to the mirror defect detection method, device, equipment and readable storage medium provided by the present application, a RAW image captured by an imaging module equipped with a lens to be detected is obtained; the RAW image is separated into four single-channel images, and each single-channel image is subjected to mean filtering; each filtered image is subtracted from the corresponding single-channel image to obtain a difference image, and each difference image is binarized; the corresponding image connected domain is obtained according to each binarized difference image, and the image connected domains of all channels are mapped to the RAW image for merging to obtain a merged connected domain corresponding to the RAW image; if the total number of pixels included in the merged connected domain is greater than or equal to a preset threshold, the mirror defect detection result corresponding to the lens to be detected is output according to the image position information of the merged connected domain. Through the implementation of the present application, mirror defect detection is performed using computer vision, which does not require complex detection instruments and does not rely on manual identification of defects, effectively reducing detection costs and detection workload, and improving detection accuracy.

[0011] It should be understood that the content described in this section is not intended to identify the key or important features of this application, nor is it intended to limit the scope of this application. Other features of this application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings illustrate exemplary embodiments and constitute a part of the specification. Together with the description of the specification, they serve to explain exemplary implementations of the embodiments. The drawings are shown for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals designate similar, but not necessarily identical, elements.

[0013] FIG1 is a schematic diagram of the basic flow of a mirror defect detection method provided by an embodiment of the present application;

[0014] FIG2 is a schematic diagram of image region division provided by an embodiment of the present application;

[0015] FIG3 is a schematic diagram of a dust detection result provided by an embodiment of the present application;

[0016] FIG4 is a schematic diagram of a flatness defect detection result provided by an embodiment of the present application;

[0017] FIG5 is a schematic diagram of another image region division according to an embodiment of the present application;

[0018] FIG6 is a pseudo-color image based on image data greater than 0 provided by an embodiment of the present application;

[0019] FIG7 is a pseudo-color image based on image data less than 0 provided by an embodiment of the present application;

[0020] FIG8 is a pseudo-color image based on image gradient provided by an embodiment of the present application;

[0021] FIG9 is a schematic diagram of a detailed flow chart of a mirror dust detection method provided in one embodiment of the present application;

[0022] FIG10 is a schematic diagram of a detailed process of a mirror flatness defect detection method provided in one embodiment of the present application;

[0023] FIG11 is a schematic diagram of a detailed flow chart of another mirror flatness defect detection method provided in one embodiment of the present application;

[0024] FIG12 is a schematic diagram of functional modules of a mirror defect detection device provided by an embodiment of the present application;

[0025] FIG13 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. Modes for Carrying Out the Invention

[0026] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of this application.

[0027] It should be noted that in the description of the embodiments of the present application, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0028] In order to solve the problems of high detection cost, large detection workload and low detection accuracy of the mirror defect detection methods provided in the related art, an embodiment of the present application provides a mirror defect detection method. FIG1 is a basic flow chart of the mirror defect detection method provided by this embodiment. The mirror defect detection method includes the following steps:

[0029] Step 101: Obtain a RAW image captured by an imaging module equipped with a lens to be inspected.

[0030] Specifically, although related art provides a solution for defect detection of a lens to be inspected by using an independent imaging device to image the lens to be inspected and then performing image analysis, this solution can only detect defects within the lens and cannot detect mirror defects. To overcome this limitation, this embodiment, based on the characteristic of the lens being able to carry a module for imaging, designs an imaging module equipped with the lens to be inspected to capture images, and uses this as a basis for detecting mirror defects. It should be understood that a RAW image refers to unprocessed raw phase data, which records the raw data of the light signal captured by the CMOS or CCD image sensor converted into a digital signal.

[0031] Step 102: Separate the RAW image into four single-channel images, and perform mean filtering on each single-channel image to obtain a filtered image.

[0032] Specifically, this embodiment separates the RAW image into four channels: R, Gr, Gb, and B, and then performs image processing on each of the four channels. First, this embodiment performs mean filtering on each channel image. Mean filtering is a typical linear filtering algorithm. Its implementation principle is to declare a template for the target pixel on the image and then replace the original pixel value with the average value of all pixels in the template. Mean filtering can help eliminate sharp noise in the image and is a low-pass filter that can achieve image smoothing.

[0033] Step 103 : performing a subtraction operation on each filtered image and the corresponding single-channel image to obtain a difference image, and performing a binarization process on each difference image to obtain a binarized difference image.

[0034] Specifically, this embodiment subtracts the filtered image from the original image to generate a difference image. The generated difference image for each channel can well reflect image changes, with unchanged image areas having a value of 0. Although the difference image can reflect image changes, it is still not obvious enough. Therefore, this embodiment further performs image binarization on the difference image. Image binarization is to set the grayscale value of the pixels on the image to 0 or 255, which will make the entire image appear to be in black and white. In digital image processing, binary images play a very important role. Image binarization can greatly reduce the amount of data in the image, thereby highlighting the outline of the target.

[0035] Step 104 : Obtain corresponding first image connected domains according to each binary difference image, and map the first image connected domains of all channels to the RAW image for merging to obtain a merged connected domain corresponding to the RAW image.

[0036] Specifically, this embodiment detects valid points in each binary difference image, then obtains the connected domain of the single-channel image based on the valid points. Next, the connected domain detection results of each single channel are merged to obtain the connected domain on the RAW image. It is worth noting that the connected domain in this embodiment refers to the image area composed of multiple specific pixels with connectivity.

[0037] In some implementations of this embodiment, the above-mentioned step of obtaining the corresponding first image connected domain based on each binarized difference image includes: dividing the binarized difference image into different image regions; assigning corresponding comparison thresholds to different image regions; and determining the image region connected by multiple pixel points whose pixel values ​​in the binarized difference image are less than or equal to the corresponding comparison threshold as the first image connected domain.

[0038] Specifically, in actual applications, different areas of a lens have different physical properties, and thus different imaging properties. To improve detection accuracy, this embodiment divides the image into different areas and sets different comparison thresholds for different image areas to acquire valid points. That is, when determining whether a pixel point in a different image area is a valid point, the comparison threshold corresponding to the area where the pixel point is located is used as a reference. If the pixel value is less than or equal to the comparison threshold, it is a valid point, thereby ensuring the accuracy of the acquired connected domain.

[0039] In some implementations of this embodiment, the above-mentioned step of dividing the binarized difference image into different image areas includes: selecting the edge image area of ​​the binarized difference image based on the image size and the preset edge coefficient; and determining the image area other than the edge image area on the binarized difference image as the intermediate image area.

[0040] Specifically, the image regions divided in this embodiment preferably include edge image regions and intermediate image regions. FIG2 is a schematic diagram of image region division provided by this embodiment, in which A represents the intermediate image region and B represents the edge image region. The sizes of the edge image region and the intermediate image region can be set by presetting edge coefficients. The edge coefficients are values ​​that can be flexibly set according to the application scenario. For example, if the edge coefficient relativeBorder = 5 and the image size is 1600*1200, then 1600*5% = 80 and 1200*5% = 60. In other words, the region defined by 80 pixels inward from the left and right borders and 60 pixels inward from the upper and lower borders is the edge image region.

[0041] Step 105: If the total number of pixels included in the merged connected domain is greater than or equal to a preset first threshold, output a first mirror defect detection result corresponding to the lens to be inspected according to the image position information of the merged connected domain.

[0042] Specifically, the first mirror defect detection result of this embodiment is used to indicate the coordinate position and size of the mirror dust area. In this embodiment, the number of pixels in the merged connected domain of the RAW image is counted. For the merged connected domain with a number of pixels greater than or equal to a preset threshold, it is determined that dust exists at the mirror position corresponding to the connected domain, and it is an unqualified mirror area. As shown in Figure 3, a schematic diagram of a dust detection result provided by this embodiment is shown. In the figure, the circle indicates the area where the mirror dust is located, [POD] represents the dust detection item, [4042,1611,12,11] is the coordinate position of the mirror dust area, and [size22] is the size of the mirror dust. The detection result output by this embodiment can intuitively indicate the mirror defects of the lens.

[0043] In some implementations of this embodiment, after the above-mentioned step of obtaining a RAW image captured by an imaging module equipped with a lens to be inspected, the method further includes: obtaining a Y-channel image corresponding to the RAW image; performing shadow correction processing on the Y-channel image to obtain a corresponding shadow-corrected image; determining a first valid pixel point based on the pixel value of the shadow-corrected image; if the total number of first valid pixels in the same second image connected domain is greater than or equal to a preset second threshold, outputting a second mirror defect detection result corresponding to the lens to be inspected based on the image position information of the second image connected domain.

[0044] Specifically, in practical applications, the mirror surface of a lens is not a flat surface but a curved surface with an arc. This also means that the precision requirements for mirror processing are extremely high. During the processing process, mirror flatness errors are inevitable. If the mirror surface has protrusions or depressions, it will cause errors in the transmission of light into the image sensor, resulting in shadows or highlights that should not appear. In this embodiment, a mirror flatness detection method is further provided based on the aforementioned RAW image. First, the Y channel mean is obtained, that is, the Y channel image is calculated. Then, shading correction (LSC) is performed on the Y channel image to eliminate shadows around the lens caused by the uneven optical refractive index of the lens. The specific implementation method of shading correction is to determine the sampling frequency, sample the reduced image, perform data fitting on each column data, perform data fitting on the row data, and finally generate a fitted surface. The fitted surface is then combined with the original data for calculation and processing to obtain the shadow-corrected image. Next, this embodiment determines the effective points of the image detection after shadow correction, and then performs morphological processing on the effective points, that is, detects connected domains, and finally screens out connected domains with the number of effective points greater than or equal to the preset threshold, and outputs the mirror defect detection result with flatness defects. It is worth noting that the second mirror defect detection result of this embodiment is used to indicate the coordinate position of the uneven mirror area. As shown in Figure 4, a schematic diagram of a flatness defect detection result provided by this embodiment is shown. The dotted box in the figure indicates the mirror area with flatness defects, [POG] represents the flatness defect detection item, and [2592,2146,934,959] is the coordinate position of the flatness defect area. The detection result output by this embodiment can intuitively indicate the flatness defect of the lens.

[0045] In some implementations of this embodiment, the above-mentioned step of determining the first effective pixel point based on the pixel value of the shadow-corrected image includes: separating the shadow-corrected image into a first image with pixel values ​​greater than 0 and a second image with pixel values ​​less than 0; and respectively determining the pixel points in the first image and the second image whose pixel values ​​are greater than or equal to the corresponding comparison threshold as the first effective pixel points.

[0046] Specifically, this embodiment separates data greater than zero and data less than zero in the shading-corrected image, obtaining two separated images. Valid points exceeding the threshold are determined in each of the two separated images based on a threshold. It should be noted that different thresholds are used for valid point determination in different image regions. Similarly, this embodiment can refer to the aforementioned relativeBorder coefficient for region segmentation, which will not be further described here.

[0047] In some implementations of this embodiment, after the step of obtaining the Y channel image corresponding to the RAW image, the method further includes: calculating the gradient values ​​of all pixels in the Y channel image; determining second valid pixels from all pixels based on the gradient values; and outputting a third mirror defect detection result corresponding to the lens to be inspected based on the image position information of the third image connected domain if the total number of second valid pixels in the same third image connected domain is greater than or equal to a preset third threshold.

[0048] Specifically, this embodiment can also detect mirror flatness defects based on image gradients. First, this embodiment calculates the gradient of the Y channel image. Image gradient calculation can be implemented using the Sobel operator. The Sobel theory is based on the following: if an image edge appears, the image grayscale will change to a certain extent. For convenience, assume that a gradient from black to white represents a boundary. Then, analyze its grayscale. The grayscale function at the edge is a linear function y=kx. The result of taking its first-order derivative is its slope k. In other words, the first-order derivative of the image edge is a constant. Since the first-order derivative of non-edges is zero, the image edge can be preliminarily determined by taking the first-order derivative. Usually, the derivative in the X and Y directions, that is, the gradient, is used to obtain the image edge in this way. This embodiment determines the valid points in the image based on the image gradient, then performs morphological processing on the valid points, that is, detecting connected domains. Finally, the connected domains with a number of valid points greater than or equal to a preset threshold are screened out, and the mirror defect detection result with flatness defects is output accordingly. It is worth noting that the third mirror defect detection result of this embodiment is also used to indicate the coordinate location of the uneven mirror area.

[0049] In some implementations of the present embodiment, the above-mentioned step of determining the second effective pixel point from all pixel points based on the gradient value includes: dividing the Y channel image into an edge image area and an intermediate image area; dividing the edge image area into a side image area and a corner image area, and dividing the intermediate image area into a center image area and a middle image area outside the center image area; assigning corresponding comparison thresholds to the side image area, the corner image area, the center image area, and the middle image area, respectively; and determining the second effective pixel point from all pixel points based on the comparison result of the gradient value of the pixel point in each image area with the corresponding comparison threshold.

[0050] Specifically, different from the area division method adopted by the aforementioned dust detection scheme, this embodiment divides the image into edge image area, corner image area, center image area and middle image area, and the four areas are respectively assigned different comparison thresholds. As shown in Figure 5, another image area division schematic diagram provided by this embodiment, in Figure 5, ① represents the center image area, ② represents the middle image area, ③ represents the edge image area, and ④ represents the corner image area.

[0051] It should be noted that in order to better indicate the defect detection results and improve the recognition of defect details, the present embodiment further performs pseudo-color processing on the mirror defect detection results, and outputs pseudo-color images corresponding to each mirror defect detection result. Pseudo-color processing is to convert a monochrome image into an image with color distribution according to certain criteria. Since the human eye's ability to resolve color images is much higher than its ability to resolve gray, converting grayscale into color representation can improve the ability to resolve image details. As shown in Figure 6, a pseudo-color image based on image data greater than 0 is provided in the present embodiment, as shown in Figure 7, a pseudo-color image based on image data less than 0 is provided in the present embodiment; as shown in Figure 8, a pseudo-color image based on image gradient is provided in the present embodiment. Pseudo-color processing of an image can improve the human eye's ability to resolve image details and achieve the purpose of image enhancement.

[0052] To better understand the present application, an embodiment of the present application provides a refined mirror dust detection method. FIG9 is a flow chart of a refined mirror dust detection method provided by this embodiment. The mirror dust detection method includes:

[0053] Step 901: Obtain a RAW image captured by an imaging module equipped with a lens to be inspected;

[0054] Step 902: Separate the RAW image into four single-channel images, and perform mean filtering on each single-channel image to obtain a filtered image.

[0055] Step 903: performing a subtraction operation on each filtered image and the corresponding single-channel image to obtain a difference image, and performing a binarization process on each difference image to obtain a binarized difference image;

[0056] Step 904: Select an edge image region of the binary difference image according to the image size and a preset edge coefficient;

[0057] Step 905: Determine the image area other than the edge image area on the binary difference image as the intermediate image area;

[0058] Step 906: assigning corresponding comparison thresholds to different image regions;

[0059] Step 907: Determine an image region connected by a plurality of pixels whose pixel values ​​are less than or equal to a corresponding comparison threshold in the binary difference image as an image connected region;

[0060] Step 908: Map the image connected domains of all channels to the RAW image and merge them to obtain a merged connected domain corresponding to the RAW image;

[0061] Step 909: If the total number of pixels included in the merged connected domain is greater than or equal to a preset threshold, output a mirror dust detection result corresponding to the lens to be detected according to the image position information of the merged connected domain.

[0062] Next, an embodiment of the present application provides a refined mirror flatness defect detection method. FIG10 is a flow chart of a refined mirror flatness defect detection method provided by this embodiment. The mirror flatness defect detection method includes:

[0063] Step 1001: Obtain a RAW image captured by an imaging module equipped with a lens to be inspected;

[0064] Step 1002: Obtain the Y channel image corresponding to the RAW image;

[0065] Step 1003: Perform shadow correction processing on the Y channel image to obtain a corresponding shadow-corrected image;

[0066] Step 1004: Separate the shadow-corrected image into a first image with pixel values ​​greater than 0 and a second image with pixel values ​​less than 0;

[0067] Step 1005: Determine pixels in the first image and the second image whose pixel values ​​are greater than or equal to corresponding comparison thresholds as valid pixels;

[0068] Step 1006: If the total number of valid pixels in the same image connected domain is greater than or equal to a preset threshold, outputting a mirror flatness defect detection result corresponding to the lens to be inspected based on the image position information of the image connected domain;

[0069] Step 1007: Perform pseudo-color processing on the mirror surface flatness defect detection result and output a corresponding pseudo-color image.

[0070] Finally, an embodiment of the present application further provides another refined mirror flatness defect detection method. FIG10 is a flow chart of another refined mirror flatness defect detection method provided by this embodiment. The mirror flatness defect detection method includes:

[0071] Step 1101: Obtain a RAW image captured by an imaging module equipped with a lens to be inspected;

[0072] Step 1102: Obtain the Y channel image corresponding to the RAW image;

[0073] Step 1103: Calculate the gradient values ​​of all pixels in the Y channel image;

[0074] Step 1104: Divide the Y channel image into an edge image region and a middle image region;

[0075] Step 1105: Divide the edge image region into a side image region and a corner image region, and divide the middle image region into a central image region and a middle image region outside the central image region;

[0076] Step 1106: assigning corresponding comparison thresholds to the side image area, the corner image area, the center image area, and the middle image area respectively;

[0077] Step 1107: determining valid pixels from all pixels based on the comparison results of the gradient values ​​of the pixels in each image region with the corresponding comparison thresholds;

[0078] Step 1108: If the total number of valid pixels in the same image connected domain is greater than or equal to a preset threshold, output a mirror flatness defect detection result corresponding to the lens to be inspected based on the image position information of the image connected domain;

[0079] Step 1109: Perform pseudo-color processing on the mirror flatness defect detection result and output a corresponding pseudo-color image.

[0080] It should be understood that the size of the serial numbers of the steps in the above-mentioned method embodiments does not mean the order of execution of the steps. The execution order of each step should be determined by its function and internal logic, and should not constitute a sole limitation on the implementation process of the embodiments of this application.

[0081] FIG12 is a schematic diagram of the functional modules of a mirror defect detection device provided in one embodiment of the present application, which can be applied to the aforementioned mirror defect detection method. The mirror defect detection device mainly includes:

[0082] The image acquisition module 1201 is used to acquire a RAW image captured by an imaging module equipped with a lens to be inspected;

[0083] The filtering processing module 1202 is used to separate the RAW image into four single-channel images and perform mean filtering on each single-channel image to obtain a filtered image;

[0084] A binarization processing module 1203 is used to perform a subtraction operation on each filtered image and the corresponding single-channel image to obtain a difference image, and to perform a binarization process on each difference image to obtain a binarized difference image;

[0085] A connected domain acquisition module 1204 is configured to acquire a corresponding first image connected domain from each binary difference image, and map the first image connected domains of all channels to a RAW image for merging to obtain a merged connected domain corresponding to the RAW image.

[0086] The result output module 1205 is configured to output a first mirror defect detection result corresponding to the lens to be inspected according to the image position information of the merged connected domain if the total number of pixels included in the merged connected domain is greater than or equal to a preset first threshold.

[0087] In some implementations of this embodiment, the mirror defect detection device also includes: a correction processing module and a determination module, wherein the acquisition module is further used to acquire a Y channel image corresponding to the RAW image; the correction processing module is used to perform shadow correction processing on the Y channel image to obtain a corresponding shadow-corrected image; the determination module is used to determine a first valid pixel point based on the pixel value of the shadow-corrected image; the result output module is further used to output a second mirror defect detection result corresponding to the lens to be inspected based on the image position information of the second image connected domain if the total number of first valid pixels in the same second image connected domain is greater than or equal to a preset second threshold.

[0088] In some implementations of this embodiment, the mirror defect detection device further includes: a gradient calculation module for calculating the gradient values ​​of all pixels in the Y channel image; the above-mentioned determination module is further used to determine second valid pixels from all pixels based on the gradient values; and the above-mentioned result output module is further used to output a third mirror defect detection result corresponding to the lens to be inspected based on the image position information of the third image connected domain if the total number of second valid pixels in the same third image connected domain is greater than or equal to a preset third threshold.

[0089] It should be noted that the mirror defect detection methods in the aforementioned embodiments can all be implemented based on the mirror defect detection device provided in this embodiment. Ordinary technicians in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working process of the mirror defect detection device described in this embodiment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0090] Based on the above technical solution provided by the embodiment of the present application, a RAW image captured by an imaging module equipped with a lens to be inspected is obtained; the RAW image is separated into four single-channel images, and each single-channel image is subjected to mean filtering; each filtered image is subtracted from the corresponding single-channel image to obtain a difference image, and each difference image is binarized; the corresponding image connected domain is obtained according to each binarized difference image, and the image connected domains of all channels are mapped to the RAW image for merging to obtain a merged connected domain corresponding to the RAW image; if the total number of pixel points included in the merged connected domain is greater than or equal to a preset threshold, the mirror defect detection result corresponding to the lens to be inspected is output according to the image position information of the merged connected domain. Through the implementation of the present application, mirror defect detection is performed using computer vision, which does not require complex detection instruments and does not rely on manual identification of defects, effectively reducing detection costs and detection workload, and improving detection accuracy.

[0091] Please refer to FIG13 , which shows an electronic device provided in one embodiment of the present application. The electronic device can be used to implement the mirror defect detection method in the aforementioned embodiment. As shown in FIG13 , the electronic device mainly includes:

[0092] Memory 1301, processor 1302, and bus 1303 are connected to each other via bus 1303. Memory 1301 stores a computer program that can be executed by processor 1302. When processor 1302 executes the computer program, the mirror surface defect detection method described in the aforementioned embodiment is implemented. The number of processors can be one or more.

[0093] The memory 1301 can be a high-speed random access memory (RAM) memory or a non-volatile memory such as a disk drive. The memory 1301 is used to store executable program code. The processor 1302 is coupled to the memory 1301 .

[0094] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, which may be provided in the electronic device in each of the above embodiments, and the computer-readable storage medium may be the memory in the embodiment shown in FIG. 13 .

[0095] The computer-readable storage medium stores a computer program that, when executed by a processor, implements the mirror surface defect detection method described in the aforementioned embodiment. Furthermore, the computer-readable storage medium may be a USB flash drive, a mobile hard drive, a read-only memory (ROM), RAM, a magnetic disk, or an optical disk, among other media capable of storing program code.

[0096] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0097] Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of these modules may be selected to achieve the purpose of this embodiment based on actual needs.

[0098] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.

[0099] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of this application. The aforementioned readable storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0100] It should be noted that for the aforementioned method embodiments, for ease of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0101] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0102] The above is a description of the mirror defect detection method, device, equipment and readable storage medium provided by this application. For those skilled in the art, based on the ideas of the embodiments of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A mirror defect detection method, characterized in that: include: Obtain a RAW image captured by an imaging module equipped with a lens to be inspected; Separating the RAW image into four single-channel images, and performing mean filtering on each of the single-channel images to obtain a filtered image; Subtracting each of the filtered images from the corresponding single-channel image to obtain a difference image, and binarizing each of the difference images to obtain a binarized difference image; Acquire a corresponding first image connected domain according to each of the binary difference images, and map the first image connected domains of all channels to the RAW image for merging, to obtain a merged connected domain corresponding to the RAW image; If the total number of pixels included in the merged connected domain is greater than or equal to a preset first threshold, a first mirror defect detection result corresponding to the lens to be inspected is output according to the image position information of the merged connected domain.

2. The mirror defect detection method according to claim 1, characterized in that: The step of acquiring the corresponding first image connected domain according to each of the binary difference images comprises: Dividing the binary difference image into different image regions; assigning corresponding comparison thresholds to different image regions respectively; An image region connected by a plurality of pixel points whose pixel values ​​are less than or equal to the corresponding comparison threshold in the binary difference image is determined as a first image connected region.

3. The mirror defect detection method according to claim 2, characterized in that: The step of dividing the binary difference image into different image areas comprises: Selecting an edge image region of the binary difference image according to an image size and a preset edge coefficient; An image area other than the edge image area on the binary difference image is determined as an intermediate image area.

4. The mirror defect detection method according to claim 1, characterized in that: After the step of obtaining the RAW image collected by the imaging module equipped with the lens to be tested, the method further includes: Obtain the Y channel image corresponding to the RAW image; Performing shadow correction processing on the Y channel image to obtain a corresponding shadow-corrected image; Determining a first effective pixel point according to a pixel value of the shadow-corrected image; If the total number of the first valid pixels in the same second image connected domain is greater than or equal to a preset second threshold, a second mirror defect detection result corresponding to the lens to be inspected is output according to the image position information of the second image connected domain.

5. The mirror defect detection method according to claim 4, characterized in that: After the step of obtaining the Y channel image corresponding to the RAW image, the method further includes: Calculate the gradient values ​​of all pixels in the Y channel image; Determine a second valid pixel point from all the pixel points based on the gradient value; If the total number of the second valid pixels in the same third image connected domain is greater than or equal to a preset third threshold, a third mirror defect detection result corresponding to the lens to be inspected is output according to the image position information of the third image connected domain.

6. The mirror defect detection method according to claim 4, characterized in that: The step of determining the first effective pixel point according to the pixel value of the shadow-corrected image comprises: Separating the shadow-corrected image into a first image having pixel values ​​greater than 0 and a second image having pixel values ​​less than 0; Pixel points in the first image and the second image whose pixel values ​​are greater than or equal to corresponding comparison thresholds are respectively determined as first valid pixel points.

7. The mirror defect detection method according to claim 5, characterized in that: The step of determining a second effective pixel point from all the pixel points based on the gradient value comprises: Dividing the Y channel image into an edge image region and a middle image region; Dividing the edge image region into a side image region and a corner image region, and dividing the middle image region into a center image region and a middle image region outside the center image region; assigning corresponding comparison thresholds to the side image area, the corner image area, the center image area, and the middle image area respectively; Based on the comparison result of the gradient value of the pixel point in each image area and the corresponding comparison threshold, a second valid pixel point is determined from all the pixel points.

8. A mirror defect detection device, characterized in that: include: An image acquisition module, used to acquire a RAW image captured by an imaging module equipped with a lens to be detected; A filtering processing module, used for separating the RAW image into four single-channel images, and performing mean filtering on each of the single-channel images to obtain a filtered image; A binarization processing module, used for performing a subtraction operation on each of the filtered images and the corresponding single-channel image to obtain a difference image, and performing a binarization process on each of the difference images to obtain a binarized difference image; A connected domain acquisition module, used for acquiring a corresponding first image connected domain according to each of the binary difference images, and mapping the first image connected domains of all channels to the RAW image for merging, to obtain a merged connected domain corresponding to the RAW image; The result output module is used to output a first mirror defect detection result corresponding to the lens to be inspected according to the image position information of the merged connected domain if the total number of pixels included in the merged connected domain is greater than or equal to a preset first threshold.

9. An electronic device, characterized in that: include: Memory and processor; The processor is used to execute the computer program stored in the memory; When the processor executes the computer program, the steps of the mirror defect detection method described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the mirror defect detection method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Stain detection and classification method and device for sensor of digital camera

    CN104867159A

  • Lens shadow evaluation method and device, equipment, medium and lens module

    CN113516636A

  • Lens dirt identification method and device, computer equipment and storage medium

    CN114359414A

  • Product defect detection method, device and equipment and readable storage medium

    CN114937037A

  • State detection method and apparatus for camera lens, device and storage medium

    WO2022088620A1

Cited By

  • Image detection method for particle pollution on surface of semiconductor wafer

    CN120388015A

  • Edible commodity packaging box damage abnormity detection method

    CN120707564A

  • Metal plate edge machining burr detection method and system, computer and storage medium

    CN120953280A

  • Mirror surface appearance defect detection method and system

    CN122175987A