Lens defect detection method and system based on image processing

By acquiring information on local brightness variance, spatial frequency distribution, and brightness gradient changes in lens images, background interference can be identified and suppressed, solving the problems of misidentification and missed detection in existing lens defect detection systems under complex industrial environments, and achieving more efficient defect detection.

CN121860983APending Publication Date: 2026-04-14SHENZHEN GUOLIN OPTICAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202512047874.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing lens defect detection systems struggle to effectively distinguish and suppress complex background interferences, such as uneven background brightness fluctuations caused by thermal noise from image sensors and interference fringes caused by residual cleaning agents. This leads to misidentification and missed detection, resulting in decreased detection accuracy and reliability.

Method used

By acquiring target background interference feature information in the initial image to be tested of the lens, including local brightness variance, spatial frequency distribution map and brightness gradient change information, background interference is identified and suppressed to obtain the target image to be tested. Finally, the defects of the lens are identified based on the target image to be tested.

Benefits of technology

It significantly improves the accuracy and reliability of lens defect detection, reduces false alarm and false negative rates, and increases detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121860983A_ABST
    Figure CN121860983A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and provides a lens defect detection method and system based on image processing, and the method comprises the steps: obtaining target background interference feature information of background interference in an initial to-be-detected image of a lens; determining interference information of background interference in the initial to-be-detected image according to the target background interference feature information; suppressing the background interference in the initial to-be-detected image according to the interference information of the background interference to obtain a target to-be-detected image; and recognizing defects of the lens based on the target to-be-detected image. The lens defect detection efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a lens defect detection method and system based on image processing. Background Technology

[0002] In the manufacturing process of lenses, especially for optical components with extremely high precision requirements, such as lenses used in high-end camera lenses, medical endoscopes, or AR / VR device display modules, surface quality is crucial in determining product performance. Traditional methods relying on human eyes for inspection are not only inefficient but also prone to fatigue due to prolonged work, leading to missed defects. To address these issues, researchers have begun to utilize image processing technology to automate the identification of minute defects such as scratches, bubbles, and stains on lens surfaces. This automated inspection system uses industrial cameras to capture lens images, which are then analyzed by computer programs, aiming to significantly improve inspection efficiency and accuracy.

[0003] However, in real-world industrial production environments, industrial camera systems do not always maintain ideal operating conditions. Because production lines need to operate continuously for extended periods, the electronic components inside industrial cameras continuously generate heat, causing the operating temperature of the image sensor to rise. Under sustained, slightly higher operating temperatures, the inherent properties of the internal semiconductor materials of the image sensor change, generating additional dark current, which manifests as random thermal noise. This noise is not uniformly distributed in the acquired image but rather presents as subtle fluctuations in background brightness, exhibiting a degree of randomness and time-varying characteristics, making it difficult to accurately predict and compensate for using simple mathematical models.

[0004] These subtle fluctuations in background brightness caused by thermal noise from image sensors pose a significant challenge to existing image preprocessing techniques. Image processing algorithms that rely on fixed thresholds for binarization or employ simple background subtraction logic often struggle to effectively distinguish and suppress such dynamic and non-uniform noise. For example, a fixed binarization threshold intended to identify dark scratches might misidentify slightly dim noise areas in the background as minute defect signals, resulting in false alarms. Conversely, if a genuine micron-sized scratch happens to be located in a slightly brighter noise area, its contrast may be weakened or even completely submerged in the background fluctuations, leading to missed detection. These misidentifications and missed detections significantly reduce the accuracy and reliability of the detection system, resulting in low efficiency in lens defect detection. Summary of the Invention

[0005] This application provides a lens defect detection method and system based on image processing, which can improve the efficiency of lens detection.

[0006] To achieve the above objectives, this application adopts the following technical solution: In a first aspect, this application discloses a lens defect detection method based on image processing. The method includes: acquiring target background interference feature information of background interference in an initial image to be detected of the lens; determining interference information of background interference in the initial image to be detected based on the target background interference feature information; suppressing background interference in the initial image to be detected based on the interference information of background interference to obtain a target image to be detected; and identifying lens defects based on the target image to be detected.

[0007] Further, the target background interference feature information of the initial image to be detected of the lens is obtained, including: obtaining the initial image to be detected of the lens; and using the local brightness variance, spatial frequency distribution map and brightness gradient change information of the initial image to be detected as the target background interference feature information of the initial image to be detected.

[0008] More specifically, in some implementations, the local brightness variance includes the brightness variance of each pixel in the initial image to be detected. Determining the local brightness variance of the initial image to be detected includes: for each pixel in the initial image to be detected, taking a rectangular region with the pixel as the center and a side length of a preset length as the local region corresponding to the pixel; calculating the brightness variance of each pixel to obtain the local brightness variance of the initial image to be detected; the brightness variance is the variance of the brightness of all pixels in the local region corresponding to the pixel.

[0009] Based on this, the interference information of the background interference in the initial image to be detected is determined according to the target background interference feature information, including: determining the position and interference type of each background interference in the initial image to be detected according to the target background interference feature information; and using the position and interference type of the background interference as the interference information of the background interference.

[0010] Preferably, determining the location and type of each background interference in the initial image to be detected based on the target background interference feature information includes: for each pixel among multiple pixels, determining whether the brightness variance of the pixel is greater than a preset variance threshold; if so, determining the location of the background interference in the initial image to be detected as the location of the pixel, and the interference type as random thermal noise; determining whether there are interference fringes in the initial image to be detected based on the spatial frequency distribution map and brightness gradient change information of the initial image to be detected; if so, determining the location of the background interference in the initial image to be detected as the location of the interference fringe, and the interference type as interference fringe interference.

[0011] Based on the above, the presence of interference fringes in the initial image to be detected is determined according to the spatial frequency distribution map and brightness gradient change information of the initial image to be detected, including: determining a first region in the initial image to be detected based on the spatial frequency distribution map; the energy value of the first region in the spatial frequency distribution map is greater than a preset energy value; determining a second region in the image to be detected based on the brightness gradient change information; the brightness gradient change value of the second region is greater than a preset gradient change value; if the first region and the second region overlap, the overlapping region is taken as the interference fringe in the initial image to be detected.

[0012] In some preferred embodiments, suppressing background interference in the initial image to be detected based on the interference information of the background interference to obtain the target image to be detected includes: determining whether the interference type of the background interference in the initial image to be detected is all random thermal noise; if the interference type of the background interference is all random thermal noise, for each background interference, for each background interference, the local region corresponding to the pixel in the neighborhood of the pixel where the background interference is located in the initial image to be detected is taken as a first local region; determining the similarity between all pixels in the first local region and all pixels in the local region corresponding to the pixel where the background interference is located; taking the first local region with a similarity greater than a preset similarity threshold as a second local region; obtaining a first correspondence; the first correspondence includes a one-to-one correspondence between multiple similarities and multiple weight values; the weight value is positively correlated with the corresponding similarity; for each second local region, taking the weight value corresponding to the similarity of the second local region in the first correspondence as the target weight value corresponding to the second local region; taking the product of the pixel value of the center pixel of each second local region and the corresponding target weight value as a sub-pixel value; taking the sum of multiple sub-pixel values ​​as the pixel value of the pixel where the background interference is located to obtain the target image to be detected.

