An optical lens surface defect detection method and system based on image processing

By acquiring the surface reflectivity and curvature data of the optical lens, dynamically setting the illumination light source and performing multimodal imaging and image enhancement, the problem of low accuracy in surface defect detection of optical lenses is solved, and efficient defect detection and evaluation is achieved.

CN119880946BActive Publication Date: 2025-07-25SHENZHEN YONGTAI PHOTOELECTRIC CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510378344.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-07-25
Estimated Expiration
2045-03-28

AI Technical Summary

Technical Problem

The existing optical lens surface defect detection technology fails to dynamically set the imaging illumination light source of the optical lens to be measured based on the optical lens surface reflection characteristic properties and lens surface curvature, resulting in a low detection accuracy.

Method used

By obtaining the surface reflectivity data and curvature data of the optical lens to be measured, the initial conditions of the illumination light source are determined, and optical filtering is performed to generate a filtered light source, perform multi-angle irradiation and multi-modal imaging, and image enhancement and defect recognition are performed after generating a panoramic image.

Benefits of technology

Improves the accuracy and sensitivity of surface defect detection of optical lenses, ensures a comprehensive assessment of surface conditions of optical lenses, and provides an objective assessment of defect type and severity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119880946B_ABST
    Figure CN119880946B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and particularly to a method and system for detecting surface defects of an optical lens based on image processing. The method includes the following steps: obtaining an optical lens to be measured; performing surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; performing surface curvature identification on the optical lens to be measured to obtain surface curvature data; determining the initial conditions of an illumination light source according to the surface reflectivity data, and performing optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered illumination light source. The present invention realizes the identification of the reflection characteristic attributes of the optical lens surface and the surface curvature of the lens through data processing technology, image processing technology and pattern recognition technology, determines the imaging illumination light source conditions to achieve multi-modal imaging of the lens surface, thereby obtaining a panoramic enhanced image of the lens, and detecting surface defects of the optical lens, improving the detection accuracy of lens surface defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an optical lens surface defect detection method and system based on image processing. Background Art

[0002] In the initial stage of optical lens production, manual inspection is mainly relied on to identify surface defects. Inspectors use tools such as magnifying glasses and microscopes to observe the lens surface by researchers to detect scratch, crack, and stain defects. This method is simple and intuitive, but there are problems of low efficiency and missed inspection; Therefore, researchers apply optical principle technology to optical lens inspection. For example, an interferometer is used to detect the surface shape error and defects of an optical element. By analyzing the interference fringes of light waves, the minute undulations and unevenness of the surface are measured to discover defects; However, the existing optical lens surface defect detection technology fails to dynamically set the imaging illumination light source for the optical lens to be measured according to the surface reflection characteristic attributes of the optical lens and the surface curvature of the lens, and it is difficult to perform multimodal imaging according to the imaging illumination light source, resulting in unclear surface defect features of the optical lens collected, and further leading to a low accuracy rate of lens surface defect detection. Summary of the Invention

[0003] Based on this, it is necessary to provide an optical lens surface defect detection method and system based on image processing to solve at least one of the above technical problems.

[0004] To achieve the above object, an optical lens surface defect detection method based on image processing, the method includes the following steps:

[0005] Step S1: Obtain the optical lens to be measured; perform surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; perform surface curvature identification on the optical lens to be measured to obtain surface curvature data;

[0006] Step S2: Determine the initial conditions of the illumination light source according to the surface reflectivity data, and perform optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; irradiate the optical lens to be measured from multiple angles with the filtered light source, and perform surface multimodal imaging to obtain a surface multimodal image;

[0007] Step S3: Stitch the surface multimodal images to generate an optical lens panoramic image; perform image enhancement on the optical lens panoramic image to obtain a lens panoramic enhanced image;

[0008] Step S4: Identify the mirror surface defect contour for the panoramic enhanced image of the lens, measure the contour parameters of the mirror surface defect contour to obtain the mirror surface defect contour parameters; determine the defect type for the mirror surface defect contour parameters to obtain the mirror surface defect type data; evaluate the severity of the mirror surface defect type data to generate a defect severity evaluation report.

[0009] The present invention simultaneously conducts surface reflectivity detection and surface curvature identification to accurately obtain the surface reflectivity data and surface curvature data of the optical lens to be measured respectively, ensuring that subsequent processing can be carried out based on the true and comprehensive physical characteristics of the optical lens, and avoiding inaccurate detection caused by missing or one-sided data; the accurate acquisition of the surface reflectivity data and surface curvature data enables subsequent determination of the initial conditions of the illumination source and optical filtering processing according to the characteristics of the optical lens itself, thereby providing a scientific and reasonable basis for subsequent multi-angle illumination and surface multi-modal imaging. Determine the initial conditions of the illumination source according to the surface reflectivity data, and then perform optical filtering processing on the initial conditions of the illumination source based on the surface curvature data to generate a filtered illumination source, so that the illumination source can accurately adapt to the surface characteristics of the optical lens to be measured; due to factors such as materials and processes, the surface reflectivity and curvature of different optical lenses are different. The filtered illumination source generated in this way can effectively solve the problem that traditional single light sources are difficult to adapt to the surface characteristics of multiple optical lenses, ensuring that the surface feature information of the lens can be better excited during subsequent illumination; use the filtered illumination source to perform multi-angle illumination on the optical lens to be measured and perform surface multi-modal imaging to obtain a surface multi-modal image; the combination of multi-angle illumination and multi-modal imaging can capture rich detail information on the surface of the optical lens from different perspectives and multiple imaging modes. Compared with single-angle and single-imaging mode, it can more comprehensively display the microscopic structure and potential defect characteristics on the lens surface, providing a richer and more accurate image data basis for subsequent image processing and defect detection, and improving the sensitivity and accuracy of defect detection. Stitching the surface multi-modal images can integrate local multi-modal images into a complete panoramic image, effectively solving the problem that it is difficult to cover the entire surface in a single imaging when the surface size of the optical lens is large; the generation of the panoramic image enables subsequent overall analysis of the surface of the optical lens, avoiding inaccurate judgment of information such as the defect position and distribution range due to incomplete images, and providing a complete image basis for comprehensively evaluating the surface condition of the optical lens; performing image enhancement on the panoramic image of the optical lens can improve the visual effects such as contrast and brightness of the panoramic image, highlighting the key details and potential defect characteristics in the image, making the defects that were not clear enough due to imaging conditions more obvious in the enhanced image; this high-quality enhanced panoramic image of the lens provides better data input for subsequent steps such as mirror defect contour recognition, improving the accuracy and reliability of defect recognition, and ensuring the accuracy of subsequent defect detection results.Perform mirror defect contour recognition on the panoramic enhanced image of the lens, and measure the contour parameters of the mirror defect contour, which can accurately identify the defect contour on the optical lens mirror surface, and quantitatively describe the characteristics such as the shape and size of the defect through contour parameter measurement; this precise recognition and quantification method enables the characteristic information of the defect to be presented in the form of specific data, providing an accurate and quantifiable basis for subsequent defect type judgment and severity assessment, avoiding errors caused by human subjective judgment, and improving the objectivity and accuracy of defect detection; perform defect type judgment on the mirror defect contour parameters to obtain mirror defect type data; perform defect severity assessment on the mirror defect type data, which can accurately determine the types of surface defects of the optical lens (such as scratches, spots, and bubbles), and scientifically evaluate the severity of the defect based on comprehensive information such as the type and contour parameters of the defect. The finally generated defect severity assessment report can provide clear and reliable reference basis for the quality control, production improvement, and subsequent use decision-making of the optical lens; therefore, the present invention realizes the recognition of the reflection characteristic attributes and the lens surface curvature of the optical lens surface through data processing technology, image processing technology, and pattern recognition technology, determines the imaging illumination light source conditions to achieve multi-modal imaging of the lens surface, thereby obtaining a panoramic enhanced image of the lens, and performs surface defect detection of the optical lens to improve the detection accuracy of lens surface defects.

[0010] Preferably, step S1 includes the following:

[0011] Step S11: Obtain the optical lens to be measured;

[0012] Step S12: Perform bright-field illumination on the optical lens to be measured through a point light source, and place the point light source 30 - 50 cm above the lens to obtain bright-field illumination;

[0013] Step S13: Perform dark-field illumination on the optical lens to be measured through an annular light source, and place the annular light source 20 - 30 cm below the lens to obtain dark-field illumination;

[0014] Step S14: Collect the lens surface images under bright-field illumination and dark-field illumination respectively, and set the resolution of the operating camera to be not less than 1920×1080 pixels, the exposure time of the bright-field image to be 1 / 100 second, and the exposure time of the dark-field image to be 1 / 50 second to obtain the bright-field image brightness value and the dark-field image brightness value;

[0015] Step S15: Perform lens surface reflectivity calculation on the bright-field image brightness value and the dark-field image brightness value to obtain surface reflectivity data;

[0016] Step S16: Perform surface curvature recognition on the optical lens to be measured to obtain surface curvature data.

[0017] The present invention obtains the optical lens to be measured, ensuring that the entire detection method can be carried out for a specific optical lens, laying a foundation for the implementation of subsequent steps; by performing bright-field illumination with a point light source located 30 - 50 cm above the lens, it can provide uniform and stable illumination conditions for the surface of the optical lens, ensuring that the captured bright-field image has good brightness uniformity, facilitating subsequent image processing and analysis; by performing dark-field illumination with an annular light source located 20 - 30 cm below the lens, it can effectively enhance the imaging effect of minute defects and details on the lens surface, enabling the dark-field image to clearly reflect the microscopic features of the lens surface, providing key information for subsequent defect detection; respectively capture the images of the lens surface under bright-field illumination and dark-field illumination, and set the resolution of the running camera to be not less than 1920×1080 pixels, ensuring that the images have sufficient details and clarity; at the same time, the exposure time of the bright-field image is 1 / 100 second, and the exposure time of the dark-field image is 1 / 50 second, which can respectively adapt to the bright-field and dark-field illumination conditions, avoiding overexposure or underexposure, so as to obtain accurate bright-field image brightness values and dark-field image brightness values, providing a reliable data basis for subsequent calculations; by calculating the surface reflectivity of the lens through the bright-field image brightness value and the dark-field image brightness value, accurate surface reflectivity data can be obtained; this calculation method based on the image brightness values under two different illumination conditions can effectively reflect the reflection characteristics of the optical lens surface, ensuring that subsequent operations can be optimized according to the actual reflection characteristics of the lens; by identifying the surface curvature of the optical lens to be measured, surface curvature data can be obtained; the acquisition of surface curvature data provides key information on the surface shape of the lens for subsequent detection.

[0018] Preferably, step S16 includes the following:

[0019] Step S161: Select three measurement points on the optical lens to be measured. The one located at the geometric center of the lens is denoted as the central measurement point; the one located within the range of 1 mm to 3 mm inside the edge of the lens is denoted as the edge measurement point; the one located at the middle position between the center and the edge of the lens, 5 mm to 10 mm away from the center, is denoted as the middle measurement point;

[0020] Step S162: Use a laser displacement sensor to measure the three measurement points three times, with an interval of 0.5 second to 1 second for each measurement, record the curvature radius value of each measurement, and obtain the measurement point curvature radius measurement value;

[0021] Step S163: Take the average value of the measurement point curvature radius measurement values to obtain the measurement point curvature radius value;

[0022] Step S164: According to the measurement point curvature radius value, and through the least squares method, fit the overall curvature distribution of the surface of the optical lens to be measured to obtain the surface curvature data.

[0023] By selecting the central measurement point, the edge measurement point, and the intermediate measurement point on the optical lens, the present invention can comprehensively cover the key areas of the lens surface, ensuring that the measurement points can reflect the curvature characteristics of the center, edge, and intermediate regions of the lens. Using a laser displacement sensor to measure the three measurement points three times ensures the stability and reliability of the measurement results. The interval between each measurement is 0.5 to 1 second, avoiding instantaneous errors during the measurement process and improving the measurement accuracy. By recording the curvature radius values of each measurement, accurate original data is provided for subsequent calculations. Taking the average value of the measured curvature radius values of the measurement points can effectively reduce measurement errors. Through averaging processing, the obtained curvature radius values of the measurement points are more stable and accurate. According to the curvature radius values of the measurement points, the overall curvature distribution of the surface of the optical lens to be measured is fitted by the least squares method, which can accurately reflect the curvature change of the optical lens surface and provide accurate curvature data for subsequent defect detection and analysis.

[0024] Preferably, step S2 includes the following:

[0025] Step S21: Determine the initial conditions of the illumination source according to the surface reflectivity data. If the surface reflectivity data is greater than 0.7, select a polarized light source and set the initial polarization angle to 45° ± 5°; if the surface reflectivity data is less than or equal to 0.7, select an annular uniform light source and set the initial brightness to 1200 ± 100 cd.

[0026] Step S22: Perform optical filtering on the initial conditions of the illumination source based on the surface curvature data. If the surface curvature radius is less than 10 mm, use a high-pass filter and set the cut-off frequency to 0.1 ± 0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, use a low-pass filter and set the cut-off frequency to 0.05 ± 0.005 mm.

[0027] Step S23: Irradiate the optical lens to be measured from multiple angles with the filtered light source and perform surface multi-modal imaging to obtain a surface multi-modal image.

[0028] The present invention determines the initial conditions of the illumination light source based on surface reflectivity data, and can select appropriate light source types and parameters according to the actual reflection characteristics of the optical lens; when the surface reflectivity data is greater than 0.7, a polarized light source is selected and the initial polarization angle is set to 45° ± 5°, effectively reducing the interference of reflected light and enhancing the imaging contrast; when the surface reflectivity data is less than or equal to 0.7, an annular uniform light source is selected and the initial brightness is set to 1200 ± 100 cd, providing stable illumination and ensuring the imaging quality; this light source selection method based on reflectivity data can provide the best illumination conditions for the subsequent imaging process and improve the accuracy of detection; performing optical filtering processing on the initial conditions of the illumination light source based on surface curvature data can adjust the spectral characteristics of the light source according to the curvature characteristics of the optical lens. When the surface curvature radius is less than 10 mm, a high-pass filter is used and the cut-off frequency is set to 0.1 ± 0.01 mm, which can effectively remove low-frequency noise and highlight high-frequency details; when the surface curvature radius is greater than or equal to 10 mm, a low-pass filter is used and the cut-off frequency is set to 0.05 ± 0.005 mm, smoothing high-frequency noise and retaining low-frequency characteristics. This filtering process based on curvature data can optimize the spectral distribution of the light source, further improve the imaging quality, and enhance the sensitivity of defect detection; irradiating the optical lens to be measured with the filtered light source at multiple angles and performing surface multi-modal imaging can capture the detailed information on the surface of the optical lens from multiple angles and multiple imaging modes; multi-angle irradiation can fully cover the lens surface and avoid shadows or occlusions caused by single-angle irradiation; multi-modal imaging can integrate the advantages of multiple imaging technologies and provide richer image information.

[0029] Preferably, step S23 includes the following:

[0030] Step S231: Install the filtered light source on a light source bracket with an adjustable angle, and set the irradiation angle range of the filtered light source to 0° to 60° to obtain light source irradiation angle data. The specific irradiation angles are set to 0°, 30°, and 60°, and the irradiation time for each irradiation angle is 2 seconds, 3 seconds, 4 seconds, and 5 seconds respectively;

[0031] Step S232: Judge the imaging conditions on the lens surface according to the light source irradiation angle data, and determine the surface imaging mode for the imaging conditions on the lens surface to obtain the lens surface imaging mode, where the lens surface imaging mode includes bright-field imaging mode, dark-field imaging mode, and polarized imaging mode;

[0032] Step S233: Perform multi-modal imaging on the optical lens to be measured based on the lens surface imaging mode to generate lens multi-modal imaging data; convert the image format of the lens multi-modal imaging data to obtain a surface multi-modal image.

[0033] The filtering light source of the present invention is installed on a light source bracket with an adjustable angle, and the irradiation angle range is set to 0° to 60°, specifically the irradiation angles are 0°, 30°, and 60°. The irradiation time for each angle is 2 seconds, 3 seconds, 4 seconds, and 5 seconds respectively, which can comprehensively cover all areas of the optical lens surface, ensuring uniform illumination of the lens surface from different directions; by precisely controlling the irradiation angle and time, it can effectively avoid the shadow or reflection interference caused by single-angle illumination and improve the imaging quality; according to the light source irradiation angle data, the imaging conditions on the lens surface are judged, and the imaging mode on the lens surface is determined, including bright-field imaging mode, dark-field imaging mode, and polarization imaging mode; this selection of imaging mode based on the irradiation angle can flexibly adjust the imaging method according to the reflection characteristics and curvature characteristics of the lens surface; the bright-field imaging mode is suitable for detecting the overall characteristics of the lens surface, the dark-field imaging mode can highlight small defects and details, and the polarization imaging mode can effectively reduce the interference of reflected light. Through this comprehensive selection of imaging modes, it can ensure the acquisition of high-quality image data under different illumination conditions and provide diversified imaging support for subsequent defect detection; based on the imaging mode on the lens surface, multi-modal imaging is performed on the optical lens to be tested, generating multi-modal imaging data of the lens, and the image format of the imaging data is converted, which can integrate the advantages of bright-field, dark-field, and polarization imaging, and capture the detailed information of the lens surface from different angles and modes; the image format conversion ensures that the data under different imaging modes can be uniformly processed, effectively improving the sensitivity and accuracy of defect detection and providing a high-quality image basis for the comprehensive evaluation of the optical lens surface quality.

[0034] Preferably, step S233 includes the following:

[0035] Step S2331: According to the bright-field imaging mode, irradiate the filtering light source on the optical lens imaging platform at an angle of 0°.

[0036] Step S2332: Use a high-resolution camera to collect bright-field images, set the resolution of the camera to not less than 2048×2048 pixels, the exposure time to 1 / 125 seconds, and the ISO to 100 - 200, and record the bright-field images of the optical lens.

[0037] Step S2333: According to the dark-field imaging mode, irradiate the filtering light source on the optical lens imaging platform at an angle of 30°.

[0038] Step S2334: Use a high-resolution camera to collect dark-field images, set the resolution of the camera to not less than 1080×1080 pixels, the exposure time to 1 / 100 seconds, and the ISO to 200 - 300, and record the dark-field images of the optical lens.

[0039] Step S2335: Irradiate the filtered light source at an angle of 60° onto the imaging platform of the optical lens according to the polarization imaging mode;

[0040] Step S2336: Use a high-resolution camera to collect polarization images. Set the resolution of the camera to not less than 720×720 pixels, the exposure time to 1 / 60 second, and the ISO to 300 - 400, and record the polarization images of the optical lens;

[0041] Step S2337: Perform multi-modal image labeling on the bright-field image, dark-field image, and polarization image of the optical lens to generate lens multi-modal imaging data;

[0042] Step S2338: Convert the image format of the lens multi-modal imaging data to obtain the surface multi-modal image.

[0043] According to the bright-field imaging mode, the filtered light source is irradiated on the imaging platform of the optical lens at an angle of 0°, which can ensure that the light source directly irradiates the lens surface, provide uniform illumination conditions, effectively highlight the overall structure and macroscopic features of the lens surface, provide an ideal illumination environment for subsequent bright-field image acquisition, and ensure the brightness uniformity and detail clarity of the image; use a high-resolution camera to collect bright-field images, set the resolution of the camera to not less than 2048×2048 pixels, the exposure time to 1 / 125 seconds, and the ISO to 100 - 200, which can ensure that the collected bright-field images have high clarity and low noise levels. The high resolution ensures the integrity of image details, and the appropriate exposure time and ISO settings ensure the brightness and contrast of the image, thus providing high-quality bright-field image data for subsequent image analysis; according to the dark-field imaging mode, the filtered light source is irradiated on the imaging platform of the optical lens at an angle of 30°, which can effectively highlight the small defects and details on the lens surface, enhance the imaging effect of the surface micro-structure, and provide optimized illumination conditions for dark-field image acquisition; use a high-resolution camera to collect dark-field images, set the resolution of the camera to not less than 1080×1080 pixels, the exposure time to 1 / 100 seconds, and the ISO to 200 - 300, which can ensure that the collected dark-field images have sufficient details and appropriate brightness, effectively avoid the decline in image quality caused by insufficient exposure or overexposure, and ensure that the dark-field images can clearly reflect the small defects and details on the lens surface; according to the polarization imaging mode, the filtered light source is irradiated on the imaging platform of the optical lens at an angle of 60°, which can effectively reduce the interference of reflected light, enhance the contrast of the image, enable the polarized light to better interact with the lens surface, thereby highlighting the microscopic structure and defects on the surface, and provide optimized illumination conditions for polarization image acquisition; use a high-resolution camera to collect polarization images, set the resolution of the camera to not less than 720×720 pixels, the exposure time to 1 / 60 seconds, and the ISO to 300 - 400, which can ensure that the collected polarization images have sufficient details and appropriate brightness, effectively avoid the decline in image quality caused by the interference of reflected light, and ensure that the polarization images can clearly reflect the microscopic structure and defects on the lens surface; perform multi-modal image marking on the bright-field image, dark-field image, and polarization image of the optical lens, which can uniformly manage and mark the image data under different imaging modes, ensure that the image data under different imaging modes can be accurately identified and processed, and provide a comprehensive image basis for defect detection; perform image format conversion on the multi-modal imaging data of the lens, which can unify the image data under different imaging modes into one format, facilitating subsequent image processing and analysis.

[0044] Preferably, step S3 includes the following:

[0045] Step S31: Identify the image feature matching points of the surface multimodal image to obtain the image feature matching points; perform multimodal image stitching and matching on the surface multimodal image according to the image feature matching points, and set the overlapping area to 20%-30% of the image width to generate an initial stitched image;

[0046] Step S32: Crop the stitching edges of the initial stitched image and perform image alignment to obtain the panoramic image of the optical lens;

[0047] Step S33: Convert the panoramic image of the optical lens into a grayscale image to obtain the grayscale image of the optical lens; count the grayscale value pixels of the grayscale image of the optical lens, and perform cumulative distribution calculation on the grayscale value pixels to generate a histogram equalization image;