[0013] As an optional approach, the background interference in the initial image to be detected is suppressed based on the interference information of the background interference to obtain the target image to be detected, including: determining whether the interference type of the background interference in the initial image to be detected is interference fringe interference; if the interference type of the background interference is interference fringe interference, performing a two-dimensional Fourier transform on the initial image to be detected to obtain a first image to be detected; attenuating the energy of the frequency points at the location of the background interference in the first image to be detected to zero to obtain a second image to be detected; and performing an inverse Fourier transform on the second image to be detected to obtain the target image to be detected.

[0014] To enhance functionality, background interference in the initial image to be detected is suppressed based on the interference information of the background interference to obtain the target image to be detected. This includes: determining whether the interference type of the background interference in the initial image to be detected includes interference fringes and random thermal noise; if so, decomposing the initial image to be detected into a low-frequency image and a high-frequency image using wavelet transform; applying an interference suppression strategy corresponding to random thermal noise for the background interference in the low-frequency image to obtain the processed low-frequency image; applying an interference suppression strategy corresponding to interference fringes for the background interference in the high-frequency image to obtain the processed high-frequency image; and reconstructing the processed low-frequency image and the processed high-frequency image to obtain the target image to be detected.

[0015] Secondly, this application also discloses a lens defect detection system based on image processing. The system includes: an acquisition device and a processing device; the acquisition device is used to acquire target background interference feature information of background interference in an initial image to be detected of the lens; the processing device is used to determine interference information of background interference in the initial image to be detected based on the target background interference feature information. The background interference in the initial image to be detected is suppressed based on the interference information of the background interference to obtain the target image to be detected; the processing device is used to identify lens defects based on the target image to be detected. Beneficial effects

[0016] This application discloses a lens defect detection method based on image processing. The method first acquires target background interference feature information in the initial image of the lens to be detected. This feature information comprehensively reflects various background interferences present in the image, such as random thermal noise and interference fringes. Then, based on the acquired target background interference feature information, the interference information of the background interference in the initial image to be detected is determined. Based on the interference information, the background interference in the initial image to be detected is suppressed in a targeted manner to obtain the target image to be detected. Finally, the lens defect is identified based on the processed target image to be detected. This technical solution effectively solves the problem in existing technologies where complex background interference, such as uneven fluctuations in background brightness caused by thermal noise of the image sensor and interference fringes caused by residual cleaning agent film, is difficult for traditional image processing algorithms to effectively distinguish and suppress, leading to misidentification and missed detection. This application significantly improves the accuracy and reliability of lens defect detection through accurate identification and targeted suppression of background interference features, overcoming the performance degradation of existing detection systems in complex industrial environments, and improving the efficiency of lens defect detection. Attached Figure Description

[0017] Figure 1 A schematic flowchart of a lens defect detection method based on image processing provided in this application; Figure 2 A schematic flowchart of another image processing-based lens defect detection method provided in this application; Figure 3 A schematic flowchart of another image processing-based lens defect detection method provided in this application; Figure 4 This is a schematic diagram of the architecture of a lens defect detection system based on image processing, provided in this application. Detailed Implementation

[0018] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. The components of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0019] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0020] In the manufacturing process of lenses, especially for optical components with extremely high precision requirements, such as lenses used in high-end camera lenses, medical endoscopes, or AR / VR device display modules, surface quality is crucial in determining product performance. Traditional methods relying on human eyes for inspection are not only inefficient but also prone to fatigue due to prolonged work, leading to missed defects. To address these issues, researchers have begun to utilize image processing technology to automate the identification of minute defects such as scratches, bubbles, and stains on lens surfaces. This automated inspection system uses industrial cameras to capture lens images, which are then analyzed by computer programs, aiming to significantly improve inspection efficiency and accuracy.

[0021] However, in real-world industrial production environments, industrial camera systems do not always maintain ideal operating conditions. Because production lines need to operate continuously for extended periods, the electronic components inside industrial cameras continuously generate heat, causing the operating temperature of the image sensor to rise. Under sustained, slightly higher operating temperatures, the inherent properties of the internal semiconductor materials of the image sensor change, generating additional dark current, which manifests as random thermal noise. This noise is not uniformly distributed in the acquired image but rather presents as subtle fluctuations in background brightness, exhibiting a degree of randomness and time-varying characteristics, making it difficult to accurately predict and compensate for using simple mathematical models.

[0022] These subtle fluctuations in background brightness caused by thermal noise from image sensors pose a significant challenge to existing image preprocessing techniques. Image processing algorithms that rely on fixed thresholds for binarization or employ simple background subtraction logic often struggle to effectively distinguish and suppress such dynamic and non-uniform noise. For example, a fixed binarization threshold intended to identify dark scratches might misidentify slightly dim noise areas in the background as minute defect signals, resulting in false alarms. Conversely, if a genuine micron-sized scratch happens to be located in a slightly brighter noise area, its contrast may be weakened or even completely submerged in the background fluctuations, leading to missed detection. These misidentifications and missed detections significantly reduce the accuracy and reliability of the detection system, resulting in low efficiency in lens defect detection.

[0023] In this regard, such as Figure 1 As shown, this application proposes a lens defect detection method based on image processing, the method comprising: S101. Obtain target background interference feature information in the initial image to be detected of the lens.

[0024] S102. Determine the background interference information in the initial image to be detected based on the target background interference feature information.

[0025] S103. Based on the interference information of the background interference, suppress the background interference in the initial image to be detected to obtain the target image to be detected.

[0026] S104. Defects of the lens for recognizing the target image.

[0027] This application provides an image processing-based lens defect detection method to address the problem of low detection accuracy in existing technologies due to susceptibility to background interference. The method acquires background interference feature information from an initial image to be detected and effectively suppresses this interference based on these features, ultimately obtaining a target image with significantly reduced background interference, thereby enabling more accurate identification of lens defects.

[0028] Specifically, this method first requires acquiring the target background interference feature information in the initial image of the lens to be detected. Here, "background interference" refers to all non-target information in the image other than the lens defect itself, such as random thermal noise caused by image sensor thermal noise, or interference fringes caused by residual cleaning agent film. "Target background interference feature information" refers to data that characterizes the type, intensity, and location of these background interferences. For example, these features can be obtained by analyzing the local brightness variance, spatial frequency distribution map, and brightness gradient change information of the image. Local brightness variance reflects the brightness uniformity of local areas of the image, the spatial frequency distribution map reveals the frequency information of periodic structures in the image, and the brightness gradient change information reflects the intensity of image edges and textures. Interference information can include the location and type of interference.

[0029] After obtaining the target background interference feature information, the next step is to determine the interference information of the background interference in the initial image to be detected based on these feature information. Then, the background interference in the initial image to be detected is suppressed based on the interference information, thereby obtaining the target image to be detected. This step is the core of this application, and its purpose is to remove or weaken the background interference components in the image as much as possible, so that lens defects can be more clearly displayed. For example, if the feature information indicates the presence of random thermal noise in the image, an adaptive filtering method based on local pixel similarity can be used for suppression; if interference fringes are present, frequency domain filtering methods, such as Fourier transform combined with specific frequency attenuation, can be used to remove them. Through this targeted suppression strategy, background interference can be effectively separated from the image, resulting in a cleaner target image to be detected.

[0030] Finally, lens defects are identified based on the obtained target image. Since background interference in the target image has been significantly suppressed, the features of lens defects will be more prominent, making the subsequent defect identification process more accurate and efficient. For example, traditional image segmentation, edge detection, and feature extraction techniques can be used, or advanced algorithms such as machine learning and deep learning can be combined to analyze the target image and accurately identify various defects on the lens surface, such as scratches, bubbles, and stains.

[0031] The embodiments of this application provide a systematic method for lens defect detection through the above steps. This method first acquires target background interference feature information in the initial image of the lens to be detected. For example, the lens image can be directly acquired using an image sensor, and preliminary analysis can be performed to extract background interference features. Specifically, image processing algorithms can be used to calculate the local brightness variance of the image to evaluate the brightness uniformity of local areas; simultaneously, a spatial frequency distribution map of the image can be generated to identify whether periodic structures exist in the image; and the brightness gradient change information of the image can be calculated to reflect the texture and edge intensity of the image. This information collectively constitutes the target background interference feature information, providing a basis for subsequent background interference suppression.

[0032] Next, based on the acquired target background interference feature information, the interference information of the background interference in the initial image to be detected is determined. Then, the background interference in the initial image to be detected is suppressed based on the interference information to obtain the target image to be detected. For example, if the interference information indicates the presence of random thermal noise in the image, methods such as Non-Local Means Filter (NMWF) can be used for suppression. This method effectively removes random noise while preserving image details by calculating the similarity between a pixel in the image and other pixels in its neighborhood and performing a weighted average based on the similarity. If the interference information indicates the presence of interference fringes in the image, Fourier Transform (FT) can be used for frequency domain analysis. By transforming the image from the spatial domain to the frequency domain, specific frequency components corresponding to interference fringes can be identified and attenuated. Then, the image is transformed back to the spatial domain using inverse Fourier Transform (FT), thereby removing the interference fringes. If multiple types of background interference exist simultaneously in the image, multi-scale analysis methods, such as Wavelet Transform (WRT), can be used to decompose the image into different frequency sub-bands. Then, corresponding suppression strategies are applied for the interference types in different sub-bands, and finally, image reconstruction is performed.

[0033] Finally, lens defects are identified based on the obtained target image. For example, after background interference is effectively suppressed, the features of lens defects will become more apparent. Threshold-based segmentation methods can be used to separate the defect region from the background region in the image; edge detection algorithms, such as the Canny or Sobel operators, can be used to extract the edge information of the defects; morphological operations, such as erosion, dilation, opening, and closing operations, can also be used to refine and connect the defect region. Furthermore, machine learning or deep learning models, such as convolutional neural networks (CNNs), can be combined to train and classify the target image, thereby achieving automatic identification and classification of different types of defects.

[0034] The embodiments of this application acquire target background interference feature information in the initial image to be detected of the lens, determine the interference information of the background interference in the initial image to be detected based on these feature information, then suppress the background interference in the initial image to be detected based on the interference information of the background interference, obtain the target image to be detected, and finally identify the lens defect based on the target image to be detected. This series of steps works in synergy to effectively solve the problem that background interference seriously affects the detection accuracy in traditional lens defect detection.

[0035] Specifically, firstly, by acquiring target background interference feature information, the system can accurately identify and characterize random thermal noise and interference fringes in the image. For example, local brightness variance can effectively capture local brightness non-uniformity caused by random thermal noise, while spatial frequency distribution map and brightness gradient change information can reveal the periodicity and texture features of interference fringes. This accurate perception of background interference is the foundation for subsequent effective suppression.

[0036] Secondly, based on these feature information, the background interference information in the initial image to be detected is determined, and then the background interference information is used. For example, for random thermal noise, an adaptive filtering method based on local pixel similarity can be used to remove noise while preserving image details to the maximum extent; for interference fringe interference, a frequency domain filtering method can be used to accurately remove periodic interference components. When multiple interferences coexist, multi-scale decomposition and frequency band processing can achieve synergistic suppression of different types of interference. This targeted suppression method avoids the problems of loss of defect information or incomplete background suppression that may be caused by the one-size-fits-all filtering process in traditional methods.

[0037] Finally, defect identification is performed on the target image where background interference is significantly suppressed, making defect features more prominent and greatly improving the signal-to-noise ratio. This not only reduces the complexity of subsequent defect identification algorithms but also significantly improves the accuracy and robustness of identification, effectively reducing false alarms and missed detections.

[0038] Compared with existing technologies, the embodiments of this application have significant advantages and innovations. Traditional lens defect detection methods often employ single image preprocessing techniques, such as simple smoothing filtering or fixed threshold binarization, which are difficult to effectively cope with complex and varied background interference. In particular, when random thermal noise and interference fringes are superimposed, their detection performance will drop sharply.

[0039] The core innovation of this application lies in introducing the crucial step of "acquiring target background interference feature information in the initial image of the lens to be inspected," enabling the system to intelligently identify the type and characteristics of background interference. Building upon this, this application further proposes a strategy of "determining the interference information of the background interference in the initial image to be inspected based on the target background interference feature information, and then suppressing the background interference in the initial image to be inspected based on the interference information," achieving adaptive and targeted suppression of different types of background interference. This method avoids the problems of defect information loss or incomplete background suppression that may occur with blind filtering in traditional methods. Through this refined background interference suppression, this application can obtain a cleaner target image to be inspected, thereby significantly improving the accuracy and reliability of defect identification when "identifying lens defects based on the target image to be inspected," and effectively reducing the false alarm rate and false negative rate. Therefore, this application provides a more advanced and effective solution for the automated and high-precision detection of lens defects in complex industrial environments.

[0040] Specifically, such as Figure 2 As shown, in the above-mentioned image processing-based lens defect detection method, obtaining the target background interference feature information in the initial image to be detected of the lens may include the following steps: S201. Obtain the initial image of the lens to be detected.

[0041] S202. Use the local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected as the target background interference feature information of the initial image to be detected.

[0042] Local brightness variance refers to the variance obtained by statistically analyzing the brightness values ​​of each pixel or its surrounding local area in the initial image to be detected. This variance can effectively reflect the uniformity or degree of variation in brightness in local areas of the image, and is of great significance for identifying background interference such as random noise.

[0043] Spatial frequency distribution maps are typically obtained through frequency domain analysis methods such as Fourier transform on the initial image to be detected. These maps reveal the intensity distribution of different spatial frequency components in the image, effectively characterizing the image's texture, periodic structure, and interference patterns. For example, periodic interference fringes will exhibit specific high-energy frequency points in the frequency domain.

[0044] Brightness gradient information refers to the rate of change of pixel brightness values ​​in the initial image to be detected, distributed spatially. By calculating the image gradient, regions with drastic brightness changes can be identified, such as edges, lines, or specific interference patterns. Background interference, such as interference fringes, is often accompanied by periodic brightness gradient changes.

[0045] The proposed solution acquires the local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected, enabling the quantification and characterization of background interference in the image from multiple dimensions. Local brightness variance helps identify random noise or inhomogeneity in local areas; the spatial frequency distribution map reveals the presence of periodic structures, such as interference fringes; and the brightness gradient change information further confirms the intensity and distribution characteristics of these interferences. It is precisely because these multi-dimensional features are comprehensively utilized that subsequent background interference suppression strategies can more accurately locate and process different types of background interference, thus avoiding the problems of misjudgment or incomplete suppression caused by insufficient information in traditional methods.