[0048] Step S34: Enhance the contrast of the histogram equalization image and adjust the grayscale range to [50, 200] to obtain a contrast-enhanced image;

[0049] Step S35: Sharpen the edges of the contrast-enhanced image to obtain a panoramic enhanced image of the lens.

[0050] The present invention performs image feature matching point recognition on surface multi-modal images, which can accurately locate key feature points in the images, provide accurate reference points for subsequent image stitching, and set the overlapping area to 20%-30% of the image width, which can effectively ensure the accuracy and stability of stitching, avoid stitching errors caused by too small overlapping areas or information redundancy caused by too large overlapping areas, and thus generate a high-quality initial stitched image; perform stitching edge cropping on the initial stitched image and perform image alignment, which can remove the redundant edge parts generated during the stitching process and ensure the overall consistency of the image after stitching; through the cropping and alignment operations, the obtained panoramic image of the optical lens has clear boundaries and accurate geometric relationships, providing a complete image basis for subsequent image processing and defect detection; convert the panoramic image of the optical lens into a grayscale image, which can simplify the image data, reduce the interference of color information, and highlight the brightness features of the image; count the grayscale value pixels of the grayscale image and perform cumulative distribution calculation to generate a histogram equalization image, which can adjust the grayscale distribution of the image, enhance the contrast of the image, and make the details in the image more clearly visible, providing an optimized data basis for subsequent image enhancement operations; perform contrast enhancement on the histogram equalization image and adjust the grayscale range to [50, 200], which can further improve the visual effect of the image and make the details of the dark and bright parts in the image more obvious. Through contrast enhancement, the obtained contrast-enhanced image can more clearly reflect the texture and potential defects on the surface of the optical lens, providing high-quality image data for subsequent image analysis and defect detection; perform image edge sharpening on the contrast-enhanced image, which can highlight the edge information in the image and enhance the detail expression of the image; through edge sharpening processing, the obtained enhanced panoramic image of the lens can more clearly display the microstructures and defects on the surface of the optical lens, improve the sensitivity and accuracy of defect detection, and provide a better image basis for subsequent defect recognition and analysis.

[0051] Preferably, step S4 includes the following:

[0052] Step S41: Perform mirror edge defect detection on the enhanced panoramic image of the lens, set the threshold to 50-150, and extract the mirror edge defect image;

[0053] Step S42: Search for contours on the mirror edge defect image. Starting from the upper left corner of the image, scan the image pixel by pixel to find edge points; when an edge point is found, trace along the edge until returning to the starting point; repeat this operation for all edge points in the image to extract the mirror defect contour data;

[0054] Step S43: Measure the perimeter and area of the mirror defect contour data, and determine the aspect ratio of the mirror defect contour based on the perimeter and area of the mirror defect contour;

[0055] Step S44: Combine the perimeter of the defect contour, the area of the defect contour, and the aspect ratio of the length to width of the mirror surface defect contour to obtain the mirror surface defect contour parameters;

[0056] Step S45: Judge the defect type for the mirror surface defect contour parameters to obtain the mirror surface defect type data; evaluate the severity of the mirror surface defect type data to generate a defect severity evaluation report.

[0057] The present invention performs mirror surface edge defect detection on the lens panoramic enhanced image, sets the threshold to 50 - 150, can effectively distinguish the defect area and the normal area in the image, and ensures the accurate extraction of the defect area; by extracting the mirror surface edge defect image, it provides a clear image basis for the subsequent recognition and analysis of the defect contour, and improves the sensitivity and accuracy of defect detection; search for the contour on the mirror surface edge defect image, start from the upper left corner of the image and scan and trace the edge pixel by pixel, which can comprehensively and accurately extract the contour data of the mirror surface defect; this method of scanning and tracing the edge pixel by pixel can ensure that no edge points are missed and the contour information of the defect is completely extracted, providing accurate data support for the subsequent calculation of defect characteristics; calculate the perimeter of the defect contour and the area of the defect contour for the mirror surface defect contour data, and determine the aspect ratio of the length to width of the mirror surface defect contour, which can comprehensively quantify the geometric characteristics of the defect; through the calculation of these parameters, the shape and size of the defect can be accurately described, providing an objective and quantitative basis for the subsequent defect type judgment and severity evaluation, and improving the scientificity and reliability of defect detection; combine the perimeter of the defect contour, the area of the defect contour, and the aspect ratio of the length to width of the mirror surface defect contour to obtain the mirror surface defect contour parameters, which can integrate multiple geometric feature parameters into a complete data set; this integration method is convenient for subsequent analysis and processing, ensures the comprehensiveness and consistency of defect characteristics, and provides comprehensive data support for defect type judgment and severity evaluation; judge the defect type for the mirror surface defect contour parameters, which can accurately distinguish different types of defects, such as scratches, spots, bubbles, etc.; evaluate the severity of the mirror surface defect type data to generate a defect severity evaluation report, which can scientifically evaluate the severity of the defect according to the type and geometric characteristics of the defect, provide a clear reference basis for the quality control and production improvement of the optical lens, and ensure that the surface quality of the optical lens meets the standard requirements.

[0058] Preferably, Step S45 includes the following:

[0059] Step S451: Determine the defect type based on the mirror defect contour parameters. If the defect contour area is less than 100 square pixels and the aspect ratio of the mirror defect contour is greater than 5, it is judged as a mirror scratch; if the defect contour area is greater than 100 square pixels and less than 500 square pixels, and the aspect ratio of the mirror defect contour is less than 2, it is judged as a mirror stain; if the defect contour area is greater than 500 square pixels and the aspect ratio of the mirror defect contour is less than 1.5, it is judged as a mirror edge break; if the defect contour area is less than 200 square pixels and the aspect ratio of the mirror defect contour is greater than 2 and less than 5, it is judged as a mirror film peeling.

[0060] Step S452: Combine the defect types of mirror scratches, mirror stains, mirror edge breaks, and mirror film peeling, and record the defect parameter quantity to obtain the mirror defect type data.

[0061] Step S453: Evaluate the severity of the mirror defect type data. If the length of the mirror scratch is less than 5 mm, the area of the mirror stain is less than 1 square mm, the length of the mirror edge break is less than 2 mm, and the area of the mirror film peeling is less than 0.5 square mm, it is judged as a minor mirror defect.

[0062] Step S454: If the length of the mirror scratch is between 5 and 10 mm, the area of the mirror stain is between 1 and 5 square mm, the length of the mirror edge break is between 2 and 5 mm, and the area of the mirror film peeling is between 0.5 and 2 square mm, it is judged as a medium mirror defect.

[0063] Step S455: If the length of the mirror scratch is greater than 10 mm, the area of the mirror stain is greater than 5 square mm, the length of the mirror edge break is greater than 5 mm, and the area of the mirror film peeling is greater than 2 square mm, it is judged as a severe mirror defect.

[0064] Step S456: Record the severity of the minor mirror defect, medium mirror defect, and severe mirror defect to generate a defect severity evaluation report.

[0065] The present invention determines the defect type according to the profile parameters of the mirror surface defect, and can accurately distinguish different types of defects based on the quantitative criteria of the defect profile area and aspect ratio; by setting clear judgment conditions, such as the characteristic parameter ranges of scratches, stains, broken edges and film peeling, it ensures the objectivity and consistency of defect classification, and provides an accurate type basis for the subsequent evaluation of the defect severity; it combines the defect types of mirror surface scratches, mirror surface stains, mirror surface broken edges and mirror surface film peeling, and records the defect parameter quantity, and can systematically integrate the classified defect information; this combination and recording method is convenient for statistical analysis of the quantity and characteristics of different types of defects, generates complete mirror surface defect type data, and provides comprehensive defect information for subsequent quality evaluation and production improvement; it evaluates the defect severity of the mirror surface defect type data, and can accurately judge the minor mirror surface defects by setting clear size and area thresholds; this evaluation method based on quantitative criteria can ensure the high accuracy and consistency of the identification of minor defects, and provides a scientific basis for subsequent quality grading and treatment; by setting clear size and area thresholds, it can accurately judge the medium mirror surface defects, ensure the high accuracy and consistency of the identification of medium defects, provide a scientific basis for subsequent quality grading and treatment, and ensure that the quality control of the optical lens meets the standard requirements; by setting clear size and area thresholds, it can accurately judge the severe mirror surface defects, and this quantitative evaluation method can ensure the high accuracy and consistency of the identification of severe defects, provide a scientific basis for subsequent quality grading and treatment, and ensure that the quality control of the optical lens meets the standard requirements; it records the defect severity of minor mirror surface defects, medium mirror surface defects and severe mirror surface defects, generates a defect severity evaluation report, and can systematically integrate and record the defect information of different severity levels.

[0066] In this specification, an optical lens surface defect detection system based on image processing is provided for performing the above-mentioned optical lens surface defect detection method based on image processing. The optical lens surface defect detection system based on image processing includes:

[0067] An optical lens feature acquisition module for obtaining an optical lens to be measured; performing surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; performing surface curvature identification on the optical lens to be measured to obtain surface curvature data;

[0068] A lens multimodal imaging module for determining the initial conditions of the illumination light source according to the surface reflectivity data, performing optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; irradiating the optical lens to be measured from multiple angles with the filtered light source and performing surface multimodal imaging to obtain a surface multimodal image;

[0069] The panoramic image enhancement module of the lens is used to splice the surface multimodal images to generate an optical lens panoramic image; perform image enhancement on the optical lens panoramic image to obtain a panoramic enhanced image of the lens;

[0070] The lens defect detection and evaluation module is used to identify the mirror defect contour of the panoramic enhanced image of the lens, measure the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; judge the defect type based on the mirror defect contour parameters to obtain the mirror defect type data; evaluate the severity of the mirror defect type data to generate a defect severity evaluation report.