[0046] Through the above technical solution, this application can comprehensively and accurately acquire background interference feature information in the initial image of the lens to be tested. This multi-feature fusion method enables the system not only to identify single types of background interference, such as random noise or interference fringes, but also to effectively distinguish and characterize complex and diverse background interference. This lays a solid foundation for subsequent differentiated suppression strategies for different types of background interference, significantly improving the accuracy and robustness of background interference identification, and thus enhancing the overall accuracy and reliability of lens defect detection.

[0047] In some embodiments of this application described above, obtaining target background interference feature information of the initial image to be detected by the lens includes using the local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected as target background interference feature information of the initial image to be detected.

[0048] Specifically, the aforementioned local brightness variance includes the brightness variance of each pixel in the initial image to be detected, such as... Figure 3 As shown, determining the local brightness variance of the initial image to be detected includes: S301. For each pixel in the initial image to be detected, a rectangular region with the pixel as the center and a side length of a preset length is taken as the local region corresponding to the pixel.

[0049] S302. Calculate the brightness variance of each pixel to obtain the local brightness variance of the initial image to be detected; the brightness variance is the variance of the brightness of all pixels in the local region corresponding to the pixel.

[0050] Local brightness variance can be understood as the dispersion of brightness values ​​within a small region surrounding each pixel in an image. Specifically, for any pixel in the initial image to be detected, a rectangular region with a preset side length can be defined as its local region, centered on that pixel. This preset length can be adjusted according to the actual application scenario and image characteristics; for example, it can be set to 3, 5, or 7 pixel units. Subsequently, the variance of brightness values ​​of all pixels within this local region is calculated, and this variance is the local brightness variance corresponding to the central pixel. The purpose is to quantify the texture complexity and noise level of local regions of the image, providing a quantitative basis for subsequent identification of background interference.

[0051] The proposed solution precisely characterizes the brightness variation characteristics of local regions in an image by explicitly defining and calculating the local brightness variance of each pixel in the initial image to be detected. Specifically, by constructing a local region for each pixel and calculating its brightness variance, background interference features such as random noise, texture variations, or local brightness inhomogeneity that may exist in the image can be effectively captured. For example, when random thermal noise exists in an image, the brightness variance of its local region usually increases significantly; while for flat regions or uniform backgrounds, the local brightness variance is relatively small. This quantization method enables the system to more accurately identify and distinguish different types of background interference based on this local brightness variance information, thereby providing reliable data support for subsequent background interference suppression steps.

[0052] Through the above technical solution, this application provides a precise and quantifiable method for obtaining the local brightness variance of the initial image to be detected. This explicit calculation method ensures the consistency and repeatability of the local brightness variance acquisition process, avoiding errors caused by inconsistent calculation methods. Therefore, the obtained local brightness variance information can more accurately reflect the local characteristics of the image, such as noise level or texture details, thus laying a solid foundation for the subsequent comprehensive analysis of target background interference feature information, thereby improving the accuracy and suppression effect of background interference recognition.

[0053] This application further proposes a method for determining the interference information of background interference in the initial image to be detected based on the target background interference feature information, the steps of which include: The location and type of each background interference in the initial image to be detected are determined based on the target background interference feature information; the location and type of the background interference are used as the interference information of the background interference.

[0054] Specifically, after obtaining target background interference features such as local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected, these features need to be analyzed to identify the specific background interference present in the image. Here, "location of background interference" refers to the specific pixel coordinates or region of the background interference in the image, while "interference type" refers to the physical properties or manifestation of the background interference, such as random thermal noise, periodic interference fringes, or fixed-pattern noise. Accurately identifying the location and type of interference is a prerequisite for taking effective suppression measures.

[0055] Furthermore, after determining the location and type of each background interference in the initial image to be detected, the location and type of the background interference can be used as the interference information of the background interference.

[0056] This application's solution effectively addresses the problems of inaccurate or inefficient background interference identification in existing technologies by introducing the identification of the location and type of background interference and using this location and type as background interference information. Specifically, after obtaining target background interference feature information such as the local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected, this information is used for refined analysis of the background interference in the image. By analyzing these features, the specific region of background interference in the image can be accurately located, and its type can be determined, thus using the location and type of background interference as background interference information.

[0057] Specifically, in some embodiments of the above-mentioned image processing-based lens defect detection method, determining the location and type of each background interference in the initial image to be detected based on the target background interference feature information may include the following steps: For each pixel among multiple pixels, determine whether the brightness variance of the pixel is greater than a preset variance threshold. If so, determine the position of the background interference in the initial image to be detected as the position of the pixel, and the interference type is random thermal noise. Based on the spatial frequency distribution map and brightness gradient change information of the initial image to be detected, determine whether there are interference fringes in the initial image to be detected. If so, determine the position of the background interference in the initial image to be detected as the position of the interference fringes, and the interference type is interference fringe interference.

[0058] Brightness variance refers to the variance of brightness among all pixels in a rectangular region (i.e., a local region) centered at a given pixel. When random thermal noise exists in an image, this noise typically manifests as drastic fluctuations in pixel brightness values ​​within a local region, leading to a significant increase in local brightness variance. Therefore, by comparing the local brightness variance of each pixel with a preset variance threshold, the presence and location of random thermal noise can be effectively identified. If the local brightness variance exceeds the preset variance threshold, random thermal noise is considered to exist at the location of that pixel.

[0059] Furthermore, interference fringes typically exhibit specific spatial periodicity or directionality. These characteristics manifest as specific frequency components in the spatial frequency distribution map of an image and as regular gradient changes in brightness gradient information. Therefore, by analyzing the spatial frequency distribution map and brightness gradient change information of the initial image to be detected, it is possible to determine whether interference fringes exist in the image. If interference fringes are detected, their location is determined to be the location of background interference, and the interference type is identified as interference fringe interference.

[0060] This application's solution effectively identifies and distinguishes different types of background interference by comprehensively analyzing the local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected. Specifically, random thermal noise typically manifests as drastic fluctuations in pixel brightness values ​​within a local area of ​​the image. Therefore, by calculating the brightness variance of the local area for each pixel and comparing it with a preset variance threshold, random thermal noise can be accurately located and identified. When the local brightness variance exceeds the preset variance threshold, it indicates abnormal brightness fluctuations in that area, thus being identified as random thermal noise. Meanwhile, interference fringes exhibit specific spatial periodicity or directionality. These characteristics manifest as specific frequency components in the spatial frequency distribution map of the image and regular gradient changes in the brightness gradient change information. Therefore, by analyzing the spatial frequency distribution map and brightness gradient change information, the presence and location of interference fringes in the image can be effectively detected. This multi-feature fusion-based judgment mechanism makes the identification of background interference more comprehensive and accurate.

[0061] Through the above technical solution, this application can accurately determine the specific location and type of different types of background interference (such as random thermal noise and interference fringes) in the initial image to be detected based on the target background interference feature information. This refined identification capability provides an accurate basis for subsequent targeted suppression of different types of background interference, avoiding the problems of misprocessing or incomplete processing that may be caused by a single suppression strategy, thereby improving the accuracy and efficiency of background interference suppression and laying a solid foundation for subsequent lens defect identification.