[0071] Through the optical lens feature acquisition module, the surface reflectivity detection and surface curvature recognition are carried out simultaneously to accurately obtain the surface reflectivity data and surface curvature data of the optical lens to be measured respectively, ensuring that the subsequent processing can be carried out based on the real and comprehensive physical characteristics of the optical lens and avoiding inaccurate detection caused by missing or one-sided data; the accurate acquisition of the surface reflectivity data and surface curvature data enables the subsequent determination of the initial conditions of the illumination source and the optical filtering process according to the characteristics of the optical lens itself, thus providing a scientific and reasonable basis for the subsequent multi-angle illumination and surface multi-modal imaging links. Through the lens multi-modal imaging module, the initial conditions of the illumination source are determined according to the surface reflectivity data, and then the initial conditions of the illumination source are optically filtered based on the surface curvature data to generate a filtered illumination source, enabling the illumination source to accurately adapt to the surface characteristics of the optical lens to be measured; due to factors such as materials and processes, the surface reflectivity and curvature of different optical lenses are different, and the filtered illumination source generated in this way can effectively solve the problem that traditional single light sources are difficult to adapt to the surface characteristics of multiple optical lenses, ensuring that the surface feature information of the lens can be better excited during the subsequent illumination process; the filtered illumination source is used to irradiate the optical lens to be measured at multiple angles and surface multi-modal imaging is carried out to obtain a surface multi-modal image; the combination of multi-angle illumination and multi-modal imaging methods can capture rich detail information on the surface of the optical lens from different perspectives and multiple imaging modes. Compared with a single angle and a single imaging mode, it can more comprehensively display the microscopic structure and potential defect characteristics on the lens surface, providing a richer and more accurate image data basis for the subsequent image processing and defect detection links, and improving the sensitivity and accuracy of defect detection. Through the lens panoramic image enhancement module, the surface multi-modal images are stitched together, and the local multi-modal images can be integrated into a complete panoramic image, effectively solving the problem that it is difficult to cover the entire surface in a single imaging when the surface size of the optical lens is large; the generation of the panoramic image enables the subsequent overall analysis of the surface of the optical lens, avoiding inaccurate judgment of information such as the defect position and distribution range due to incomplete images, and providing a complete image basis for comprehensively evaluating the surface condition of the optical lens; the image enhancement of the optical lens panoramic image can improve the visual effects such as the contrast and brightness of the panoramic image, highlighting the key details and potential defect characteristics in the image, making the defects that were not clear enough due to imaging conditions more obvious in the enhanced image; this high-quality lens panoramic enhanced image provides better data input for subsequent links such as mirror defect contour recognition, improving the accuracy and reliability of defect recognition, and ensuring the accuracy of subsequent defect detection results.Through the lens defect detection and evaluation module, the mirror defect contour of the lens panoramic enhanced image is recognized, and the contour parameters of the mirror defect contour are measured. It can accurately identify the defect contour on the optical lens mirror surface, and quantitatively describe the shape and size characteristics of the defect through the measurement of contour parameters. This precise identification and quantification method enables the characteristic information of the defect to be presented in the form of specific data, providing an accurate and quantifiable basis for subsequent defect type judgment and severity assessment, avoiding errors caused by human subjective judgment, and improving the objectivity and accuracy of defect detection. The defect type judgment is carried out on the mirror defect contour parameters to obtain the mirror defect type data. The severity assessment of the mirror defect type data can accurately determine the types of surface defects of the optical lens (such as scratches, spots, and bubbles), and scientifically evaluate the severity of the defect based on comprehensive information such as the type and contour parameters of the defect. The finally generated defect severity assessment report can provide a clear and reliable reference basis for the quality control, production improvement, and subsequent use decision-making of the optical lens. Therefore, the present invention uses data processing technology, image processing technology, and pattern recognition technology to realize the recognition of the reflection characteristic attributes and the lens surface curvature of the optical lens surface, determine the imaging illumination light source conditions to realize multi-modal imaging of the lens surface, thereby obtaining the lens panoramic enhanced image, and performing the detection of the optical lens surface defects to improve the detection accuracy of the lens surface defects. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 It is a schematic diagram of the step flow of an optical lens surface defect detection method based on image processing;

[0073] Figure 2 is Figure 1 a detailed implementation step flow schematic diagram of step S3 in

[0074] Figure 3 is Figure 1 a detailed implementation step flow schematic diagram of step S4 in

[0075] The realization, functional characteristics, and advantages of the object of the present invention will be further described in conjunction with the embodiments with reference to the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0076] The technical method of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0077] In addition, the attached drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor methods and / or microcontroller methods.

[0078] It should be understood that although terms such as "first" and "second" may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.

[0079] To achieve the above object, please refer to Figures 1 to 3 , an optical lens surface defect detection method based on image processing, the method comprising the following steps:

[0080] Step S1: Obtain the optical lens to be measured; perform surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; perform surface curvature identification on the optical lens to be measured to obtain surface curvature data;

[0081] Step S2: Determine the initial conditions of the illumination light source according to the surface reflectivity data, and perform optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; irradiate the optical lens to be measured from multiple angles with the filtered light source, and perform surface multi-modal imaging to obtain a surface multi-modal image;

[0082] Step S3: Stitch the surface multi-modal images to generate a panoramic image of the optical lens; perform image enhancement on the panoramic image of the optical lens to obtain a panoramic enhanced image of the lens;

[0083] Step S4: Identify the mirror defect contour of the panoramic enhanced image of the lens, measure the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; judge the defect type of the mirror defect contour parameters to obtain the mirror defect type data; evaluate the severity of the mirror defect type data to generate a defect severity evaluation report.

[0084] In an embodiment of the present invention, as shown in reference to Figure 1 , the optical lens surface defect detection method based on image processing comprises the following steps:

[0085] Step S1: Obtain the optical lens to be measured; perform surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; perform surface curvature identification on the optical lens to be measured to obtain surface curvature data;

[0086] In the embodiment of the present invention, obtain the optical lens to be measured; enable backlight illumination, place the light source behind the lens, and make the light pass through the lens and irradiate onto the photosensitive element of the camera from the other side of the lens; enable low-angle annular dark-field light illumination, place the annular light source around the lens, and make the light irradiate onto the lens surface at a low angle to highlight the microstructures and defects on the lens surface; enable coaxial light illumination, align the light source with the optical axis of the camera, and make the light perpendicularly irradiate onto the lens surface to observe the overall condition of the lens surface; fix the optical lens to be measured on the detection platform, adjust the relative position between the lens and the camera so that the reflected light from the lens surface can be clearly imaged; sequentially collect the reflected images of the lens surface under different illumination conditions, and record them as backlight images, dark-field images, and coaxial light images respectively; perform grayscale processing on the collected reflected images to convert the color images into grayscale images; perform normalization processing on the grayscale images to adjust the pixel value range to between 0 and 1 to eliminate the difference in image brightness under different illumination conditions; calculate the grayscale histogram of the normalized image, count the distribution range of the reflected light intensity, and obtain the statistical information of the grayscale histogram; according to the statistical information of the grayscale histogram, calculate the mean and standard deviation of the reflected light intensity to obtain the surface reflectivity data; adjust the relative position between the camera and the lens to make the imaging on the lens surface clear; collect multiple images of the lens surface at a preset sampling interval to cover different regions of the lens to obtain comprehensive surface information; perform denoising processing on the collected images, use the Gaussian filtering algorithm, set appropriate filtering parameters to remove the noise in the images; perform edge enhancement processing on the denoised images to highlight the edge features on the lens surface for subsequent edge detection; use the edge detection algorithm to extract the edge information on the lens surface to obtain an edge image, analyze the edge image, and extract the geometric features of the edge, including information such as the length, direction, and curvature of the edge; according to the geometric features of the edge, calculate the curvature distribution on the lens surface to obtain the curvature value of each detection point; store the calculated curvature values as a numerical array and record the curvature data of each detection point.

[0087] Step S2: Determine the initial conditions of the illumination light source according to the surface reflectivity data, and perform optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; irradiate the optical lens to be measured with the filtered light source at multiple angles and perform surface multimodal imaging to obtain surface multimodal images;

[0088] In the embodiments of the present invention, the initial brightness and angle of the illumination light source are determined according to the mean and standard deviation of the reflected light intensity in the surface reflectivity data. If the mean of the reflected light intensity is high and the standard deviation is small, it indicates that the surface reflectivity of the lens is strong and uniform, and a light source with a lower brightness is selected; otherwise, a light source with a higher brightness is selected. According to the distribution range of the reflected light intensity in the surface reflectivity data, the initial wavelength of the illumination light source is determined. If the reflected light intensity is mainly concentrated in a specific wavelength range, a light source with the corresponding wavelength is selected. Based on the surface curvature data, the curvature change range of different regions on the lens surface is calculated. For regions with a large curvature change, a high-pass filter is used for optical filtering to highlight high-frequency information; for regions with a small curvature change, a low-pass filter is used for optical filtering to retain low-frequency information. The optical filter is placed between the illumination light source and the optical lens to be measured, so that the light of the filtered light source irradiates the lens surface, and the light intensity distribution of the filtered light source should match the curvature distribution of the lens surface. The filtered light source is installed on a light source bracket with an adjustable angle, and multi-angle irradiation is performed according to a preset angle range (such as 0° to 90°) and angle interval (such as 10°). At each irradiation angle, the brightness and wavelength of the light source are kept unchanged, and the optical lens is irradiated in sequence. At each irradiation angle, a high-resolution industrial camera is used to collect images of the lens surface. The collected images include bright-field images and dark-field images. The bright-field images are used to observe the overall situation of the lens surface, and the dark-field images are used to highlight the micro-defects on the lens surface. The collected bright-field images and dark-field images are respectively preprocessed, including operations such as denoising and contrast enhancement. The preprocessed bright-field images and dark-field images are fused to obtain a surface multi-modal image.

[0089] Step S3: Stitch the surface multi-modal images to generate a panoramic image of the optical lens; perform image enhancement on the panoramic image of the optical lens to obtain a panoramic enhanced image of the lens;

[0090] In the embodiments of the present invention, the collected surface multimodal images (including bright-field images and dark-field images) are denoised by using a Gaussian filtering method with a filter kernel size set to 5×5 to remove random noise in the images; the contrast of the denoised images is enhanced by using the Gamma transformation method to nonlinearly adjust the gray values of the images and enhance the contrast between shallow defects and the background in the images; the key feature points of each image are extracted by using the SIFT or ORB algorithm. The feature extraction parameters of the SIFT algorithm include 4 layers of Gaussian pyramids, and the standard deviations of Gaussian filtering for each layer are 1.2, 2.4, 4.8, and 9.6 respectively; the matching relationship between the feature points is calculated by using the nearest neighbor matching method, and the matching threshold is set to 0.7 to screen out reliable feature point matching pairs; according to the matching results of the feature points, the geometric transformation relationship between the images is calculated. For bright-field images and dark-field images, the affine transformation matrix or the homography matrix is calculated respectively; the image stitching algorithm is used to stitch multiple images according to the calculated transformation matrix to generate an optical lens panoramic image. During the stitching process, weighted average fusion is performed on the overlapping areas; the generated optical lens panoramic image is converted into a grayscale image by using the weighted average method, and the pixel values of the three RGB channels are converted into grayscale values in proportion; a compensation factor is introduced to correct the logarithmic function of the MSR algorithm, and the optimal scale parameter is calculated based on the flatness index to determine the adaptive weight; the specific parameter settings of the MSR algorithm are as follows: three scales (15, 80, 250 pixels) are selected, and Gaussian filtering is performed on the grayscale image respectively, and the standard deviations of filtering are 15, 80, 250 pixels respectively; the logarithmic images at each scale are calculated, and the logarithmic function is corrected by the compensation factor; the brightness of the enhanced image is normalized, and the brightness range of the image is adjusted to between 0 and 1. The specific method is to calculate the minimum and maximum values of the image, and then normalize each pixel value.

[0091] Step S4: Identify the mirror surface defect contour of the lens panoramic enhanced image, measure the contour parameters of the mirror surface defect contour to obtain the mirror surface defect contour parameters; judge the defect type based on the mirror surface defect contour parameters to obtain the mirror surface defect type data; evaluate the severity of the mirror surface defect type data to generate a defect severity evaluation report.