[0062] In some embodiments of this application described above, the presence of interference fringes in the initial image to be detected is determined based on the spatial frequency distribution map and brightness gradient change information of the initial image to be detected. Specifically, this determination process may include the following steps: The first region of the initial image to be detected is determined based on the spatial frequency distribution map; the energy value of the first region in the spatial frequency distribution map is greater than a preset energy value. The spatial frequency distribution map is usually obtained by performing a Fourier transform on the image, reflecting the distribution of different frequency components in the image. Interference fringes, as a periodic structure, exhibit specific high-energy regions in the spatial frequency distribution map. Therefore, by setting a preset energy value, these regions with high energy values ​​can be identified and used as the first region, initially indicating the possible presence of interference fringes in the image.

[0063] The second region of the image to be detected is determined based on the brightness gradient change information; the brightness gradient change value of the second region is greater than a preset gradient change value. The brightness gradient change information reflects the drastic degree of brightness change of image pixels. Interference fringes are usually accompanied by periodic brightness changes, that is, there will be a large brightness gradient at the edge or inside of the fringe. By calculating the brightness gradient of the image and setting a preset gradient change value, regions with brightness gradient change values ​​greater than the preset gradient change value can be identified and designated as the second region, further indicating the possible presence of interference fringes in the image.

[0064] If the first and second regions overlap, the overlapping region is used as the interference fringes of the initial image to be detected. The determination of overlapping regions can be achieved using methods such as image overlay or logical AND operations.

[0065] The proposed solution combines spatial frequency distribution maps and brightness gradient change information to determine the presence of interference fringes in the initial image to be detected. The principle is that interference fringes simultaneously exhibit periodic structures and dramatic local brightness variations in the image. Spatial frequency analysis alone may be sensitive to aperiodic noise, while brightness gradient change alone may be sensitive to other types of edges or defects. It is precisely because interference fringes have a concentrated energy distribution in the frequency domain and exhibit significant brightness gradient changes in the spatial domain that the first region identified by the spatial frequency distribution map and the second region identified by the brightness gradient change information overlap in their interference fringe positions. This dual verification mechanism can effectively distinguish interference fringes from other background interference or defects, thereby improving detection accuracy.

[0066] The above technical solution enables more accurate and robust identification of interference fringes in the initial image to be detected. Compared to methods that rely solely on a single feature for judgment, this solution combines the global frequency characteristics and local brightness variation characteristics of the image, effectively avoiding misjudgments or missed judgments that may result from judging based on a single feature. Therefore, it can significantly improve the accuracy of background interference identification, providing a more reliable basis for subsequent background interference suppression steps, thereby enhancing the overall performance and reliability of lens defect detection.

[0067] This application further proposes a method for suppressing background interference in an initial image to be detected based on interference information of the background interference, and obtaining a target image to be detected. The specific steps include: Determine whether all background interference in the initial image to be detected is random thermal noise. If all background interference is random thermal noise, for each background interference, the local region corresponding to the pixel in the neighborhood of the pixel containing the background interference in the initial image to be detected is taken as the first local region. Determine the similarity between all pixels in the first local region and all pixels in the local region corresponding to the pixel containing the background interference. The first local region with a similarity greater than a preset similarity threshold is taken as the second local region. Obtain a first correspondence relationship. The first correspondence relationship includes a one-to-one correspondence between multiple similarities and multiple weight values. The weight value is positively correlated with the corresponding similarity. For each second local region, the weight value corresponding to the similarity of the second local region in the first correspondence relationship is taken as the target weight value corresponding to the second local region. The product of the pixel value of the center pixel of each second local region and the corresponding target weight value is taken as the sub-pixel value. The sum of multiple sub-pixel values ​​is taken as the pixel value of the pixel containing the background interference, thus obtaining the target image to be detected.

[0068] Specifically, it is determined whether all background interference in the initial image to be detected is random thermal noise. This aims to ensure that subsequent suppression strategies can specifically address random thermal noise. If the determination result is yes, it indicates that the main background interference in the current image is random thermal noise, and a local weighted average method based on similarity can be used for suppression. The first local region refers to a neighborhood defined in the initial image to be detected, centered on the pixel containing the background interference. Pixels within this neighborhood and their corresponding local regions are used to calculate similarity. Similarity can be understood as the degree of closeness between two local regions in terms of brightness, texture, or structure, with the aim of identifying image regions with similar characteristics to the region containing the background interference.

[0069] A preset similarity threshold is used to filter out sufficiently similar local regions to avoid including irrelevant regions in the calculation, thereby ensuring the accuracy of the suppression effect. The first correspondence is established between similarity and weight value, where the weight value is positively correlated with the corresponding similarity. This means that regions with higher similarity have a greater weight in subsequent pixel value calculations. The purpose is to make regions with features similar to the background interference region contribute more to noise suppression.

[0070] The target weight value is obtained from the first correspondence based on the similarity of each second local region, and is used to quantify the contribution of that region to the reconstruction of the pixel value of the center pixel.

[0071] The sub-pixel value is the product of the pixel value of the center pixel of each second local region and the corresponding target weight value. Its purpose is to prepare for the subsequent weighted summation. Finally, the sum of multiple sub-pixel values ​​is used as the pixel value of the pixel containing background interference. Through this weighted averaging method, random thermal noise is effectively removed.

[0072] The proposed solution first determines whether all background interference is random thermal noise, ensuring the targeted nature of the suppression strategy. When the interference type is confirmed to be random thermal noise, the solution identifies a first local region similar to the local area of ​​the pixel containing the background interference, and further filters out a second local region with a similarity greater than a preset similarity threshold. Since random thermal noise typically manifests as irregular fluctuations in pixel values, while the true structure of the image and the background have a certain degree of local similarity, establishing a positive correlation between similarity and weight values, and applying a weighted average to similar regions, effectively smooths out noisy pixel values ​​while preserving details in non-noise areas of the image. This weighted averaging method based on local similarity fully utilizes the local redundancy information of the image, thus exhibiting excellent performance in suppressing random thermal noise.

[0073] The above technical solution effectively addresses random thermal noise in the initial image to be detected, avoiding image blurring or loss of detail that may occur with traditional general filtering methods. Through refined local similarity calculation and weighted averaging, this solution more effectively removes random thermal noise, significantly improving the signal-to-noise ratio of the image and thus providing higher-quality image data for subsequent lens defect identification. This not only enhances the accuracy and reliability of defect detection but also reduces the risk of false positives or false negatives due to background noise interference, thereby improving the overall performance of the detection system.