[0092] In the embodiments of the present invention, the panoramic enhanced image of the lens is grayscale processed to convert the color image into a grayscale image for subsequent processing; Gaussian filtering is used to smooth the grayscale image, with the filter kernel size being 5×5 and the standard deviation being 1.5 to remove noise; the Canny edge detection algorithm is used to extract the edge information in the image. The low threshold of the Canny algorithm is set to 50 and the high threshold is set to 150; the detected edges are thinned to remove isolated edge points and retain continuous edge contours; the contour extraction algorithm (such as the findContours function in OpenCV) is used to extract the contours in the image, and the contour extraction mode is set to cv2.RETR_EXTERNAL to extract the outer contours; the extracted contours are screened to remove contours with an area smaller than a preset threshold (such as 10 pixels); for each extracted contour, its geometric parameters are calculated, including the area, perimeter, major axis and minor axis lengths of the contour; the shape features of the contour are calculated, such as roundness (the ratio of the contour area to the area of the equivalent circle), rectangularity (the ratio of the contour area to the area of the minimum bounding rectangle); the centroid position of the contour is calculated by calculating the geometric center of the contour; the calculated contour parameters are stored as a data structure, including the area, perimeter, major axis and minor axis lengths, roundness, rectangularity and centroid position of the contour; according to the contour parameters, feature vectors are extracted, including area, perimeter, major axis and minor axis lengths, roundness, rectangularity, etc., and the feature vectors are normalized to adjust the eigenvalue range to between 0 and 1; a pre-trained classification model (such as a support vector machine SVM or an artificial neural network ANN) is used to classify the feature vectors; the classification model outputs a defect type label, such as scratch, spot, crack, etc., according to the eigenvalues of the feature vectors; the defect type label is associated with the corresponding contour parameters and stored as defect type data; according to the defect type label, combined with the contour parameters (such as area, perimeter, etc.), the severity of the defect is evaluated; the severity of a scratch is evaluated by its length and width, and the severity of a spot is evaluated by its area. A grading standard for the severity is set, such as minor, medium, severe, and the defect is classified into the corresponding grade according to the eigenvalue of the defect; the evaluation results are sorted into a defect severity evaluation report, including the defect type, location, severity level and the corresponding contour parameters, and the report contains an image annotation of the defect for intuitive display of the defect location.

[0093] Preferably, step S1 includes the following:

[0094] Step S11: Obtain the optical lens to be measured;

[0095] Step S12: Perform bright-field illumination on the optical lens to be measured through a point light source, with the point light source located 30 - 50 cm above the lens to obtain the bright-field illumination setting;

[0096] Step S13: Perform dark-field illumination on the optical lens to be measured using a ring light source. Place the ring light source 20 - 30 cm below the lens to obtain the dark-field illumination setting;

[0097] Step S14: Collect the lens surface images under bright-field illumination and dark-field illumination respectively, and set the resolution of the running camera to be not less than 1920×1080 pixels. The exposure time of the bright-field image is 1 / 100 second, and the exposure time of the dark-field image is 1 / 50 second to obtain the bright-field image brightness value and the dark-field image brightness value;

[0098] Step S15: Calculate the surface reflectivity of the lens by using the bright-field image brightness value and the dark-field image brightness value to obtain the surface reflectivity data;

[0099] Step S16: Identify the surface curvature of the optical lens to be measured to obtain the surface curvature data.

[0100] In the embodiment of the present invention, place the optical lens to be measured on the detection platform to ensure that the lens surface is clean and free from external interference; perform bright-field illumination on the optical lens to be measured using a point light source, and place the point light source 30 - 50 cm above the lens; ensure that the incident angle of the light source is between 45 degrees and 90 degrees so that the reflected light can directly enter the camera lens to form a bright imaging effect; perform dark-field illumination on the optical lens to be measured using a ring light source, and place the ring light source 20 - 30 cm below the lens; ensure that the light source irradiates the lens surface at an inclined angle, and only scattered light or reflected light enters the camera lens, and the background is dark to highlight the microstructures on the lens surface; use a high-resolution camera to collect the lens surface images under bright-field illumination and dark-field illumination. The camera resolution is not less than 1920×1080 pixels. Set the exposure time of the bright-field image to be 1 / 100 second and the exposure time of the dark-field image to be 1 / 50 second. After the collection is completed, record the bright-field image brightness value and the dark-field image brightness value respectively; perform grayscale processing on the collected bright-field image and dark-field image, calculate the grayscale histograms of the bright-field image and the dark-field image, and statistically analyze the distribution range of the brightness values. According to the bright-field image brightness value and the dark-field image brightness value, calculate the surface reflectivity data; use image processing software to perform edge detection on the collected images, extract the edge information of the lens surface, and obtain the edge features by calculating the gradient direction and intensity of the edge; use a fitting algorithm to fit the edge information to obtain the curvature distribution of the lens surface, store the calculated curvature values as a numerical array, and record the curvature data of each detection point.

[0101] Preferably, step S16 includes the following:

[0102] Step S161: Select three measurement points on the optical lens to be measured. Denote the point located at the geometric center of the lens as the central measurement point; denote the point located within the range of 1 mm to 3 mm inside the lens edge as the edge measurement point; denote the point located at the middle position between the center and the edge of the lens, 5 mm to 10 mm away from the center, as the middle measurement point.

[0103] Step S162: Use a laser displacement sensor to measure the three measurement points three times, with an interval of 0.5 seconds to 1 second for each measurement. Record the curvature radius value of each measurement to obtain the curvature radius measurement value of the measurement points.

[0104] Step S163: Take the average value of the curvature radius measurement values of the measurement points to obtain the curvature radius value of the measurement points.

[0105] Step S164: According to the curvature radius value of the measurement points, and by using the least squares method to fit the overall curvature distribution of the surface of the optical lens to be measured, obtain the surface curvature data.

[0106] In the embodiment of the present invention, first, three representative measurement points are selected on the surface of the optical lens to be measured, namely the central measurement point, the edge measurement point, and the middle measurement point. Among them, the central measurement point is located at the geometric center of the lens, the edge measurement point is located within the range of 1 mm to 3 mm inside the lens edge, and the middle measurement point is located at the middle position between the center and the edge of the lens, 5 mm to 10 mm away from the center. Subsequently, a laser displacement sensor is used to accurately measure these three measurement points. The sensor measures the displacement or shape change of the object surface by emitting a laser beam and receiving the reflected light. To ensure the accuracy and reliability of the measurement, each measurement point is measured three times, and the interval between each measurement is controlled between 0.5 seconds and 1 second to avoid the influence of external interference on the measurement result. During the measurement process, the laser displacement sensor records the curvature radius value of each measurement, thereby obtaining the three curvature radius measurement values of each measurement point. Next, the three curvature radius measurement values of each measurement point are averaged. The specific operation is to add the three measurement values of each measurement point and then divide by 3, thereby obtaining the average curvature radius value of the measurement point. This process effectively reduces the measurement error and improves the stability of the measurement result. Finally, according to the average curvature radius value of the measurement points, the overall curvature distribution of the surface of the optical lens to be measured is fitted by using the least squares method. As a mathematical optimization method, the least squares method finds the best function match for the data by minimizing the sum of the squares of the errors. In this process, the coordinates of the measurement points and the corresponding average curvature radius values are used as input data. By calculating the parameters of the fitting curve, the overall curvature distribution of the surface of the optical lens is finally obtained, and the fitting result is stored as the surface curvature data, providing important data support for subsequent defect detection and analysis.

[0107] Preferably, step S2 includes the following:

[0108] Step S21: Determine the initial conditions of the illumination source according to the surface reflectivity data. If the surface reflectivity data is greater than 0.7, select a polarized light source and set the initial polarization angle to 45° ± 5°; if the surface reflectivity data is less than or equal to 0.7, select an annular uniform light source and set the initial brightness to 1200 ± 100 cd;

[0109] Step S22: Perform optical filtering on the initial conditions of the illumination source based on the surface curvature data. If the surface curvature radius is less than 10 mm, use a high-pass filter and set the cut-off frequency to 0.1 ± 0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, use a low-pass filter and set the cut-off frequency to 0.05 ± 0.005 mm;

[0110] Step S23: Irradiate the optical lens to be measured from multiple angles with the filtered light source and perform surface multi-modal imaging to obtain a surface multi-modal image.

[0111] In the embodiment of the present invention, first, the initial conditions of the illumination source are determined according to the surface reflectivity data. The specific operation is as follows: when the surface reflectivity data is greater than 0.7, select a polarized light source and accurately set the initial polarization angle to 45°, and control the allowable error range within ±5°; when the surface reflectivity data is less than or equal to 0.7, select an annular uniform light source and accurately set the initial brightness to 1200 cd, and control the allowable error range within ±100 cd. Subsequently, perform optical filtering on the determined initial conditions of the illumination source based on the surface curvature data. The specific operation is as follows: if the surface curvature radius is less than 10 mm, select a high-pass filter and accurately set the cut-off frequency to 0.1 mm, and control the allowable error range within ±0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, select a low-pass filter and accurately set the cut-off frequency to 0.05 mm, and control the allowable error range within ±0.005 mm. After completing the optical filtering process, use the processed light source to irradiate the optical lens to be measured from multiple angles. For this purpose, install the filtered light source on a light source bracket with adjustable angles, and perform multi-angle irradiation according to a preset angle range (such as 0° to 90°) and angle interval (such as 10°). At each irradiation angle, keep the brightness and polarization angle (or uniformity) of the light source unchanged, and irradiate the optical lens in turn. At the same time, use a high-resolution industrial camera to collect images of the lens surface under different angle irradiations. The collected images include bright-field images and dark-field images. The bright-field images are used to observe the overall situation of the lens surface, and the dark-field images are used to highlight the tiny defects on the lens surface. After the collection is completed, preprocess these images, including operations such as denoising and contrast enhancement. The denoising operation can use the Gaussian filtering method, and the contrast enhancement can use the histogram equalization or adaptive contrast enhancement method. Finally, obtain a surface multi-modal image, providing a high-quality image basis for subsequent defect detection.

[0112] Preferably, step S23 includes the following:

[0113] Step S231: Install the filtered light source on a light source bracket with an adjustable angle, and set the irradiation angle range of the filtered light source to be 0° to 60° to obtain light source irradiation angle data. The specific irradiation angles are set to 0°, 30°, and 60°, and the irradiation time for each irradiation angle is 2 seconds, 3 seconds, 4 seconds, and 5 seconds respectively.

[0114] Step S232: Determine the imaging conditions on the lens surface according to the light source irradiation angle data, and determine the surface imaging mode for the imaging conditions on the lens surface to obtain the lens surface imaging mode, where the lens surface imaging mode includes bright field imaging mode, dark field imaging mode, and polarization imaging mode.

[0115] Step S233: Perform multimodal imaging on the optical lens to be measured based on the lens surface imaging mode to generate lens multimodal imaging data; perform image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.