[0074] In some preferred embodiments, it is assumed that multiple background disturbances exist in the initial image to be detected, and that these disturbances are all determined to be random thermal noise. For a pixel containing one of the background disturbances, a 3x3 local region is first defined centered on that pixel. Next, in the initial image to be detected, other pixels within the neighborhood of the background disturbance pixel are searched outwards, and a 3x3 local region is also defined for these pixels; these local regions are the first local regions. Then, the similarity between each first local region and the local region corresponding to the pixel containing the background disturbance is calculated, for example, using the Structural Similarity Index (SSIM) or the reciprocal of the Euclidean distance between pixel values ​​as a similarity measure. A preset similarity threshold is set, for example, 0.8. All first local regions with a similarity greater than 0.8 are selected as second local regions. Simultaneously, a first correspondence is pre-established, for example, a weight of 0.6 when the similarity is 0.8, a weight of 0.8 when the similarity is 0.9, and a weight of 1.0 when the similarity is 1.0, with the weight value positively correlated with the similarity. For each second local region, the corresponding target weight value is retrieved from the first correspondence based on its calculated similarity. Finally, the pixel value of the center pixel of each second local region is multiplied by its corresponding target weight value to obtain multiple sub-pixel values. These sub-pixel values ​​are then summed to obtain the new pixel value of the pixel containing the background interference. By repeating this process for all random thermal noise interference points, a target detection image with effectively suppressed background interference is finally obtained.

[0075] This application further proposes a suppression strategy specifically for interference fringe interference, which efficiently and accurately removes such background interference through frequency domain processing.

[0076] Based on the interference information of the background interference, the background interference in the initial image to be detected is suppressed to obtain the target image to be detected, including: Determine whether all background interference in the initial image to be detected is interference fringe; if all background interference is interference fringe, perform a two-dimensional Fourier transform on the initial image to be detected to obtain the first image to be detected; attenuate the energy of the frequency points of the background interference in the first image to be detected to zero to obtain the second image to be detected; perform an inverse Fourier transform on the second image to be detected to obtain the target image to be detected.

[0077] Specifically, before performing background interference suppression, it is first determined whether all background interference in the initial image to be detected is interference fringe interference. This step aims to ensure that subsequent frequency domain processing methods are only executed in the most applicable scenario, i.e., when all background interference in the image is identified as interference fringe interference. This helps avoid incorrectly applying optimization strategies for specific types of interference to other types of interference, thereby ensuring the effectiveness and accuracy of the processing.

[0078] If the background interference is determined to be interference of all types, specifically interference fringes, a two-dimensional Fourier transform is performed on the initial image to be detected to obtain the first image to be detected. The two-dimensional Fourier transform is a mathematical tool for converting an image from the spatial domain to the frequency domain. In the frequency domain, the periodic structure of an image (such as interference fringes) manifests as specific high-energy frequency points. Through the Fourier transform, periodic interference that is difficult to process directly in the spatial domain can be transformed into frequency components that are easy to identify and manipulate in the frequency domain. Its purpose is to separate periodic interference from the non-periodic details of the image.

[0079] Based on this, the energy of the frequency points at the location of background interference in the first image to be detected is attenuated to zero, resulting in the second image to be detected. In the frequency domain, interference fringes typically correspond to specific frequency points that are far from the center (zero frequency) and have high energy. Attenuating the energy of these frequency points to zero is essentially performing a notch filtering operation, designed to precisely remove the frequency components associated with the interference fringes without affecting other frequency components of the image. Attenuation to zero means completely eliminating the interference at these specific frequencies, aiming to selectively remove the frequency components of the interference fringes, thereby effectively suppressing periodic interference.

[0080] Subsequently, an inverse Fourier transform is performed on the second image to be detected to obtain the target image to be detected. The inverse Fourier transform converts the image processed in the frequency domain back to the spatial domain. This step yields an image free of interference fringes, i.e., the target image to be detected. This image is clearer with less background interference, which is beneficial for subsequent defect identification. The purpose is to restore the processed frequency domain image to a spatial domain image, facilitating subsequent visual analysis and defect identification.

[0081] The proposed solution transforms the initial image to be detected from the spatial domain to the frequency domain, leveraging the characteristic that interference fringe interference manifests as specific high-energy frequency points in the frequency domain to achieve precise suppression of interference. Specifically, a two-dimensional Fourier transform maps periodic structures (i.e., interference fringes) in the image to discrete frequency points in the frequency domain. By identifying and attenuating the energy of these frequency points representing interference fringes, these periodic interferences can be selectively eliminated, avoiding overprocessing of non-interference areas in the image. Subsequently, an inverse Fourier transform converts the processed frequency domain image back to the spatial domain, resulting in a target image where background interference (especially interference fringe interference) is effectively suppressed. This frequency domain processing method can more accurately separate and remove periodic interference, reducing damage to image details and thus providing higher-quality images for subsequent defect identification.

[0082] Through the above technical solution, this application provides an efficient and accurate suppression method for interference fringe interference, a specific type of background interference. Compared with general spatial domain filtering methods, this frequency domain processing method can more accurately locate and remove the frequency components of interference fringes, avoiding excessive smoothing or loss of detail in non-interference areas of the image. Therefore, it can significantly improve the background interference removal effect, enhancing the clarity and signal-to-noise ratio of the target image, thus providing cleaner and more reliable image data for subsequent lens defect identification, effectively improving the accuracy and robustness of defect detection.

[0083] In some preferred embodiments, it is assumed that the acquired initial image of the lens to be tested contains significant interference fringes, and by analyzing its local brightness variance, spatial frequency distribution map, and brightness gradient change information, it is determined that the background interference in the image is interference fringes. In this case, a two-dimensional Fourier transform is first performed on the initial image to be tested, converting it from the spatial domain to the frequency domain, resulting in a first image to be tested. In the frequency spectrum of the first image to be tested, several high-energy frequency points corresponding to the interference fringes can be observed. Next, a notch filter is constructed to attenuate the energy of these high-energy frequency points to zero, thereby removing the interference fringes component in the frequency domain, resulting in a second image to be tested. Finally, an inverse Fourier transform is performed on the second image to be tested, converting it back to the spatial domain, thus obtaining a target image to be tested where the interference fringes interference is effectively suppressed. For example, if the interference fringes present as a horizontally oriented periodic texture, symmetrical high-energy points will appear on the vertical axis in the frequency domain; by setting the energy of these points and their surrounding areas to zero and then performing an inverse transform, these horizontal fringes can be eliminated, making the true defects on the lens surface more clearly visible.

[0084] This application proposes a more comprehensive background interference suppression method, aiming to solve the processing challenge when both interference fringes and random thermal noise exist in the initial image to be detected. This method decomposes the image into different frequency components and applies corresponding interference suppression strategies to each component, thereby achieving effective removal of mixed-type background interference.

[0085] In some embodiments of this application, when it is determined that the background interference type in the initial image to be detected includes interference fringe interference and random thermal noise, the specific processing steps include: The initial image to be detected is decomposed into a low-frequency image and a high-frequency image by wavelet transform. For the low-frequency image, an interference suppression strategy corresponding to random thermal noise is applied to the background interference, resulting in a processed low-frequency image. For the high-frequency image, an interference suppression strategy corresponding to interference fringe interference is applied to the background interference, resulting in a processed high-frequency image. The processed low-frequency image and the processed high-frequency image are then reconstructed to obtain the target image to be detected.

[0086] Specifically, wavelet transform is a multi-resolution analysis tool that can decompose an image into different frequency components. For example, low-frequency images typically contain smooth regions and key structural information, while high-frequency images contain details, edges, and various high-frequency noises. In this application, the initial image to be detected is decomposed into low-frequency and high-frequency images using wavelet transform. The purpose is to separate different types of background interference into different frequency domains for targeted processing. The low-frequency image can be understood as, after wavelet transform, containing key structural information and low-frequency interference typically associated with random thermal noise. The high-frequency image can be understood as, after wavelet transform, containing detail information, edges, and high-frequency periodic noise typically associated with interference fringes.