[0116] In the embodiment of the present invention, first, the filtered light source is installed on a light source bracket with an adjustable angle, and the bracket can precisely control the irradiation angle of the light source. The irradiation angle range of the light source is set to be 0° to 60°, and 0°, 30°, and 60° are selected as the specific irradiation angles within this range. For each irradiation angle, the irradiation time is set to 2 seconds, 3 seconds, 4 seconds, and 5 seconds respectively, and the irradiation operations are performed in sequence, and the angle and time information at each irradiation are recorded to form light source irradiation angle data. Subsequently, according to the recorded light source irradiation angle data, the imaging conditions on the lens surface under different angle irradiations are analyzed. Based on these conditions, the imaging mode of the lens surface is determined, and the imaging mode includes bright field imaging mode, dark field imaging mode, and polarization imaging mode. The bright field imaging mode is suitable for observing the overall situation of the lens surface; the dark field imaging mode can highlight the minute defects on the lens surface; the polarization imaging mode further enhances the contrast between the defects and the background through a specific polarization angle. After determining the imaging mode of the lens surface, a high-resolution industrial camera is used to perform multimodal imaging on the optical lens to be measured. At each set irradiation angle, bright field, dark field, and polarization imaging modes are sequentially used for imaging, and the corresponding image data are respectively collected, so as to generate lens multimodal imaging data containing various imaging information. After the collection is completed, image format conversion is performed on the lens multimodal imaging data. The specific operation is to convert the collected image data from the original format to a unified image format, for example, convert a color image to a grayscale image for subsequent image processing and analysis. Through this series of technical operations, a surface multimodal image is finally obtained.

[0117] Preferably, step S233 includes the following:

[0118] Step S2331: Irradiate the imaging platform of the optical lens with the filtered light source at an angle of 0° according to the bright-field imaging mode.

[0119] Step S2332: Use a high-resolution camera to acquire a bright-field image. Set the resolution of the camera to be not less than 2048×2048 pixels, the exposure time to 1 / 125 second, and the ISO to 100 - 200, and record the bright-field image of the optical lens.

[0120] Step S2333: Irradiate the imaging platform of the optical lens with the filtered light source at an angle of 30° according to the dark-field imaging mode.

[0121] Step S2334: Use a high-resolution camera to acquire a dark-field image. Set the resolution of the camera to be not less than 1080×1080 pixels, the exposure time to 1 / 100 second, and the ISO to 200 - 300, and record the dark-field image of the optical lens.

[0122] Step S2335: Irradiate the imaging platform of the optical lens with the filtered light source at an angle of 60° according to the polarization imaging mode.

[0123] Step S2336: Use a high-resolution camera to acquire a polarization image. Set the resolution of the camera to be not less than 720×720 pixels, the exposure time to 1 / 60 second, and the ISO to 300 - 400, and record the polarization image of the optical lens.

[0124] Step S2337: Perform multi-modal image marking on the bright-field image, dark-field image, and polarization image of the optical lens to generate lens multi-modal imaging data.

[0125] Step S2338: Convert the image format of the lens multi-modal imaging data to obtain the surface multi-modal image.

[0126] In the embodiments of the present invention, according to the requirements of the bright-field imaging mode, the filtered light source is adjusted to an angle of 0°, so that it accurately irradiates the center position of the imaging platform of the optical lens. Subsequently, a high-resolution camera is used to collect bright-field images, ensuring that the resolution setting of the camera is not lower than 2048×2048 pixels, the exposure time is accurately set to 1 / 125 seconds, and the ISO value is set between 100 and 200 to ensure moderate clarity and brightness of the images, and the bright-field image data of the optical lens is recorded. Then, according to the requirements of the dark-field imaging mode, the filtered light source is adjusted to an angle of 30°, and it also irradiates the imaging platform of the optical lens. A high-resolution camera is used to collect dark-field images. At this time, the resolution setting of the camera is not lower than 1080×1080 pixels, the exposure time is adjusted to 1 / 100 seconds, and the ISO value is set between 200 and 300 to highlight the minute defects and details on the lens surface, and the dark-field image data of the optical lens is recorded; according to the requirements of the polarization imaging mode, the filtered light source is adjusted to an angle of 60°, irradiates the imaging platform of the optical lens, and a high-resolution camera is used to collect polarization images. The resolution setting of the camera is not lower than 720×720 pixels, the exposure time is set to 1 / 60 seconds, and the ISO value is set between 300 and 400 to enhance the contrast between the defects and the background in the images, and the polarization image data of the optical lens is recorded. After completing the image acquisition of the above three imaging modes, multi-modal image marking is performed on the collected bright-field images, dark-field images, and polarization images of the optical lens. Through image processing software, corresponding imaging mode marks and relevant parameter information, such as irradiation angle, camera resolution, exposure time, and ISO value, are added to each image to generate lens multi-modal imaging data containing complete information; finally, image format conversion is performed on the lens multi-modal imaging data; using an image format conversion tool, the collected image data is uniformly converted from the original format to a standard image format, such as grayscale image format or JPEG format.

[0127] As an example of the present invention, refer to Figure 2 shown, in this example, step S3 includes:

[0128] Step S31: Identify image feature matching points for the surface multi-modal image to obtain image feature matching points; perform multi-modal image stitching and matching on the surface multi-modal image according to the image feature matching points, and set the overlapping area to 20%-30% of the image width to generate an initial stitched image;

[0129] Step S32: Crop the stitching edges of the initial stitched image and perform image alignment to obtain a panoramic image of the optical lens;

[0130] Step S33: Convert the panoramic image of the optical lens into a grayscale image to obtain the grayscale image of the optical lens; count the grayscale value pixels of the grayscale image of the optical lens, and perform cumulative distribution calculation on the grayscale value pixels to generate a histogram equalization image;

[0131] Step S34: Enhance the contrast of the histogram equalization image and adjust the grayscale range to [50, 200] to obtain a contrast-enhanced image;

[0132] Step S35: Sharpen the edges of the contrast-enhanced image to obtain a panoramic enhanced image of the lens.

[0133] In the embodiment of the present invention, image feature matching points of the surface multimodal image are recognized. The ORB algorithm is used for feature point detection, and the maximum number of feature points is set to 1000 to ensure that enough feature points can be detected for subsequent image stitching. By calculating the descriptors of the feature points, the FLANN matcher is used to match the feature points, and high-quality matching points are screened out, thereby obtaining image feature matching points. According to the image feature matching points, multimodal image stitching matching of the surface multimodal image is performed. During the stitching process, the overlapping area is set to 20%-30% of the image width to ensure smooth transition and accuracy of the stitched image. By calculating the geometric transformation relationship between the feature points, such as the homography matrix, multiple images are stitched into an initial stitched image. The stitched edges of the initial stitched image are cropped to remove the redundant edge parts generated during the stitching process. At the same time, feature point-based image alignment technology is adopted to ensure the precise alignment of the stitched image, thereby obtaining the panoramic image of the optical lens. Then, the panoramic image of the optical lens is converted into a grayscale image, and by counting the grayscale value pixels and performing cumulative distribution calculation, a histogram equalization image is generated. This process enhances the contrast and details of the image by adjusting the grayscale distribution of the image. The histogram equalization image is enhanced in contrast, and the grayscale range is adjusted to [50, 200]. Through linear transformation or other contrast enhancement algorithms, the visual effect of the image and the adaptability of subsequent processing are improved. Finally, the edges of the contrast-enhanced image are sharpened, and algorithms such as Laplacian sharpening or USM sharpening are used to enhance the clarity and sharpness of the image edges, thereby obtaining a panoramic enhanced image of the lens, providing a high-quality image basis for subsequent defect detection.

[0134] Particularly important, step S34 includes the following steps:

[0135] Step S341: Traverse each pixel point in the image, record the grayscale values of all pixel points; extract the minimum value and the maximum value from the grayscale values of all pixel points, and record them as the current minimum grayscale value and the current maximum grayscale value respectively;

[0136] Step S342: Set the target grayscale maximum value to 200 and the target grayscale minimum value to 50;

[0137] Step S343: Use the difference between the maximum target gray value and the minimum target gray value as the numerator, and the difference between the current maximum gray value and the current minimum gray value as the denominator. Calculate the ratio of the numerator to the denominator to obtain the gray linear stretching coefficient; determine the gray offset based on the gray linear stretching coefficient multiplication.

[0138] Step S344: Enhance the contrast of the histogram equalized image according to the gray linear stretching coefficient and the gray offset, and divide the histogram equalized image into multiple local regions, each region having a size of 8×8 pixels.

[0139] Step S345: Adjust the gray value range of each local region to [50, 200] to obtain the contrast enhanced image.

[0140] In the embodiment of the present invention, the gray value of the histogram equalized image is analyzed. The specific operation is as follows: Traverse each pixel point in the image pixel by pixel and record the gray values of all pixel points. Through statistical analysis, extract the minimum and maximum values of the gray values of all pixel points, and record them as the current minimum gray value and the current maximum gray value respectively. Subsequently, set the maximum target gray value to 200 and the minimum target gray value to 50. Calculate the difference between the maximum target gray value and the minimum target gray value as the numerator, and the difference between the current maximum gray value and the current minimum gray value as the denominator. Calculate the ratio of the numerator to the denominator to obtain the gray linear stretching coefficient. Based on the gray linear stretching coefficient, further determine the gray offset. According to the gray linear stretching coefficient and the gray offset, enhance the contrast of the histogram equalized image. During this process, divide the histogram equalized image into multiple local regions, each region having a size of 8×8 pixels. Adjust the gray value of each local region so that its gray value range reaches [50, 200], and finally obtain the contrast enhanced image.

[0141] Particularly important, step S35 includes the following steps:

[0142] Step S351: Perform edge detection on the image through a 3×3 Laplacian operator. For each pixel point, calculate the gray difference between it and the surrounding pixels to obtain local region data.

[0143] Step S352: Select a local region data as the processing unit and calculate the average gray value of the region; perform adaptive threshold segmentation on the contrast enhanced image according to the average gray value of the region and segment out the edge information of the image defect.

[0144] Step S353: Perform opening and closing operations through a 3×3 structural element and remove the noise of the edge information of the image defect to obtain the edge noise removed image.

[0145] Step S354: Perform high-frequency feature enhancement on the edge noise-removed image through a high-pass filter to obtain a panoramic lens enhancement image.

[0146] In the embodiment of the present invention, for each pixel point in the image, calculate the gray difference between it and the surrounding pixels. The specific steps are as follows: Convolve the kernel matrix of the Laplacian operator with the corresponding pixel region in the image to obtain the Laplacian response value of the pixel point. In this way, the local region data of each pixel point in the image is obtained, and these data reflect the severity of the gray change in the image, thereby realizing edge detection. Subsequently, select a local region data as the processing unit and calculate the average gray value of this region. The specific operation is as follows: Select a local region in the image (for example, a region of 8×8 pixels), calculate the average value of the gray values of all pixel points in this region to obtain the regional average gray value. According to the calculated regional average gray value, perform adaptive threshold segmentation on the contrast-enhanced image. The specific steps are as follows: For each pixel point in the image, dynamically adjust the threshold according to the average gray value of its local region. If the gray value of the pixel point is higher than the average gray value of this local region plus a preset threshold offset (for example, 10), then divide this pixel point into edge pixels; otherwise, divide it into non-edge pixels. In this way, the edge information of the image defect is segmented. Next, perform opening and closing operations through a 3×3 structuring element to remove the noise in the edge information of the image defect. The specific operation is as follows: First, perform the opening operation, that is, erode first and then dilate. The erosion operation scans the image with a 3×3 structuring element and replaces the gray values of the pixel points within the covered area of the structuring element with the minimum value within this area; the dilation operation replaces the gray values of the pixel points within the covered area of the structuring element with the maximum value within this area. The opening operation removes small noise points and broken connections. Subsequently, perform the closing operation, that is, dilate first and then erode. The closing operation fills small holes and cracks. Through the combination of opening and closing operations, the noise in the edge information of the image defect is effectively removed to obtain an edge noise-removed image. Finally, perform high-frequency feature enhancement on the edge noise-removed image through a high-pass filter. The specific operation is as follows: Perform convolution operation on the image. For each pixel point in the image, calculate the gray difference between it and the surrounding pixels and add the difference to the original pixel value, thereby enhancing the high-frequency components in the image, such as edges and details. In this way, a panoramic lens enhancement image is obtained, which has clearer edges and more prominent details, providing a high-quality image basis for subsequent defect detection.