[0087] Furthermore, the interference suppression strategy applied to the low-frequency image, which targets random thermal noise, means applying the aforementioned methods for suppressing random thermal noise to the low-frequency image. For example, a similarity-weighted average filtering process can be used to effectively remove random thermal noise in the low-frequency portion while preserving the main structure of the image as much as possible. Similarly, the interference suppression strategy applied to the high-frequency image, targeting interference fringe interference, means applying the aforementioned methods for suppressing interference fringe interference to the high-frequency image. For example, a Fourier transform can be performed on the high-frequency image to identify and attenuate specific frequency components corresponding to interference fringes in the frequency domain, followed by an inverse Fourier transform to accurately remove interference fringe interference in the high-frequency portion. Finally, the processed low-frequency and high-frequency images are reconstructed, meaning the processed low-frequency and high-frequency images are recombined using inverse wavelet transform or other appropriate image synthesis methods to recover a complete image with effectively suppressed background interference.

[0088] The proposed solution decomposes the initial image to be detected into low-frequency and high-frequency images using wavelet transform, achieving effective separation of different types of background interference. Random thermal noise is typically more pronounced in low-frequency images, while interference fringes exhibit significant periodicity in high-frequency images. Therefore, applying a strategy specifically designed to suppress random thermal noise to the low-frequency image can effectively remove the random thermal noise in the low-frequency portion while preserving the main structure of the image. Applying a strategy specifically designed to suppress interference fringes to the high-frequency image can accurately identify and attenuate the frequency components of the interference fringes, thereby removing the interference fringes in the high-frequency portion. Thus, by reconstructing the processed low-frequency and high-frequency images, a target image to be detected that has simultaneously removed both random thermal noise and interference fringes can be obtained.

[0089] By employing the aforementioned technical solution, this application effectively addresses the problem of ineffective single suppression strategies when both random thermal noise and interference fringes coexist in the initial image of a lens. By decomposing the image into different frequency components using wavelet transform and applying different interference suppression strategies to low-frequency and high-frequency images, precise separation and efficient removal of different types of background interference are achieved. This divide-and-conquer approach avoids the problems of over-smoothing or incomplete removal that may occur with traditional methods when dealing with mixed interference, significantly improving the suppression effect of background interference. This provides a clearer and more accurate image basis for subsequent lens defect identification, thereby enhancing the accuracy and reliability of defect detection.

[0090] In some preferred embodiments, assuming that the initial image of the lens to be detected is analyzed based on its local brightness variance, spatial frequency distribution map, and brightness gradient change information, it is determined that both random thermal noise and interference fringes exist in the image. First, a two-dimensional discrete wavelet transform (DWT) is performed on the initial image to be detected, for example, using a Haar wavelet basis or a Daubechies wavelet basis, decomposing it into a low-frequency sub-band image (LL) and high-frequency sub-band images (LH, HL, HH). The LL sub-band image is considered the low-frequency image, while the LH, HL, and HH sub-band images are considered high-frequency images. Next, for the low-frequency image (LL sub-band), an interference suppression strategy corresponding to random thermal noise is applied to all background interference types.

[0091] Specifically, non-local means filtering or adaptive median filtering can be used to smooth the random thermal noise in the LL subband image, obtaining a processed low-frequency image. Simultaneously, for the high-frequency images (LH, HL, HH subbands), interference suppression strategies corresponding to interference fringes are applied. Specifically, Fourier transforms are performed on these high-frequency subband images to identify and attenuate specific frequency components corresponding to interference fringes in the frequency domain, followed by inverse Fourier transforms to obtain the processed high-frequency image. Finally, the processed low-frequency and high-frequency images are reconstructed using inverse wavelet transforms to obtain the final target image to be detected. This target image to be detected significantly reduces random thermal noise and interference fringes, providing high-quality input for subsequent defect identification.

[0092] This application also discloses a lens defect detection system based on image processing. The system includes: an acquisition device and a processing device; the acquisition device is used to acquire target background interference feature information of background interference in an initial image to be detected of the lens; the processing device is used to determine interference information of background interference in the initial image to be detected based on the target background interference feature information; the processing device is used to suppress background interference in the initial image to be detected based on the interference information of background interference to obtain a target image to be detected; the processing device is used to identify lens defects based on the target image to be detected.

[0093] This application provides an image processing-based lens defect detection system, aiming to solve the problems of low detection accuracy, high false alarm and false negative rates in traditional lens defect detection. These problems arise from random thermal noise generated by the increased operating temperature of the image sensor due to long-term operation of industrial camera systems, and complex background interference such as interference fringes caused by residual cleaning agents. The system acquires background interference feature information from the initial image to be detected through an acquisition device, and the processing device adaptively determines and executes a background interference suppression strategy based on this feature information. This results in a target image with significantly reduced background interference, allowing the processing device to more accurately identify lens defects. Through the synergy of hardware and software, this system effectively manages complex background interference, significantly improving the automation level and reliability of lens defect detection.

[0094] The overall process and technical effects of the lens defect detection method have been described in the above embodiments, and will not be repeated here. It should be emphasized that the embodiments of this application implement the above method steps into a system architecture, which is achieved through the collaborative work of the acquisition device and the processing device.

[0095] Specifically, the acquisition device is used to acquire target background interference feature information in the initial image to be detected of the lens. In a preferred embodiment, the acquisition device may include an image acquisition module and a feature extraction module. The image acquisition module may be an industrial camera, such as a CCD camera or a CMOS camera, configured to acquire the initial image to be detected of the lens under specific light source illumination. This image acquisition module may be set to capture images at a preset frame rate and resolution. The feature extraction module may be an embedded processor or a dedicated image processing chip, configured to perform preliminary analysis on the initial image to be detected acquired by the image acquisition module to extract background interference feature information. For example, the feature extraction module may calculate the local brightness variance of the image, generate a spatial frequency distribution map, or analyze brightness gradient change information. In some embodiments, the acquisition device may only be responsible for image acquisition, while feature extraction is performed by a processing device. For example, the image acquisition module may directly transmit the raw image data to the processing device, where a software module performs feature extraction.

[0096] The processing device can be a high-performance industrial computer, embedded system, or FPGA (Field-Programmable Gate Array), internally running corresponding image processing algorithms and control logic. The processing device determines the background interference information in the initial image to be detected based on the target background interference feature information; it then suppresses the background interference in the initial image to be detected based on this interference information, obtaining the target image to be detected. After determining the interference suppression strategy, the processing device executes this strategy to process the initial image to be detected. For example, if a statistical filtering-based strategy is selected, the processing device calls the corresponding filtering function to process the image to smooth noise and preserve edges. If a frequency domain filtering strategy is selected, the processing device performs a Fourier transform to attenuate or remove frequency components related to interference fringes in the frequency domain, and then performs an inverse Fourier transform to reconstruct the image. In this way, the background interference in the initial image to be detected is effectively weakened or removed, resulting in a target image to be detected with a cleaner background and more prominent defect features.

[0097] Furthermore, the processing device is also used to identify lens defects based on the target image to be detected. After obtaining the target image to be detected, the processing device performs further analysis to identify defects. For example, the processing device can run an image segmentation algorithm to separate the defective region in the image from the background; or perform an edge detection algorithm to identify the boundary of the defect. The processing device can also utilize machine learning models, such as support vector machines (SVM) or convolutional neural networks (CNN), to train and infer on the target image to automatically identify and classify different types of defects, such as scratches, bubbles, stains, etc. In some embodiments, the processing device may also include a user interface module for displaying the detection results and allowing the operator to review or adjust parameters.

[0098] The image processing-based lens defect detection system proposed in the embodiments of this application represents a significant technological advancement compared to traditional detection systems. Traditional detection systems often employ fixed image preprocessing modules and single defect identification algorithms, making them ill-suited to complex and ever-changing industrial production environments. In particular, when multiple background interferences such as random thermal noise and interference fringes are present in the image simultaneously, their detection performance deteriorates sharply, leading to persistently high false alarm and false negative rates.

[0099] This application's system achieves intelligent perception and adaptive suppression of background interference by introducing independent acquisition and processing devices. The acquisition device can accurately acquire and characterize the feature information of background interference, providing a reliable basis for subsequent processing. The processing device can dynamically determine and execute the suppression strategy most suitable for the current type of interference based on this feature information, avoiding the blind "one-size-fits-all" processing method of traditional systems. This refined and targeted background interference suppression capability enables the system to obtain a highly pure target image to be detected, thereby significantly improving the signal-to-noise ratio and recognition accuracy in the defect identification stage. Therefore, this application's system can effectively overcome the negative impact of background interference on defect detection in the prior art, significantly reducing the false alarm rate and false negative rate, and providing a more efficient, accurate, and robust automated solution for lens production quality control.

[0100] The above are merely embodiments of this application and are not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A lens defect detection method based on image processing, characterized in that, The methods include: Obtain target background interference feature information in the initial image to be detected of the lens; The interference information of the background interference in the initial image to be detected is determined based on the target background interference feature information; The background interference in the initial image to be detected is suppressed based on the interference information of the background interference to obtain the target image to be detected; The defects of the lens are identified based on the target image to be detected.

2. The lens defect detection method based on image processing according to claim 1, characterized in that, Obtain target background interference feature information from the initial image to be detected of the lens, including: Acquire the initial image to be detected by the lens; The local brightness variance, spatial frequency distribution map, and brightness gradient change information of the initial image to be detected are used as the target background interference feature information of the initial image to be detected.

3. The lens defect detection method based on image processing according to claim 2, characterized in that, The local brightness variance includes the brightness variance of each pixel in the initial image to be detected. Determining the local brightness variance of the initial image to be detected includes: For each pixel in the initial image to be detected, a rectangular region with the pixel as the center and a side length of a preset length is taken as the local region corresponding to the pixel. The luminance variance of each pixel is calculated to obtain the local luminance variance of the initial image to be detected; the luminance variance is the variance of the luminance of all pixels in the local region corresponding to the pixel.

4. The lens defect detection method based on image processing according to claim 3, characterized in that, Determining the background interference information in the initial image to be detected based on the target background interference feature information includes: The location and type of each background interference in the initial image to be detected are determined based on the target background interference feature information; The location and type of background interference are used as the interference information of the background interference.

5. The lens defect detection method based on image processing according to claim 4, characterized in that, Determining the location and type of each background interference in the initial image to be detected based on the target background interference feature information includes: For each of the multiple pixels, determine whether the brightness variance of the pixel is greater than a preset variance threshold. If so, determine the position of the background interference in the initial image to be detected as the position of the pixel, and the interference type is random thermal noise. Based on the spatial frequency distribution map and brightness gradient change information of the initial image to be detected, it is determined whether there are interference fringes in the initial image to be detected. If so, the position of the background interference in the initial image to be detected is determined as the position of the interference fringes, and the interference type is interference fringe interference.

6. The lens defect detection method based on image processing according to claim 5, characterized in that, Determining whether interference fringes exist in the initial image to be detected based on the spatial frequency distribution map and brightness gradient change information of the initial image to be detected includes: A first region in the initial image to be detected is determined based on the spatial frequency distribution map; the energy value of the first region in the spatial frequency distribution map is greater than a preset energy value. A second region in the image to be detected is determined based on the brightness gradient change information; the brightness gradient change value of the second region is greater than a preset gradient change value. If the first region and the second region overlap, the overlapping region is used as the interference fringes in the initial image to be detected.

7. The lens defect detection method based on image processing according to claim 5, characterized in that, Based on the interference information of the background interference, the background interference in the initial image to be detected is suppressed to obtain the target image to be detected, including: Determine whether all background interference types in the initial image to be detected are random thermal noise; If the background interference is of the random thermal noise type, for each background interference, the local region corresponding to the pixel in the neighborhood of the pixel where the background interference is located in the initial image to be detected is taken as the first local region. Determine the similarity between all pixels in the first local region and all pixels in the local region corresponding to the pixel containing the background interference; The first local region with a similarity greater than a preset similarity threshold is designated as the second local region. Obtain a first correspondence; the first correspondence includes a one-to-one correspondence between multiple similarities and multiple weight values; the weight value is positively correlated with the corresponding similarity. For each second local region, the weight value corresponding to the similarity of the second local region in the first correspondence is used as the target weight value corresponding to the second local region; The product of the pixel value of the center pixel of each second local region and the corresponding target weight value is used as the sub-pixel value; The sum of multiple sub-pixel values ​​is used as the pixel value of the pixel where the background interference is located to obtain the target image to be detected.

8. The lens defect detection method based on image processing according to claim 5, characterized in that, Based on the interference information of the background interference, the background interference in the initial image to be detected is suppressed to obtain the target image to be detected, including: Determine whether all background interference types in the initial image to be detected are interference fringe interference; If the background interference is all interference of the type of interference, perform a two-dimensional Fourier transform on the initial image to be detected to obtain the first image to be detected. The energy of the frequency points at the location of background interference in the first image to be detected is attenuated to zero to obtain the second image to be detected; The second image to be detected is subjected to an inverse Fourier transform to obtain the target image to be detected.

9. The lens defect detection method based on image processing according to claim 5, characterized in that, Based on the interference information of the background interference, the background interference in the initial image to be detected is suppressed to obtain the target image to be detected, including: Determine whether the background interference type in the initial image to be detected includes interference fringes and random thermal noise. If so, the initial image to be detected is decomposed into a low-frequency image and a high-frequency image by wavelet transform; The low-frequency image is subjected to an interference suppression strategy corresponding to random thermal noise as the type of background interference, and the processed low-frequency image is obtained. The high-frequency image is subjected to an interference suppression strategy corresponding to interference fringe interference, which is the type of background interference, to obtain the processed high-frequency image. The processed low-frequency image and the processed high-frequency image are reconstructed to obtain the target image to be detected.

10. A lens defect detection system based on image processing, characterized in that, The system includes: an acquisition device and a processing device; The acquisition device is used to acquire target background interference feature information of background interference in the initial image to be detected of the lens; The processing device is used to determine the interference information of the background interference in the initial image to be detected based on the target background interference feature information; The processing device is used to suppress background interference in the initial image to be detected based on the interference information of the background interference, and obtain the target image to be detected. The processing device is used to identify defects in the lens based on the target image to be detected.