[0147] As an example of the present invention, refer to Figure 3 As shown, in this example, step S4 includes:

[0148] Step S41: Perform mirror edge defect detection on the panoramic lens enhancement image with the threshold set to 50 - 150, and extract the mirror edge defect image;

[0149] Step S42: Search for the contour on the mirror edge defect image. Starting from the upper left corner of the image, scan the image pixel by pixel to find edge points. When an edge point is found, trace along the edge until returning to the starting point. Repeat this operation for all edge points in the image to extract the mirror defect contour data;

[0150] Step S43: Measure the perimeter and area of the mirror defect contour data, and determine the aspect ratio of the mirror defect contour based on the perimeter and area of the defect contour;

[0151] Step S44: Combine the perimeter of the defect contour, the area of the defect contour, and the aspect ratio of the mirror defect contour to obtain the mirror defect contour parameters;

[0152] Step S45: Judge the defect type for the mirror defect contour parameters to obtain the mirror defect type data; evaluate the severity of the mirror defect type data to generate a defect severity evaluation report.

[0153] In the embodiment of the present invention, for the mirror edge defect detection of the lens panoramic enhancement image, the specific operation is as follows: Convert the image into a grayscale image, and then perform binarization processing using a threshold range of 50 - 150. Pixel points with a grayscale value higher than 150 are marked as defect areas, and pixel points with a grayscale value lower than 50 are marked as non-defect areas, thereby extracting the mirror edge defect image. Subsequently, search for the contour on the mirror edge defect image. Starting from the upper left corner of the image, scan the image pixel by pixel to find edge points. When an edge point is found, trace along the edge until returning to the starting point to form a closed contour. Repeat this operation for all edge points in the image to extract the mirror defect contour data. Next, measure the perimeter and area of the mirror defect contour data. Use the relevant functions in the image processing software to calculate the perimeter and area of each contour. At the same time, determine the aspect ratio of the mirror defect contour based on the perimeter and area of the defect contour. The specific calculation method is: aspect ratio = maximum width of the contour / maximum height of the contour. Combine the perimeter of the defect contour, the area of the defect contour, and the aspect ratio of the mirror defect contour to obtain the mirror defect contour parameters. These parameters will be used as the basic data for subsequent defect type judgment. Finally, judge the defect type for the mirror defect contour parameters to obtain the mirror defect type data. According to the preset defect type criteria (such as features like aspect ratio, area, etc.), classify the defects into types such as scratches, dot defects, and broken edges. Evaluate the severity of the mirror defect type data to generate a defect severity evaluation report. The evaluation report details the location, type, severity of each defect, and the corresponding image area, providing a basis for subsequent repair and quality control.

[0154] Particularly importantly, step S42 includes the following steps:

[0155] Step S421: On the mirror edge defect image, starting from the top-left pixel of the image, scan the image pixel by pixel to find edge points whose gray value change exceeds a preset threshold.

[0156] Step S422: When an edge point is found, record the coordinate position of the edge point and mark it as visited; check the gray value changes of the 8 adjacent pixels around the current edge point, and select the adjacent pixel with the largest gray value change as the next edge point; if there is no pixel among the 8 adjacent pixels around whose gray value change exceeds the preset threshold, it is considered that the current edge tracing ends.

[0157] Step S423: Connect the traced edge points in sequence to form a closed contour line. If the starting point is reached during the tracing process, it is considered that a complete defect contour is formed.

[0158] Step S424: Repeat steps S421 to S423 for all unvisited pixels in the image until all edge points in the image have been visited, thereby extracting all contour data of the mirror defect.

[0159] Step S425: Store the extracted mirror defect contour data in a structured data format.

[0160] In the embodiment of the present invention, starting from the top-left pixel of the mirror edge defect image, the image is scanned pixel by pixel to find edge points whose gray value change exceeds a preset threshold. The preset threshold is adjusted according to the gray distribution of the image and is usually set to a fixed value, such as 10. When an edge point is found, record the coordinate position of the edge point and mark it as visited; check the gray value changes of the 8 adjacent pixels around the current edge point, and select the adjacent pixel with the largest gray value change as the next edge point. If there is no pixel among the 8 adjacent pixels around whose gray value change exceeds the preset threshold, it is considered that the current edge tracing ends. Connect the traced edge points in sequence to form a closed contour line. If the starting point is reached during the tracing process, it is considered that a complete defect contour is formed; repeat the above operations for all unvisited pixels in the image until all edge points in the image have been visited, thereby extracting all contour data of the mirror defect; store the extracted mirror defect contour data in a structured data format. The specific operation is as follows: Store information such as the coordinate points, contour length, and contour area of each contour in a data structure, such as a list or an array. The data structure of each contour contains all pixel point coordinates of the contour, the perimeter of the contour, the area of the contour, and the aspect ratio of the contour, etc.

[0161] Preferably, step S45 includes the following:

[0162] Step S451: Determine the defect type based on the mirror defect contour parameters. If the defect contour area is less than 100 square pixels and the aspect ratio of the mirror defect contour is greater than 5, it is judged as a mirror scratch; if the defect contour area is greater than 100 square pixels and less than 500 square pixels, and the aspect ratio of the mirror defect contour is less than 2, it is judged as a mirror stain; if the defect contour area is greater than 500 square pixels and the aspect ratio of the mirror defect contour is less than 1.5, it is judged as a mirror edge break; if the defect contour area is less than 200 square pixels and the aspect ratio of the mirror defect contour is greater than 2 and less than 5, it is judged as a mirror film peeling.

[0163] Step S452: Combine the defect types of mirror scratches, mirror stains, mirror edge breaks, and mirror film peeling, and record the defect parameter quantities to obtain the mirror defect type data.

[0164] Step S453: Evaluate the severity of the mirror defect type data. If the length of the mirror scratch is less than 5 mm, the area of the mirror stain is less than 1 square mm, the length of the mirror edge break is less than 2 mm, and the area of the mirror film peeling is less than 0.5 square mm, it is judged as a minor mirror defect.

[0165] Step S454: If the length of the mirror scratch is between 5 and 10 mm, the area of the mirror stain is between 1 and 5 square mm, the length of the mirror edge break is between 2 and 5 mm, and the area of the mirror film peeling is between 0.5 and 2 square mm, it is judged as a medium mirror defect.

[0166] Step S455: If the length of the mirror scratch is greater than 10 mm, the area of the mirror stain is greater than 5 square mm, the length of the mirror edge break is greater than 5 mm, and the area of the mirror film peeling is greater than 2 square mm, it is judged as a severe mirror defect.

[0167] Step S456: Record the severity of the minor mirror defect, medium mirror defect, and severe mirror defect to generate a defect severity evaluation report.

[0168] In the embodiments of the present invention, the defect type is determined according to the mirror defect contour parameters. The specific operation is as follows: If the defect contour area is less than 100 square pixels and the aspect ratio of the mirror defect contour is greater than 5, it is determined as a mirror scratch; if the defect contour area is greater than 100 square pixels and less than 500 square pixels and the aspect ratio of the mirror defect contour is less than 2, it is determined as a mirror stain; if the defect contour area is greater than 500 square pixels and the aspect ratio of the mirror defect contour is less than 1.5, it is determined as a mirror edge break; if the defect contour area is less than 200 square pixels and the aspect ratio of the mirror defect contour is greater than 2 and less than 5, it is determined as a mirror film peeling. Subsequently, the mirror scratches, mirror stains, mirror edge breaks, and mirror film peelings are combined in terms of defect types, and the defect parameter quantities are recorded to obtain the mirror defect type data. The specific operation is as follows: The relevant parameters (such as contour area, aspect ratio, etc.) of the above four defect types are classified and summarized to form a complete mirror defect type data table. Next, the severity of the mirror defect type data is evaluated. The specific operation is as follows: If the length of the mirror scratch is less than 5 mm, the area of the mirror stain is less than 1 square mm, the length of the mirror edge break is less than 2 mm, and the area of the mirror film peeling is less than 0.5 square mm, it is determined as a minor mirror defect; if the length of the mirror scratch is between 5 and 10 mm, the area of the mirror stain is between 1 and 5 square mm, the length of the mirror edge break is between 2 and 5 mm, and the area of the mirror film peeling is between 0.5 and 2 square mm, it is determined as a medium mirror defect; if the length of the mirror scratch is greater than 10 mm, the area of the mirror stain is greater than 5 square mm, the length of the mirror edge break is greater than 5 mm, and the area of the mirror film peeling is greater than 2 square mm, it is determined as a severe mirror defect. Finally, the minor mirror defects, medium mirror defects, and severe mirror defects are recorded in terms of the defect severity to generate a defect severity evaluation report. The specific operation is as follows: The defects of different severities are respectively recorded in the evaluation report.

[0169] In this specification, an optical lens surface defect detection system based on image processing is provided for performing the above-mentioned optical lens surface defect detection method based on image processing. The optical lens surface defect detection system based on image processing includes:

[0170] An optical lens feature acquisition module, which is used to obtain the optical lens to be measured; perform surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; perform surface curvature identification on the optical lens to be measured to obtain surface curvature data;

[0171] A lens multi-modal imaging module, which is used to determine the initial conditions of the illumination light source according to the surface reflectivity data, perform optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; irradiate the optical lens to be measured from multiple angles with the filtered light source and perform surface multi-modal imaging to obtain a surface multi-modal image;

[0172] A panoramic image enhancement module for the lens, which is used to splice surface multi-modal images to generate an optical lens panoramic image; perform image enhancement on the optical lens panoramic image to obtain a panoramic enhanced image of the lens;

[0173] A lens defect detection and evaluation module, which is used to identify the contour of mirror defects in the panoramic enhanced image of the lens, measure the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; judge the defect type based on the mirror defect contour parameters to obtain the mirror defect type data; evaluate the severity of the mirror defect type data to generate a defect severity evaluation report.

[0174] Therefore, from any perspective, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the application document are intended to be included in the present invention.

[0175] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features invented herein.

Claims

1. An optical lens surface defect detection method based on image processing, characterized in that, It includes the following steps: Step S1: Obtain the optical lens to be measured; Perform surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; Perform surface curvature identification on the optical lens to be measured to obtain surface curvature data; Step S2: Determine the initial conditions of the illumination source according to the surface reflectivity data, and perform optical filtering processing on the initial conditions of the illumination source based on the surface curvature data to generate a filtered illumination source; Irradiate the optical lens to be measured with the filtered illumination source at multiple angles and perform surface multimodal imaging to obtain a surface multimodal image; Step S2 includes the following steps: Step S21: Determine the initial conditions of the illumination source according to the surface reflectivity data. If the surface reflectivity data is greater than 0.7, select a polarized light source and set the initial polarization angle to 45°±5°; if the surface reflectivity data is less than or equal to 0.7, select an annular uniform light source and set the initial brightness to 1200±100 cd; Step S22: Perform optical filtering processing on the initial conditions of the illumination source based on the surface curvature data. If the surface curvature radius is less than 10 mm, use a high-pass filter and set the cut-off frequency to 0.1±0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, use a low-pass filter and set the cut-off frequency to 0.05±0.005 mm; Step S23: Irradiate the optical lens to be measured with the filtered illumination source at multiple angles and perform surface multimodal imaging to obtain a surface multimodal image; Step S23 includes the following steps: Step S231: Install the filtered illumination source on a light source bracket with adjustable angle, and set the irradiation angle range of the filtered illumination source to 0° to 60° to obtain light source irradiation angle data. The specific irradiation angles are set to 0°, 30°, and 60°, and the irradiation time for each irradiation angle is 2 s, 3 s, 4 s, and 5 s respectively; Step S232: Judge the imaging conditions on the lens surface according to the light source irradiation angle data, and determine the surface imaging mode for the imaging conditions on the lens surface to obtain the lens surface imaging mode, where the lens surface imaging mode includes bright-field imaging mode, dark-field imaging mode, and polarized imaging mode; Step S233: Perform multimodal imaging on the optical lens to be measured based on the lens surface imaging mode to generate lens multimodal imaging data; perform image format conversion on the lens multimodal imaging data to obtain a surface multimodal image; Step S3: Stitch the surface multimodal images to generate a panoramic image of the optical lens; perform image enhancement on the panoramic image of the optical lens to obtain a panoramic enhanced image of the lens; Step S4: Identify the contour of the mirror defect on the panoramic enhanced image of the lens, measure the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; judge the defect type for the mirror defect contour parameters to obtain the mirror defect type data; evaluate the severity of the defect for the mirror defect type data to generate a defect severity evaluation report.

2. The method for detecting surface defects of an optical lens based on image processing according to claim 1, wherein, Step S1 includes the following steps: Step S11: Obtain the optical lens to be measured; Step S12: Illuminate the optical lens to be measured with a point light source. Place the point light source 30 - 50 cm above the lens to obtain bright-field illumination. Step S13: Illuminate the optical lens to be measured with an annular light source. Place the annular light source 20 - 30 cm below the lens to obtain dark-field illumination. Step S14: Collect the lens surface images under bright-field illumination and dark-field illumination respectively. Set the resolution of the running camera to be not less than 1920×1080 pixels, the exposure time of the bright-field image to be 1 / 100 second, and the exposure time of the dark-field image to be 1 / 50 second to obtain the bright-field image brightness value and the dark-field image brightness value. Step S15: Calculate the surface reflectivity of the lens based on the bright-field image brightness value and the dark-field image brightness value to obtain surface reflectivity data. Step S16: Identify the surface curvature of the optical lens to be measured to obtain surface curvature data.

3. The method for detecting surface defects of an optical lens based on image processing according to claim 2, wherein Step S16 includes the following steps: Step S161: Select three measurement points on the optical lens to be measured. The one located at the geometric center of the lens is denoted as the central measurement point; the one located within the range of 1 - 3 mm inside the lens edge is denoted as the edge measurement point; the one located at the middle position between the center and the edge of the lens, 5 - 10 mm away from the center, is denoted as the middle measurement point. Step S162: Use a laser displacement sensor to measure the three measurement points three times, with an interval of 0.5 - 1 second for each measurement, and record the curvature radius value of each measurement to obtain the measurement point curvature radius measurement value. Step S163: Take the average value of the measurement point curvature radius measurement values to obtain the measurement point curvature radius value. Step S164: Based on the measurement point curvature radius value, and through the least squares method, fit the overall curvature distribution of the surface of the optical lens to be measured to obtain surface curvature data.

4. The method for detecting surface defects of an optical lens based on image processing according to claim 1, wherein Step S233 includes the following steps: Step S2331: According to the bright-field imaging mode, irradiate the optical lens imaging platform with the filtered light source at an angle of 0°. Step S2332: Use a high-resolution camera to collect the bright-field image. Set the resolution of the camera to be not less than 2048×2048 pixels, the exposure time to be 1 / 125 second, and the ISO to be set to 100 - 200, and record the bright-field image of the optical lens. Step S2333: According to the dark-field imaging mode, irradiate the optical lens imaging platform with the filtered light source at an angle of 30°. Step S2334: Use a high-resolution camera to collect the dark-field image. Set the resolution of the camera to be not less than 1080×1080 pixels, the exposure time to be 1 / 100 second, and the ISO to be set to 200 - 300, and record the dark-field image of the optical lens. Step S2335: According to the polarization imaging mode, irradiate the optical lens imaging platform with the filtered light source at an angle of 60°. Step S2336: Use a high-resolution camera to collect the polarization image. Set the resolution of the camera to be not less than 720×720 pixels, the exposure time to be 1 / 60 second, and the ISO to be set to 300 - 400, and record the polarization image of the optical lens. Step S2337: Perform multi-modal image marking on the bright-field image, dark-field image, and polarization image of the optical lens to generate lens multi-modal imaging data. Step S2338: Convert the image format of the lens multi-modal imaging data to obtain a surface multi-modal image.

5. The method for detecting surface defects of an optical lens based on image processing according to claim 4, wherein Step S3 includes the following steps: Step S31: Identify the image feature matching points of the surface multi-modal image to obtain the image feature matching points; perform multi-modal image stitching and matching on the surface multi-modal image according to the image feature matching points, and set the overlapping area to 20%-30% of the image width to generate an initial stitched image; Step S32: Crop the stitching edge of the initial stitched image and perform image alignment to obtain an optical lens panoramic image; Step S33: Convert the optical lens panoramic image to a grayscale image to obtain an optical lens grayscale image; count the grayscale value pixels of the optical lens grayscale image, and perform cumulative distribution calculation on the grayscale value pixels to generate a histogram equalization image; Step S34: Enhance the contrast of the histogram equalization image and adjust the grayscale range to [50, 200] to obtain a contrast-enhanced image; Step S35: Sharpen the edges of the contrast-enhanced image to obtain a panoramic enhanced image of the lens.

6. The method for detecting surface defects of an optical lens based on image processing according to claim 1, characterized in that, Step S4 includes the following steps: Step S41: Detect the mirror edge defects of the panoramic enhanced image of the lens, set the threshold to 50-150, and extract the mirror edge defect image; Step S42: Find the contours on the mirror edge defect image, start from the upper left corner of the image, scan the image pixel by pixel to find the edge points; when an edge point is found, trace along the edge until returning to the starting point; repeat this operation for all edge points in the image to extract the mirror defect contour data; Step S43: Measure the perimeter and area of the mirror defect contour data, and determine the aspect ratio of the mirror defect contour based on the perimeter and area of the mirror defect contour; Step S44: Combine the perimeter of the defect contour, the area of the defect contour, and the aspect ratio of the mirror defect contour to obtain the mirror defect contour parameters; Step S45: Judge the defect type of the mirror defect contour parameters to obtain the mirror defect type data; evaluate the severity of the mirror defect type data to generate a defect severity evaluation report.

7. The method for detecting surface defects of an optical lens based on image processing according to claim 6, characterized in that, Step S45 includes the following steps: Step S451: Judge the defect type according to the mirror defect contour parameters. If the defect contour area is less than 100 square pixels and the aspect ratio of the mirror defect contour is greater than 5, it is judged as a mirror scratch; if the defect contour area is greater than 100 square pixels and less than 500 square pixels, and the aspect ratio of the mirror defect contour is less than 2, it is judged as a mirror stain; if the defect contour area is greater than 500 square pixels and the aspect ratio of the mirror defect contour is less than 1.5, it is judged as a mirror edge break; if the defect contour area is less than 200 square pixels and the aspect ratio of the mirror defect contour is greater than 2 and less than 5, it is judged as a mirror film peeling; Step S452: Combine the mirror scratches, mirror stains, mirror edge breaks, and mirror film peeling into defect types, and record the defect parameter quantity to obtain the mirror defect type data; Step S453: Evaluate the severity of the mirror surface defect types. If the length of the mirror surface scratch is less than 5 mm, the area of the mirror surface stain is less than 1 square millimeter, the length of the mirror surface edge break is less than 2 mm, and the area of the mirror surface film peeling is less than 0.5 square millimeter, then it is judged as a minor mirror surface defect; Step S454: If the length of the mirror surface scratch is between 5 and 10 mm, the area of the mirror surface stain is between 1 and 5 square millimeters, the length of the mirror surface edge break is between 2 and 5 mm, and the area of the mirror surface film peeling is between 0.5 and 2 square millimeters, then it is judged as a medium mirror surface defect; Step S455: If the length of the mirror surface scratch is greater than 10 mm, the area of the mirror surface stain is greater than 5 square millimeters, the length of the mirror surface edge break is greater than 5 mm, and the area of the mirror surface film peeling is greater than 2 square millimeters, then it is judged as a severe mirror surface defect; Step S456: Record the severity of the minor mirror surface defect, the medium mirror surface defect, and the severe mirror surface defect, and generate a defect severity evaluation report.

8. An optical lens surface defect detection system based on image processing, characterized in that, For implementing the optical lens surface defect detection method based on image processing as described in claim 1, the optical lens surface defect detection system based on image processing includes: An optical lens feature acquisition module, configured to obtain the optical lens to be measured; perform surface reflectivity detection on the optical lens to be measured to obtain surface reflectivity data; perform surface curvature recognition on the optical lens to be measured to obtain surface curvature data; A lens multi-modal imaging module, configured to determine the initial conditions of the illumination light source according to the surface reflectivity data, and perform optical filtering processing on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; irradiate the optical lens to be measured from multiple angles with the filtered light source, and perform surface multi-modal imaging to obtain a surface multi-modal image; A lens panoramic image enhancement module, configured to splice the surface multi-modal images to generate an optical lens panoramic image; perform image enhancement on the optical lens panoramic image to obtain a lens panoramic enhanced image; A lens defect detection and evaluation module, configured to identify the mirror surface defect contour of the lens panoramic enhanced image, measure the contour parameters of the mirror surface defect contour to obtain mirror surface defect contour parameters; judge the defect type based on the mirror surface defect contour parameters to obtain mirror surface defect type data; evaluate the severity of the mirror surface defect type data to generate a defect severity evaluation report.

Citation Information

Patent Citations

  • High-precision defect detection method and system for intelligent glasses

    CN118837379A

  • Method for optical visual examination of three-dimensional shape

    KR1020080061786A