Optical lens surface defect detection method and system based on image processing
Through surface reflectivity detection and curvature recognition, the physical characteristic data of the optical lens are obtained, the illumination light source is dynamically set and multi-angle irradiation and multi-modal imaging are performed, which solves the problem of low detection accuracy in the prior art and realizes high-precision defect detection.
Patent Information
- Application Number
- CN202510378344.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-28
AI Technical Summary
The existing optical lens surface defect detection technology is difficult to dynamically set the illumination light source according to the lens surface reflection characteristic properties and curvature, resulting in a low detection accuracy.
Through surface reflectivity detection and surface curvature recognition, the real physical characteristic data of the optical lens is obtained, the initial conditions of the illumination light source are determined, and optical filtering is carried out to generate a filtered light source, and multi-angle irradiation and multi-modal imaging are performed.
It improves the accuracy and sensitivity of surface defect detection of optical lenses, ensuring the accuracy and reliability of detection results.
Smart Images

Figure CN119880946A_ABST
Abstract
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 early days of optical lens production, surface defects were mainly identified by manual inspection. Inspectors used magnifying glasses, microscopes and other tools to observe the lens surface and detect scratches, cracks and stains. This method was simple and intuitive, but it was inefficient and led to missed detections. Therefore, researchers applied optical principle technology to optical lens inspection, such as using an interferometer to detect surface errors and defects on the surface of optical components. By analyzing the interference fringes of light waves, the tiny fluctuations and unevenness of the surface were measured to discover defects. However, existing optical lens surface defect detection technology fails to dynamically set the imaging illumination light source for the optical lens to be tested based on the reflective characteristic properties of the optical lens surface and the curvature of the lens surface, and it is difficult to perform multi-modal imaging based on the imaging illumination light source, resulting in unclear characteristics of the collected optical lens surface defects, which in turn makes the lens surface defect detection accuracy low. 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, a method for detecting surface defects of an optical lens based on image processing is provided, the method comprising the following steps: Step S1: obtaining an optical lens to be tested; performing surface reflectivity detection on the optical lens to be tested to obtain surface reflectivity data; performing surface curvature recognition on the optical lens to be tested to obtain surface curvature data; Step S2: determining the initial conditions of the illumination light source according to the surface reflectivity data, and performing optical filtering 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 tested with the filtered light source at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image; Step S3: stitching the surface multimodal images to generate an optical lens panoramic image; enhancing the optical lens panoramic image to obtain a lens panoramic enhanced image; Step S4: Identify the mirror defect contour on the lens panoramic enhanced image, and calculate the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; determine the defect type on the mirror defect contour parameters to obtain mirror defect type data; evaluate the defect severity on the mirror defect type data to generate a defect severity evaluation report.
[0005] The present invention simultaneously carries out surface reflectivity detection and surface curvature identification, and respectively accurately obtains surface reflectivity data and surface curvature data of the optical lens to be tested, thereby ensuring that subsequent processing can be carried out based on the real and comprehensive physical properties of the optical lens, and avoiding inaccurate detection due to missing or one-sided data; the accurate acquisition of surface reflectivity data and surface curvature data makes it possible to subsequently determine the initial conditions of the illumination light source and perform optical filtering processing and other operations according to the characteristics of the optical lens itself, thereby providing a scientific and reasonable basis for subsequent multi-angle illumination and surface multimodal imaging links. The initial conditions of the illumination light source are determined according to the surface reflectivity data, and then the initial conditions of the illumination light source are optically filtered based on the surface curvature data to generate a filtered light source, so that the illumination light source can accurately adapt to the surface characteristics of the optical lens to be tested; different optical lenses have different surface reflectivity and curvature due to factors such as materials and processes. The filtered light source generated in this way can effectively solve the problem that the traditional single light source is difficult to adapt to the surface characteristics of a variety of optical lenses, ensuring that the lens surface feature information can be better stimulated during the subsequent illumination process; the filtered light source is used to illuminate the optical lens to be tested at multiple angles, and surface multimodal imaging is performed to obtain a surface multimodal image; multi-angle illumination combined with multimodal imaging can capture rich detailed information on the surface of the optical lens from different viewing angles and multiple imaging modes. Compared with a single angle and a single imaging mode, it can more comprehensively display the microstructure and potential defect characteristics of the lens surface, providing a richer and more accurate image data basis for subsequent image processing and defect detection links, and improving the sensitivity and accuracy of defect detection. Image stitching of surface multimodal images can integrate local multimodal images into a complete panoramic image, effectively solving the problem that a single imaging is difficult to cover the entire surface when the optical lens surface is large; the generation of panoramic images enables subsequent overall analysis of the optical lens surface, avoiding inaccurate judgments on defect locations, distribution ranges and other information due to incomplete images, and provides a complete image basis for comprehensive evaluation of the surface condition of the optical lens; image enhancement of the panoramic image of the optical lens can improve the contrast, brightness and other visual effects of the panoramic image, highlight the key details and potential defect features in the image, and make 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 mirror defect contour recognition and other links, improves the accuracy and reliability of defect recognition, and ensures the accuracy of subsequent defect detection results.By identifying the mirror defect contour of the lens panoramic enhanced image and calculating the contour parameters of the mirror defect contour, the defect contour on the optical lens can be accurately identified, and the shape, size and other characteristics of the defect can be quantitatively described through contour parameter calculation; 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 is judged by the mirror defect contour parameters to obtain the mirror defect type data; the defect severity is assessed on the mirror defect type data, which can It can accurately determine the type of surface defects of the optical lens (such as scratches, spots and bubbles), and scientifically evaluate the severity of the defects based on comprehensive information such as the type of defects and profile parameters. The defect degree assessment report finally generated can provide a clear and reliable reference basis for the quality control, production improvement and subsequent usage decisions 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 reflective characteristic attributes and lens surface curvature of the optical lens surface, and determines the imaging illumination light source conditions to realize multi-modal imaging of the lens surface, thereby obtaining a panoramic enhanced image of the lens, and performing optical lens surface defect detection, thereby improving the detection accuracy of lens surface defects.
[0006] Preferably, step S1 includes the following: Step S11: obtaining an optical lens to be tested; Step S12: bright field illumination is performed on the optical lens to be tested by using a point light source, and the point light source is located 30-50 cm above the lens to obtain bright field illumination; Step S13: performing dark field illumination on the optical lens to be tested by using a ring light source, and placing the ring light source 20-30 cm below the lens to obtain dark field illumination; Step S14: respectively collecting lens surface images under bright field illumination and dark field illumination, and setting the resolution of the operating camera to be no less than 1920×1080 pixels, the exposure time of the bright field image to 1 / 100 second, and the exposure time of the dark field image to 1 / 50 second, so as to obtain the brightness value of the bright field image and the brightness value of the dark field image; Step S15: Calculate the lens surface reflectivity using the brightness value of the bright field image and the brightness value of the dark field image to obtain surface reflectivity data; Step S16: performing surface curvature recognition on the optical lens to be tested to obtain surface curvature data.
[0007] The present invention obtains the optical lens to be tested to ensure that the entire detection method can be operated on a specific optical lens, laying a foundation for the implementation of subsequent steps; by locating a point light source 30-50 cm above the lens for bright field illumination, it can provide uniform and stable lighting conditions for the surface of the optical lens, ensuring that the collected bright field image has good brightness uniformity, which is convenient for subsequent image processing and analysis; by locating a ring light source 20-30 cm below the lens for dark field illumination, it can effectively enhance the imaging effect of tiny defects and details on the lens surface, so that the dark field image can clearly reflect the microscopic features of the lens surface, providing key information for subsequent defect detection; the lens surface images under bright field illumination and dark field illumination are respectively collected, and the resolution of the operating camera is set to be not less than 1920×1080 pixels to ensure that the image has sufficient 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 adapt to the bright field and dark field lighting conditions respectively, avoid overexposure or underexposure, so as to obtain accurate bright field image brightness value and dark field image brightness value, and provide a reliable data basis for subsequent calculations; by calculating the lens surface reflectivity with the bright field image brightness value and the dark field image brightness value, the surface reflectivity data can be accurately obtained; this method of calculating the image brightness value based on two different lighting conditions can effectively reflect the reflective characteristics of the optical lens surface, and ensure that subsequent operations can be optimized according to the actual reflective characteristics of the lens; by identifying the surface curvature of the optical lens to be tested, the 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.
[0008] Preferably, step S16 includes the following: Step S161: Select three measuring points on the optical lens to be tested, and record the point located at the geometric center of the lens as the center measuring point; the point located within 1 mm to 3 mm inside the edge of the lens as the edge measuring point; and the point located between the center and the edge of the lens and 5 mm to 10 mm from the center as the middle measuring point; Step S162: Use a laser displacement sensor to measure three measuring points three times, each measuring interval is 0.5 seconds to 1 second, record the curvature radius value of each measurement, and obtain the curvature radius measurement value of the measuring point; Step S163: taking an average of the curvature radius measurement values of the measuring points to obtain the curvature radius value of the measuring points; Step S164: fitting the overall curvature distribution of the optical lens surface to be measured according to the curvature radius value of the measuring point by the least square method to obtain the surface curvature data.
[0009] The present invention can fully cover the key areas of the lens surface by selecting a central measurement point, an edge measurement point and an intermediate measurement point on the optical lens, thereby ensuring that the measurement points can reflect the curvature characteristics of the center, edge and intermediate areas of the lens; a laser displacement sensor is used to perform three measurements on the three measurement points, thereby ensuring the stability and reliability of the measurement results; each measurement interval is 0.5 seconds to 1 second, thereby avoiding instantaneous errors in the measurement process and improving the measurement accuracy; by recording the curvature radius value of each measurement, accurate original data is provided for subsequent calculations; averaging the curvature radius measurement values of the measurement points can effectively reduce measurement errors; through averaging processing, the curvature radius values of the measurement points obtained are more stable and accurate; according to the curvature radius values of the measurement points, the overall curvature distribution of the optical lens surface to be measured is fitted by the least squares method, thereby accurately reflecting the curvature change of the optical lens surface and providing accurate curvature data for subsequent defect detection and analysis.
[0010] Preferably, step S2 includes the following: Step S21: Determine the initial condition of the illumination light 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 a ring-shaped uniform light source and set the initial brightness to 1200±100cd; Step S22: performing optical filtering on the initial conditions of the illumination light source based on the surface curvature data. If the surface curvature radius is less than 10 mm, a high-pass filter is used, and the cutoff frequency is set to 0.1±0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, a low-pass filter is used, and the cutoff frequency is set to 0.05±0.005 mm; Step S23: irradiating the optical lens to be tested with the filtered light source at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image.
[0011] The present invention determines the initial conditions of the illumination light source according to the surface reflectivity data, and can select the appropriate light source type and parameters according to the actual reflectivity 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°, which effectively reduces the interference of the reflected light and enhances the imaging contrast; when the surface reflectivity data is less than or equal to 0.7, a ring-shaped uniform light source is selected and the initial brightness is set to 1200±100cd, providing stable lighting and ensuring the imaging quality; this light source selection method based on reflectivity data can provide the best lighting conditions for the subsequent imaging process and improve the accuracy of detection; optical filtering is performed on the initial conditions of the illumination light source based on the surface curvature data, and the spectrum characteristics of the light source can be adjusted 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 cutoff 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 cutoff frequency is set to 0.05±0.005 mm, which smoothes high-frequency noise and retains 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. The filtered light source is used to illuminate the optical lens to be tested at multiple angles, and surface multimodal imaging is performed to capture detailed information on the surface of the optical lens from multiple angles and in multiple imaging modes. Multi-angle illumination can fully cover the lens surface to avoid shadows or occlusions caused by single-angle illumination. Multimodal imaging can combine the advantages of multiple imaging technologies to provide richer image information.
[0012] Preferably, step S23 includes the following: Step S231: installing the filtered light source on an angle-adjustable light source bracket, and setting the irradiation angle range of the filtered light source to 0° to 60°, obtaining the irradiation angle data of the light source, wherein the specific irradiation angles are set to 0°, 30° and 60°, and the irradiation time of each irradiation angle is 2 seconds, 3 seconds, 4 seconds and 5 seconds respectively; Step S232: judging the imaging condition of the lens surface according to the light source illumination angle data, and performing surface imaging mode determination on the imaging condition of the lens surface to obtain the lens surface imaging mode, wherein the lens surface imaging mode includes a bright field imaging mode, a dark field imaging mode and a polarization imaging mode; Step S233: performing multimodal imaging on the optical lens to be tested based on the lens surface imaging mode to generate lens multimodal imaging data; performing image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.
[0013] The present invention installs a filtering processed light source on a light source bracket with an adjustable angle, and sets the illumination angle range to be 0° to 60°, specifically 0°, 30° and 60°, and the illumination time at each angle is 2 seconds, 3 seconds, 4 seconds and 5 seconds respectively, which can fully cover various areas of the optical lens surface and ensure that the lens surface is evenly illuminated from different directions; by accurately controlling the illumination angle and time, the shadow or reflection interference caused by single-angle illumination can be effectively avoided, and the imaging quality is improved; the imaging condition of the lens surface is judged according to the illumination angle data of the light source, and the imaging mode of the lens surface is determined, including the bright field imaging mode, the dark field imaging mode and the polarization imaging mode; the imaging mode selection based on the illumination angle can flexibly adjust the imaging mode 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 tiny defects and details, and the polarization imaging mode can effectively reduce the interference of reflected light. This comprehensive selection of imaging modes ensures that high-quality image data can be obtained under different lighting conditions, providing diversified imaging support for subsequent defect detection. Based on the lens surface imaging mode, multimodal imaging of the optical lens to be tested is performed to generate multimodal imaging data of the lens, and the imaging data is converted into an image format. The advantages of bright field, dark field and polarization imaging can be combined to capture detailed information on the lens surface from different angles and modes. Image format conversion ensures that data under different imaging modes can be processed uniformly, which can effectively improve the sensitivity and accuracy of defect detection and provide a high-quality image basis for the comprehensive evaluation of the surface quality of optical lenses.
[0014] Preferably, step S233 includes the following: 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 a bright field image, set the camera resolution to no less than 2048×2048 pixels, the exposure time to 1 / 125 second, the ISO to 100-200, and record the optical lens bright field image; 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 capture a dark field image, set the camera resolution to no less than 1080×1080 pixels, the exposure time to 1 / 100 second, the ISO to 200-300, and record the optical lens dark field image; 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 polarization images, set the camera resolution to no less than 720×720 pixels, the exposure time to 1 / 60 second, the ISO to 300-400, and record the optical lens polarization image; Step S2337: marking the optical lens bright field image, the optical lens dark field image and the optical lens polarization image as multimodal images to generate lens multimodal imaging data; Step S2338: performing image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.
[0015] According to the bright field imaging mode, the present invention irradiates the filtered processed light source at an angle of 0° onto the optical lens imaging platform, which can ensure that the light source directly irradiates the lens surface, provides uniform lighting conditions, effectively highlights the overall structure and macroscopic features of the lens surface, and provides an ideal lighting environment for subsequent bright field image acquisition, ensuring the brightness uniformity and detail clarity of the image; a high-resolution camera is used to acquire the bright field image, the camera resolution is set to be not less than 2048×2048 pixels, the exposure time is 1 / 125 second, and the ISO is set to 100-200, which can ensure that the acquired bright field image has high definition and low noise level. High resolution ensures the integrity of image details, while appropriate exposure time and ISO settings ensure image brightness and contrast, thereby providing high-quality bright field image data for subsequent image analysis; according to the dark field imaging mode, the filtered light source is irradiated at a 30° angle on the optical lens imaging platform, which can effectively highlight the tiny defects and details on the lens surface, enhance the imaging effect of the surface microstructure, and provide optimized lighting conditions for dark field image acquisition; dark field images are acquired using a high-resolution camera, with the camera resolution set to no less than 1080×1080 pixels, the exposure time set to 1 / 100 second, and the ISO set to 200-300, which can ensure that the acquired dark field images have sufficient details and appropriate brightness, effectively avoid image quality degradation caused by underexposure or overexposure, and ensure that the dark field image can clearly reflect the tiny defects and details on the lens surface; according to the polarization imaging mode, the filtered light source is irradiated at a 60° angle on the optical lens imaging platform, which can effectively reduce the interference of reflected light and enhance the image contrast. degree, so that polarized light can better interact with the lens surface, thereby highlighting the microstructure and defects of the surface, and providing optimized lighting conditions for polarization image acquisition; using a high-resolution camera to acquire polarization images, setting the camera resolution to no less than 720×720 pixels, the exposure time to 1 / 60 second, and the ISO to 300-400, can ensure that the acquired polarization images have sufficient details and appropriate brightness, can effectively avoid the degradation of image quality caused by reflected light interference, and ensure that the polarization image can clearly reflect the microstructure and defects on the lens surface; the optical lens bright field image, optical lens dark field image and optical lens polarization image are multi-modal image marked, and the image data under different imaging modes can be uniformly managed and marked, ensuring that the image data under different imaging modes can be accurately identified and processed, providing a comprehensive image basis for defect detection; the image format conversion of the lens multi-modal imaging data can unify the image data under different imaging modes into one format, which is convenient for subsequent image processing and analysis.
[0016] Preferably, step S3 includes the following: Step S31: performing image feature matching point recognition on the surface multimodal image to obtain image feature matching points; performing multimodal image stitching matching on the surface multimodal image according to the image feature matching points, and setting the overlapping area to 20%-30% of the image width to generate an initial stitched image; Step S32: cutting the stitching edges of the initial stitching image and aligning the images to obtain an optical lens panoramic image; Step S33: converting the optical lens panoramic image into a grayscale image to obtain an optical lens grayscale image; counting the grayscale value pixels of the optical lens grayscale image, and performing cumulative distribution calculation on the grayscale value pixels to generate a histogram equalization image; Step S34: performing contrast enhancement on the histogram equalization image and adjusting the grayscale range to [50, 200] to obtain a contrast enhanced image; Step S35: sharpening the image edges of the contrast-enhanced image to obtain a lens panoramic enhanced image.
[0017] The present invention identifies image feature matching points on surface multimodal images, can accurately locate key feature points in 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, thereby generating a high-quality initial stitched image; the initial stitched image is stitched edge cropped and image aligned, which can remove the redundant edge parts generated in the stitching process and ensure the overall consistency of the image after stitching; through the cropping and alignment operations, the optical lens panoramic image obtained has clear boundaries and accurate The geometric relationship between the two images can provide a complete image basis for subsequent image processing and defect detection; converting the panoramic image of the optical lens into a grayscale image can simplify the image data, reduce the interference of color information, and highlight the brightness characteristics of the image; counting the grayscale value pixels of the grayscale image and performing cumulative distribution calculation to generate a histogram equalization image can adjust the grayscale distribution of the image, enhance the contrast of the image, make the details in the image clearer and more visible, and provide an optimized data basis for subsequent image enhancement operations; performing contrast enhancement on the histogram equalization image and adjusting the grayscale range to [50,200] can further improve the visual effect of the image and make the dark and bright details in the image more obvious. Through contrast enhancement, the contrast-enhanced image obtained 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; sharpening the edge of the contrast-enhanced image can highlight the edge information in the image and enhance the detail expression of the image; through edge sharpening processing, the lens panoramic enhanced image obtained can more clearly show the tiny structure 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 identification and analysis.
[0018] Preferably, step S4 includes the following: Step S41: performing mirror edge defect detection on the lens panoramic enhanced image, setting the threshold to 50-150, and extracting the mirror edge defect image; Step S42: Find the contour on the mirror edge defect image, starting from the upper left corner of the image, scan the image pixel by pixel, and find the edge point; when an edge point is found, track 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: measuring the defect contour perimeter and defect contour area of the mirror surface defect contour data, and determining the mirror surface defect contour aspect ratio according to the defect contour perimeter and defect contour area; Step S44: combining the defect contour perimeter, the defect contour area and the mirror surface defect contour aspect ratio to obtain the mirror surface defect contour parameters; Step S45: Determine the defect type of the mirror defect profile parameters to obtain mirror defect type data; evaluate the defect severity of the mirror defect type data to generate a defect severity evaluation report.
[0019] The present invention performs mirror edge defect detection on the panoramic enhanced image of the lens, sets the threshold value to 50-150, can effectively distinguish the defect area from the normal area in the image, and ensure the accurate extraction of the defect area; by extracting the mirror edge defect image, a clear image basis is provided for the subsequent recognition and analysis of the defect contour, and the sensitivity and accuracy of defect detection are improved; the contour is searched on the mirror edge defect image, and the edge is scanned and tracked pixel by pixel starting from the upper left corner of the image, so that the contour data of the mirror defect can be fully and accurately extracted; this pixel-by-pixel scanning and edge tracking method can ensure that no edge point is missed, and the contour information of the defect is completely extracted, providing accurate data support for the subsequent defect feature measurement; the defect contour perimeter and defect contour area of the mirror defect contour data are measured, and the aspect ratio of the mirror defect contour is determined, so that the geometric characteristics of the defect can be fully quantified; through the measurement of these parameters, the shape of the defect can be accurately described. and size, providing an objective and quantitative basis for subsequent defect type judgment and severity assessment, thereby improving the scientificity and reliability of defect detection; the defect contour circumference, defect contour area and mirror defect contour aspect ratio are combined to obtain mirror defect contour parameters, which can integrate multiple geometric feature parameters into a complete data set; this integration method facilitates subsequent analysis and processing, ensures the comprehensiveness and consistency of defect characteristics, and provides comprehensive data support for defect type judgment and severity assessment; defect type judgment based on mirror defect contour parameters can accurately distinguish different types of defects, such as scratches, spots, bubbles, etc.; defect severity assessment is performed on mirror defect type data, and a defect severity assessment report is generated, which can scientifically assess the severity of defects based on the defect type and geometric characteristics, providing a clear reference basis for quality control and production improvement of optical lenses, and ensuring that the surface quality of optical lenses meets standard requirements.
[0020] Preferably, step S45 includes the following: Step S451: Determine the defect type according to the mirror defect profile parameters. If the defect profile area is less than 100 square pixels and the mirror defect profile aspect ratio is greater than 5, it is determined to be a mirror scratch; if the defect profile area is greater than 100 square pixels and less than 500 square pixels and the mirror defect profile aspect ratio is less than 2, it is determined to be a mirror stain; if the defect profile area is greater than 500 square pixels and the mirror defect profile aspect ratio is less than 1.5, it is determined to be a mirror edge break; if the defect profile area is less than 200 square pixels and the mirror defect profile aspect ratio is greater than 2 and less than 5, it is determined to be a mirror demolding; Step S452: merge the defect types of mirror scratches, mirror stains, mirror edge breakage and mirror film peeling, and record the defect parameter quantities to obtain mirror defect type data; Step S453: evaluating the severity of the mirror surface defect type data. If the mirror surface scratch length is less than 5 mm, the mirror surface stain area is less than 1 square millimeter, the mirror surface broken edge length is less than 2 mm, and the mirror surface demolding area is less than 0.5 square millimeter, it is judged as a minor mirror surface defect; 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 millimeters, the length of the mirror edge break is between 2 and 5 mm, and the mirror demolding area is between 0.5 and 2 square millimeters, it is determined to be a medium defect on the mirror; Step S455: If the length of the mirror scratch is greater than 10 mm, the mirror stain area is greater than 5 square millimeters, the length of the mirror edge break is greater than 5 mm, and the mirror demolding area is greater than 2 square millimeters, it is judged as a serious defect of the mirror; Step S456: Record the severity of minor mirror defects, medium mirror defects, and severe mirror defects, and generate a defect severity assessment report.
[0021] The present invention judges the defect type according to the mirror defect profile parameters, and can accurately distinguish different types of defects according to the quantitative standards of defect profile area and aspect ratio; by setting clear judgment conditions, such as the characteristic parameter range of scratches, stains, edge breakage and film peeling, the objectivity and consistency of defect classification are ensured, and an accurate type basis is provided for the subsequent defect severity evaluation; the defect types of mirror scratches, mirror stains, mirror edge breakage and mirror film peeling are merged, and the defect parameter quantities are recorded, so that the classified defect information can be systematically integrated; this merging and recording method facilitates statistical analysis of the number and characteristics of different types of defects, generates complete mirror defect type data, and provides comprehensive defect information for subsequent quality evaluation and production improvement; the defect severity is evaluated on the mirror defect type data, and by setting clear size and area thresholds, slight mirror defects can be accurately judged; this method based on quantitative standards The accurate evaluation method can ensure the high accuracy and consistency of the identification of minor defects, providing a scientific basis for subsequent quality grading and processing; by setting clear size and area thresholds, it can accurately judge the medium defects of the mirror surface, ensuring the high accuracy and consistency of the identification of medium defects, providing a scientific basis for subsequent quality grading and processing, and ensuring that the quality control of optical lenses meets the standard requirements; by setting clear size and area thresholds, it can accurately judge the serious defects of the mirror surface. This quantitative evaluation method can ensure the high accuracy and consistency of the identification of serious defects, providing a scientific basis for subsequent quality grading and processing, and ensuring that the quality control of optical lenses meets the standard requirements; the severity of minor defects, medium defects and serious defects on the mirror surface is recorded, and a defect severity assessment report is generated, which can systematically integrate and record defect information of different severity levels.
[0022] In this specification, an optical lens surface defect detection system based on image processing is provided, which is used to perform 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: The optical lens feature acquisition module is used to obtain the optical lens to be tested; perform surface reflectivity detection on the optical lens to be tested to obtain surface reflectivity data; perform surface curvature recognition on the optical lens to be tested to obtain surface curvature data; The lens multimodal imaging module is used to determine the initial conditions of the illumination light source according to the surface reflectivity data, and to perform optical filtering on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; the filtered light source is used to illuminate the optical lens to be tested at multiple angles, and to perform surface multimodal imaging to obtain a surface multimodal image; The lens panoramic image enhancement module is used to perform image stitching on 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; The lens defect detection and evaluation module is used to identify the mirror defect contour of the lens panoramic enhanced image, and to calculate the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; to judge the defect type of the mirror defect contour parameters to obtain the mirror defect type data; to evaluate the defect severity of the mirror defect type data and generate a defect severity evaluation report.
[0023] The present invention uses an optical lens feature acquisition module to simultaneously carry out surface reflectivity detection and surface curvature identification, and accurately obtains surface reflectivity data and surface curvature data of the optical lens to be tested, respectively, to ensure that subsequent processing can be carried out based on the real and comprehensive physical properties of the optical lens, and to avoid inaccurate detection due to missing or one-sided data; the accurate acquisition of surface reflectivity data and surface curvature data makes it possible to subsequently determine the initial conditions of the illumination light source and perform optical filtering processing and other operations based on the characteristics of the optical lens itself, thereby providing a scientific and reasonable basis for subsequent multi-angle illumination and surface multimodal imaging links. Through the lens multimodal imaging module, the initial conditions of the illumination light source are determined according to the surface reflectivity data, and then the initial conditions of the illumination light source are optically filtered based on the surface curvature data to generate a filtered light source, so that the illumination light source can accurately adapt to the surface characteristics of the optical lens to be tested; different optical lenses have different surface reflectivity and curvature due to factors such as materials and processes. The filtered light source generated in this way can effectively solve the problem that the traditional single light source is difficult to adapt to the surface characteristics of a variety of optical lenses, ensuring that the lens surface feature information can be better stimulated during the subsequent irradiation process; the filtered light source is used to irradiate the optical lens to be tested at multiple angles, and surface multimodal imaging is performed to obtain a surface multimodal image; multi-angle irradiation combined with multimodal imaging can capture rich detail information on the surface of the optical lens from different viewing angles and multiple imaging modes. Compared with a single angle and a single imaging mode, it can more comprehensively display the microstructure and potential defect characteristics of the lens surface, providing a richer and more accurate image data basis for 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 multimodal images are stitched, and the local multimodal images can be integrated into a complete panoramic image, which effectively solves the problem that when the optical lens surface size is large, a single imaging is difficult to cover the entire surface; the generation of panoramic images enables the subsequent overall analysis of the optical lens surface, avoiding the inaccurate judgment of defect location, distribution range and other information due to incomplete images, and provides a complete image basis for comprehensive evaluation of the surface condition of the optical lens; image enhancement of the optical lens panoramic image can improve the contrast, brightness and other visual effects of the panoramic image, highlight the key details and potential defect features in the image, and make 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 mirror defect contour recognition and other links, improves the accuracy and reliability of defect recognition, and ensures the accuracy of subsequent defect detection results.Through the lens defect detection and evaluation module, the mirror defect contour is identified on the lens panoramic enhanced image, and the contour parameters of the mirror defect contour are calculated. The defect contour on the optical lens mirror surface can be accurately identified, and the shape and size characteristics of the defect can be quantitatively described through contour parameter calculation; 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 is judged by the mirror defect contour parameters to obtain the mirror defect type data; the mirror defect type data is evaluated for defect severity The degree assessment can accurately determine the type of optical lens surface defects (such as scratches, spots and bubbles), and scientifically assess the severity of the defects based on comprehensive information such as the defect type and profile parameters. The defect degree assessment report finally generated can provide a clear and reliable reference for the quality control, production improvement and subsequent usage decisions 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 reflective characteristic attributes and lens surface curvature of the optical lens surface, and determines the imaging illumination light source conditions to realize multi-modal imaging of the lens surface, thereby obtaining a panoramic enhanced image of the lens, and performing optical lens surface defect detection, thereby improving the detection accuracy of lens surface defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of the steps of an optical lens surface defect detection method based on image processing; Figure 2 for Figure 1 Detailed implementation steps of step S3 in FIG. Figure 3 for Figure 1 Detailed implementation steps of step S4 in FIG. The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0025] The technical method of the present invention is described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by technicians in this field without creative work are within the scope of protection of the present invention.
[0026] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying 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 implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor methods and / or microcontroller methods.
[0027] It should be understood that, although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another unit. 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.
[0028] To achieve this, please refer to Figures 1 to 3 , a method for detecting surface defects of an optical lens based on image processing, the method comprising the following steps: Step S1: obtaining an optical lens to be tested; performing surface reflectivity detection on the optical lens to be tested to obtain surface reflectivity data; performing surface curvature recognition on the optical lens to be tested to obtain surface curvature data; Step S2: determining the initial conditions of the illumination light source according to the surface reflectivity data, and performing optical filtering 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 tested with the filtered light source at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image; Step S3: stitching the surface multimodal images to generate an optical lens panoramic image; enhancing the optical lens panoramic image to obtain a lens panoramic enhanced image; Step S4: Identify the mirror defect contour on the lens panoramic enhanced image, and calculate the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; determine the defect type on the mirror defect contour parameters to obtain mirror defect type data; evaluate the defect severity on the mirror defect type data to generate a defect severity evaluation report.
[0029] In the embodiment of the present invention, reference Figure 1 As shown, the optical lens surface defect detection method based on image processing comprises the following steps: Step S1: obtaining an optical lens to be tested; performing surface reflectivity detection on the optical lens to be tested to obtain surface reflectivity data; performing surface curvature recognition on the optical lens to be tested to obtain surface curvature data; In an embodiment of the present invention, an optical lens to be tested is obtained; backlighting is enabled, a light source is placed behind the lens, light is transmitted through the lens, and irradiates the photosensitive element of the camera from the other side of the lens; low-angle annular dark field lighting is enabled, an annular light source is placed around the lens, light is irradiated to the lens surface at a low angle, and tiny structures and defects on the lens surface are highlighted; coaxial light lighting is enabled, the light source is aligned with the optical axis of the camera, and light is irradiated vertically to the lens surface, so as to observe the overall condition of the lens surface; the optical lens to be tested is fixed on a detection platform, and the relative position of the lens and the camera is adjusted so that the reflected light on the lens surface can be clearly imaged; reflection images of the lens surface under different lighting conditions are collected in turn, and recorded as backlight images, dark field images, and coaxial light images, respectively; grayscale processing is performed on the collected reflection images, and the color images are converted into grayscale images; the grayscale images are normalized, and the pixel value range is adjusted to between 0 and 1 to eliminate the difference in image brightness under different lighting conditions; the grayscale of the normalized image is calculated. Histogram, statistics the distribution range of reflected light intensity, and obtain the statistical information of grayscale histogram; according to the statistical information of grayscale histogram, calculate the mean and standard deviation of reflected light intensity, and obtain surface reflectivity data; adjust the relative position of camera and lens to make the image of lens surface clear; according to the preset sampling interval, collect multiple images of lens surface, cover different areas of lens, so as to obtain comprehensive surface information; denoise the collected images, use Gaussian filtering algorithm, set appropriate filtering parameters, and remove noise in the images; perform edge enhancement on the denoised images to highlight the edge features of lens surface, so as to facilitate subsequent edge detection; use edge detection algorithm to extract edge information of lens surface, obtain edge image, analyze edge image, and extract geometric features of edge, including information such as length, direction and curvature of edge; according to the geometric features of edge, calculate curvature distribution of lens surface, and obtain curvature value of each detection point; store the calculated curvature value as a numerical array, and record curvature data of each detection point.
[0030] Step S2: determining the initial conditions of the illumination light source according to the surface reflectivity data, and performing optical filtering 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 tested with the filtered light source at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image; In the embodiment of the present invention, the initial brightness and angle of the illumination light source are determined according to the mean value and standard deviation of the reflected light intensity in the surface reflectivity data. If the mean value of the reflected light intensity is high and the standard deviation is small, it means that the reflectivity of the lens surface is strong and uniform, and a light source with lower brightness is selected; otherwise, a light source with higher brightness is selected; the initial wavelength of the illumination light source is determined according to the distribution range of the reflected light intensity in the surface reflectivity data. If the intensity of the reflected light is mainly concentrated in a specific wavelength range, select a light source with a corresponding wavelength; based on the surface curvature data, calculate the curvature variation range of different areas on the lens surface. For areas with large curvature variations, use a high-pass filter for optical filtering to highlight high-frequency information; for areas with small curvature variations, use a low-pass filter for optical filtering to retain low-frequency information; place the optical filter between the illumination light source and the optical lens to be tested so that the filtered light source is irradiated to the lens surface, and the light intensity distribution of the filtered light source should match the curvature distribution of the lens surface; install the filtered light source on an adjustable light source bracket, and perform multi-angle irradiation according to a preset angle range (such as 0°~90°) and angle interval (such as 10°); at each irradiation angle, keep the brightness and wavelength of the light source unchanged, and irradiate the optical lens in turn; at each irradiation angle, use a high-resolution industrial camera to capture images of the lens surface, and the captured images include bright field images and dark field images. The bright field image is used to observe the overall condition of the lens surface, and the dark field image is used to highlight the tiny defects on the lens surface. The collected bright field image and dark field image are preprocessed separately, including denoising, contrast enhancement and other operations; the preprocessed bright field image and dark field image are fused to obtain a surface multimodal image.
[0031] Step S3: stitching the surface multimodal images to generate an optical lens panoramic image; enhancing the optical lens panoramic image to obtain a lens panoramic enhanced image; In an embodiment of the present invention, the collected surface multimodal images (including bright field images and dark field images) are denoised, and a Gaussian filtering method is used, and the filter kernel size is set to 5×5 to remove random noise in the image; the denoised image is contrast enhanced, and the grayscale value of the image is nonlinearly adjusted using the Gamma transformation method to enhance the contrast between shallow defects and the background in the image; the key feature points of each image are extracted using the SIFT or ORB algorithm. The feature extraction parameters of the SIFT algorithm include 4 Gaussian pyramid layers, and the Gaussian filter standard deviation of each layer is 1.2, 2.4, 4.8 and 9.6 respectively; the matching relationship between the feature points is calculated, and the nearest neighbor matching method is used, 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 the bright field image and the dark field image, 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, the overlapping areas are weighted averaged and fused; the generated optical lens panoramic image is converted into a grayscale image, and the pixel values of the three RGB channels are converted into grayscale values in proportion using the weighted average method; the 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 parameters of the MSR algorithm are set as follows: three scales (15, 80, and 250 pixels) are selected, and the grayscale images are Gaussian filtered respectively, with the filter standard deviations of 15, 80, and 250 pixels respectively; the logarithmic image at each scale is calculated, and the logarithmic function is corrected by the compensation factor; the enhanced image is brightness normalized to adjust the brightness range of the image 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.
[0032] Step S4: Identify the mirror defect contour on the lens panoramic enhanced image, and calculate the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; determine the defect type on the mirror defect contour parameters to obtain mirror defect type data; evaluate the defect severity on the mirror defect type data to generate a defect severity evaluation report.
[0033] In an embodiment of the present invention, the lens panoramic enhanced image is grayed to convert the color image into a gray image for subsequent processing; the gray image is smoothed using a Gaussian filter with a filter kernel size of 5×5 and a standard deviation of 1.5 to remove noise; and the Canny edge detection algorithm is used to extract edge information in the image. Set the low threshold of the Canny algorithm to 50 and the high threshold to 150; refine the detected edges, remove isolated edge points, and retain continuous edge contours; use a contour extraction algorithm (such as the findContours function in OpenCV) to extract contours in the image, and set the contour extraction mode to cv2.RETR_EXTERNAL to extract the outer contour; filter the extracted contours to remove contours with an area less than a preset threshold (such as 10 pixels); for each extracted contour, calculate its geometric parameters, including the area, perimeter, major axis, and minor axis lengths of the contour; calculate the shape features of the contour, such as circularity (the ratio of the contour area to the area of the equivalent circle) and rectangularity (the ratio of the contour area to the area of the minimum circumscribed rectangle); calculate the centroid position of the contour, which is obtained by calculating the geometric center of the contour; store the calculated contour parameters as a data structure, including the contour area, perimeter, major axis and minor axis lengths, circularity, rectangularity, and centroid position; according to the contour parameters, extract Take the feature vector, including area, perimeter, major and minor axis lengths, circularity, rectangularity, etc., normalize the feature vector, and adjust the feature value range to between 0 and 1; use a pre-trained classification model (such as support vector machine SVM or artificial neural network ANN) to classify the feature vector; the classification model outputs a defect type label, such as scratches, spots, cracks, etc., based on the eigenvalues of the feature vector; associate the defect type label with the corresponding contour parameters and store it as defect type data; evaluate the severity of the defect based on the defect type label in combination with the contour parameters (such as area, perimeter, etc.); the severity of the scratch is evaluated by its length and width, and the severity of the spot is evaluated by its area. Set the severity grading standard, such as slight, moderate, and severe, and classify it into the corresponding level according to the defect's eigenvalue; organize the evaluation results into a defect level assessment report, including the defect type, location, severity level, and corresponding contour parameters. The report contains image annotations of the defects to intuitively display the defect location.
[0034] Preferably, step S1 includes the following: Step S11: obtaining an optical lens to be tested; Step S12: bright field illumination is performed on the optical lens to be tested by using a point light source, and the point light source is located 30-50 cm above the lens to obtain a bright field illumination setting; Step S13: performing dark field illumination on the optical lens to be tested by using a ring light source, and placing the ring light source 20-30 cm below the lens to obtain a dark field illumination setting; Step S14: respectively collecting lens surface images under bright field illumination and dark field illumination, and setting the resolution of the operating camera to be no less than 1920×1080 pixels, the exposure time of the bright field image to 1 / 100 second, and the exposure time of the dark field image to 1 / 50 second, so as to obtain the brightness value of the bright field image and the brightness value of the dark field image; Step S15: Calculate the lens surface reflectivity using the brightness value of the bright field image and the brightness value of the dark field image to obtain surface reflectivity data; Step S16: performing surface curvature recognition on the optical lens to be tested to obtain surface curvature data.
[0035] In the embodiment of the present invention, the optical lens to be tested is placed on a detection platform to ensure that the lens surface is clean and free from external interference; a point light source is used to perform bright field illumination on the optical lens to be tested, and the point light source is placed 30-50 cm above the lens; the incident angle of the light source is ensured to be between 45 degrees and 90 degrees, so that the reflected light can directly enter the camera lens to form a bright imaging effect; a ring light source is used to perform dark field illumination on the optical lens to be tested, and the ring light source is placed 20-30 cm below the lens; it is ensured that the light source illuminates the lens surface at an inclined angle, and only scattered light or reflected light enters the camera lens, the background is dark, and the tiny structure on the lens surface is highlighted; a high-resolution camera is used to collect lens surface images under bright field illumination and dark field illumination, and the camera resolution is not less than 1920×1080 pixels, set the exposure time of the bright field image to 1 / 100 second, and the exposure time of the dark field image to 1 / 50 second. After the acquisition is completed, record the brightness value of the bright field image and the brightness value of the dark field image respectively; grayscale the acquired bright field image and dark field image, calculate the grayscale histogram of the bright field image and the dark field image, count the distribution range of the brightness value, and calculate the surface reflectivity data according to the brightness value of the bright field image and the brightness value of the dark field image; use image processing software to perform edge detection on the acquired image, extract the edge information of the lens surface, and obtain the edge features by calculating the gradient direction and intensity of the edge; use the fitting algorithm to fit the edge information to obtain the curvature distribution of the lens surface, store the calculated curvature value as a numerical array, and record the curvature data of each detection point.
[0036] Preferably, step S16 includes the following: Step S161: Select three measuring points on the optical lens to be tested, and record the point located at the geometric center of the lens as the center measuring point; the point located within 1 mm to 3 mm inside the edge of the lens as the edge measuring point; and the point located between the center and the edge of the lens and 5 mm to 10 mm from the center as the middle measuring point; Step S162: Use a laser displacement sensor to measure three measuring points three times, each measuring interval is 0.5 seconds to 1 second, record the curvature radius value of each measurement, and obtain the curvature radius measurement value of the measuring point; Step S163: taking an average of the curvature radius measurement values of the measuring points to obtain the curvature radius value of the measuring points; Step S164: fitting the overall curvature distribution of the optical lens surface to be measured according to the curvature radius value of the measuring point by the least square method to obtain the surface curvature data.
[0037] In the embodiment of the present invention, three representative measuring points are first selected on the surface of the optical lens to be measured, namely, the center measuring point, the edge measuring point and the middle measuring point. Among them, the center measuring point is located at the geometric center of the lens, the edge measuring point is located within the range of 1 mm to 3 mm inside the edge of the lens, and the middle measuring point is located in the middle position between the center and the edge of the lens, 5 mm to 10 mm from the center. Subsequently, the three measuring points are accurately measured using a laser displacement sensor, which measures the displacement or shape change of the surface of the object by emitting a laser beam and receiving reflected light. In order to ensure the accuracy and reliability of the measurement, each measuring 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 results. 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, and the specific operation is to add the three measurement values of each measurement point and divide them 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 results. Finally, according to the average curvature radius value of the measurement point, the least squares method is used to fit the overall curvature distribution of the optical lens surface to be tested. As a mathematical optimization method, the least squares method finds the best function match for the data by minimizing the sum of squares of 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 optical lens surface is finally obtained, and the fitting results are stored as surface curvature data, providing important data support for subsequent defect detection analysis.
[0038] Preferably, step S2 includes the following: Step S21: Determine the initial condition of the illumination light 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 a ring-shaped uniform light source and set the initial brightness to 1200±100cd; Step S22: performing optical filtering on the initial conditions of the illumination light source based on the surface curvature data. If the surface curvature radius is less than 10 mm, a high-pass filter is used, and the cutoff frequency is set to 0.1±0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, a low-pass filter is used, and the cutoff frequency is set to 0.05±0.005 mm; Step S23: irradiating the optical lens to be tested with the filtered light source at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image.
[0039] In an embodiment of the present invention, the initial conditions of the illumination light source are first determined according to the surface reflectivity data. The specific operation is: when the surface reflectivity data is greater than 0.7, a polarized light source is selected, and the initial polarization angle is accurately set to 45°, and the allowable error range is controlled within ±5°; when the surface reflectivity data is less than or equal to 0.7, a ring-shaped uniform light source is selected, and the initial brightness is accurately set to 1200cd, and the allowable error range is controlled within ±100cd. Subsequently, the determined initial conditions of the illumination light source are optically filtered based on the surface curvature data. The specific operation is: if the surface curvature radius is less than 10 mm, a high-pass filter is selected, and the cutoff frequency is accurately set to 0.1 mm, and the allowable error range is controlled within ±0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, a low-pass filter is selected, and the cutoff frequency is accurately set to 0.05 mm, and the allowable error range is controlled within ±0.005 mm. After completing the optical filtering process, the processed light source is used to irradiate the optical lens to be tested at multiple angles. To this end, the filtered light source is installed on an adjustable light source bracket, and multi-angle irradiation is performed according to the preset angle range (such as 0°~90°) and angle interval (such as 10°). At each irradiation angle, the brightness and polarization angle (or uniformity) of the light source are kept unchanged, and the optical lens is irradiated in turn. At the same time, a high-resolution industrial camera is used to collect images of the lens surface at different angles, and the collected images include bright field images and dark field images. The bright field image is used to observe the overall situation of the lens surface, and the dark field image is used to highlight the tiny defects on the lens surface. After the acquisition is completed, these images are pre-processed, including denoising, contrast enhancement and other operations. The denoising operation can use the Gaussian filtering method, and the contrast enhancement can use the histogram equalization or adaptive contrast enhancement method, and finally a multimodal image of the surface is obtained, which provides a high-quality image basis for subsequent defect detection.
[0040] Preferably, step S23 includes the following: Step S231: installing the filtered light source on an angle-adjustable light source bracket, and setting the irradiation angle range of the filtered light source to 0° to 60°, obtaining the irradiation angle data of the light source, wherein the specific irradiation angles are set to 0°, 30° and 60°, and the irradiation time of each irradiation angle is 2 seconds, 3 seconds, 4 seconds and 5 seconds respectively; Step S232: judging the imaging condition of the lens surface according to the light source illumination angle data, and performing surface imaging mode determination on the imaging condition of the lens surface to obtain the lens surface imaging mode, wherein the lens surface imaging mode includes a bright field imaging mode, a dark field imaging mode and a polarization imaging mode; Step S233: performing multimodal imaging on the optical lens to be tested based on the lens surface imaging mode to generate lens multimodal imaging data; performing image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.
[0041] In an embodiment of the present invention, first, a filtered light source is installed on a light source bracket with an adjustable angle, which can accurately control the irradiation angle of the light source. The irradiation angle range of the light source is set to 0° to 60°, and 0°, 30° and 60° are selected as 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 operation is performed in sequence, and the angle and time information of each irradiation are recorded to form the irradiation angle data of the light source. Subsequently, according to the recorded irradiation angle data of the light source, the imaging conditions of the lens surface under irradiation at different angles are analyzed. Based on these conditions, the imaging mode of the lens surface is determined, and the imaging mode includes a bright field imaging mode, a dark field imaging mode and a 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 tiny defects on the lens surface; and 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 tested. At each set illumination angle, the bright field, dark field and polarization imaging modes are used in turn to perform imaging, and the corresponding image data are collected respectively, thereby generating lens multimodal imaging data containing multiple imaging information. After the acquisition is completed, the lens multimodal imaging data is converted into an image format. The specific operation is to convert the collected image data from the original format to a unified image format, such as converting a color image into a grayscale image, for subsequent image processing and analysis. Through this series of technical operations, a surface multimodal image is finally obtained.
[0042] Preferably, step S233 includes the following: 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 a bright field image, set the camera resolution to no less than 2048×2048 pixels, the exposure time to 1 / 125 second, the ISO to 100-200, and record the optical lens bright field image; 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 capture a dark field image, set the camera resolution to no less than 1080×1080 pixels, the exposure time to 1 / 100 second, the ISO to 200-300, and record the optical lens dark field image; 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 polarization images, set the camera resolution to no less than 720×720 pixels, the exposure time to 1 / 60 second, the ISO to 300-400, and record the optical lens polarization image; Step S2337: marking the optical lens bright field image, the optical lens dark field image and the optical lens polarization image as multimodal images to generate lens multimodal imaging data; Step S2338: performing image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.
[0043] In the embodiment 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 can be accurately irradiated on the center of the optical lens imaging platform. Subsequently, a high-resolution camera is used to capture bright field images, ensuring that the camera resolution is set to no less 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 that the image clarity and brightness are moderate, and the bright field image data of the optical lens is recorded. Next, according to the requirements of the dark field imaging mode, the filtered light source is adjusted to an angle of 30°, and it is also irradiated on the optical lens imaging platform. A high-resolution camera is used to collect dark-field images. At this time, the camera resolution is set to no less 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 tiny defects and details on the lens surface, and record the dark-field image data of the optical lens; according to the requirements of the polarization imaging mode, the filtered light source is adjusted to a 60° angle and irradiated on the optical lens imaging platform, and a high-resolution camera is used to collect polarization images. The camera resolution is set to no less 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 defects and background in the image, and record the polarization image data of the optical lens. After completing the image acquisition of the above three imaging modes, the collected optical lens bright-field images, dark-field images, and polarization images are multimodally labeled. Through image processing software, corresponding imaging mode tags and related parameter information, such as illumination angle, camera resolution, exposure time and ISO value, are added to each image to generate lens multimodal imaging data containing complete information; finally, the lens multimodal imaging data is converted into an image format; using an image format conversion tool, the collected image data is uniformly converted from the original format to a standard image format, such as a grayscale image format or a JPEG format.
[0044] As an example of the present invention, refer to Figure 2As shown, in this example, step S3 includes: Step S31: performing image feature matching point recognition on the surface multimodal image to obtain image feature matching points; performing multimodal image stitching matching on the surface multimodal image according to the image feature matching points, and setting the overlapping area to 20%-30% of the image width to generate an initial stitched image; Step S32: cutting the stitching edges of the initial stitching image and aligning the images to obtain an optical lens panoramic image; Step S33: converting the optical lens panoramic image into a grayscale image to obtain an optical lens grayscale image; counting the grayscale value pixels of the optical lens grayscale image, and performing cumulative distribution calculation on the grayscale value pixels to generate a histogram equalization image; Step S34: performing contrast enhancement on the histogram equalization image and adjusting the grayscale range to [50, 200] to obtain a contrast enhanced image; Step S35: sharpening the image edges of the contrast-enhanced image to obtain a lens panoramic enhanced image.
[0045] In an embodiment of the present invention, image feature matching points are identified for surface multimodal images. The feature point detection is performed using the ORB algorithm, 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 descriptor of the feature point, the feature point is matched using the FLANN matcher, and high-quality matching points are screened out to obtain image feature matching points. According to the image feature matching points, multimodal image stitching matching is performed on the surface multimodal image. During the stitching process, the overlapping area is set to 20%-30% of the image width to ensure the 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 initial stitched image is stitched edge cropped to remove the redundant edge portion generated during the stitching process. At the same time, an image alignment technology based on feature points is used to ensure the precise alignment of the stitched image, thereby obtaining an optical lens panoramic image. Next, the optical lens panoramic image is converted into a grayscale image, and a histogram equalization image is generated by counting the grayscale value pixels and performing cumulative distribution calculations. This process enhances the contrast and details of the image by adjusting the grayscale distribution of the image. The histogram equalization image is contrast enhanced and the grayscale range is adjusted to [50,200]. The visual effect of the image and the adaptability of subsequent processing are improved through linear transformation or other contrast enhancement algorithms. Finally, the contrast enhanced image is sharpened by using algorithms such as Laplace sharpening or USM sharpening to enhance the clarity and sharpness of the image edge, thereby obtaining a lens panoramic enhanced image, which provides a high-quality image foundation for subsequent defect detection.
[0046] More importantly, step S34 includes the following steps: Step S341: traverse each pixel in the image and record the grayscale values of all the pixels; extract the minimum value and the maximum value of the grayscale values of all the pixels, and record them as the current minimum grayscale value and the current maximum grayscale value respectively; Step S342: setting the maximum target grayscale value to 200 and the minimum target grayscale value to 50; Step S343: subtract the target grayscale minimum value from the target grayscale maximum value as the numerator, and subtract the current maximum grayscale value from the current minimum grayscale value as the denominator, calculate the ratio of the numerator and the denominator to obtain the grayscale linear stretch coefficient; determine the grayscale offset based on the grayscale linear stretch coefficient; Step S344: performing contrast enhancement on the histogram equalization image according to the grayscale linear stretch coefficient and the grayscale offset, and dividing the histogram equalization image into a plurality of local regions, each of which has a size of 8×8 pixels; Step S345: adjusting the grayscale value of each local area to a grayscale range of [50, 200] to obtain a contrast enhanced image.
[0047] In an embodiment of the present invention, a grayscale value analysis is performed on a histogram equalization image. The specific operation is: traverse each pixel in the image pixel by pixel, and record the grayscale values of all pixels. Through statistical analysis, the minimum and maximum values of the grayscale values of all pixels are extracted, and recorded as the current minimum grayscale value and the current maximum grayscale value, respectively. Subsequently, the target grayscale maximum value is set to 200, and the target grayscale minimum value is set to 50. The difference between the target grayscale maximum value and the target grayscale minimum value is calculated as the numerator, and the difference between the current maximum grayscale value and the current minimum grayscale value is used as the denominator. The numerator and the denominator are proportionally calculated to obtain the grayscale linear stretch coefficient. Based on the grayscale linear stretch coefficient, the grayscale offset is further determined. According to the grayscale linear stretch coefficient and the grayscale offset, the histogram equalization image is contrast enhanced. In this process, the histogram equalization image is divided into multiple local areas, each of which is 8×8 pixels in size. The grayscale value of each local area is adjusted so that its grayscale range reaches [50,200], and finally a contrast enhanced image is obtained.
[0048] More importantly, step S35 includes the following steps: Step S351: perform edge detection on the image using a 3×3 Laplacian operator, and calculate the grayscale difference between each pixel and the surrounding pixels to obtain local area data; Step S352: select a local area data as a processing unit, calculate the average gray value of the area; perform adaptive threshold segmentation on the contrast enhanced image according to the average gray value of the area, and segment out the image defect edge information; Step S353: performing an opening and closing operation through the 3×3 structural element, and removing the noise of the edge information of the image defect to obtain an edge noise removed image; Step S354: high-pass filter is used to enhance the high-frequency features of the edge noise removed image to obtain a lens panoramic enhanced image.
[0049] In an embodiment of the present invention, for each pixel in the image, the grayscale difference between it and the surrounding pixels is calculated. The specific steps are: convolution operation is performed on the kernel matrix of the Laplace operator and the corresponding pixel area in the image to obtain the Laplace response value of the pixel. In this way, local area data of each pixel in the image is obtained, which reflects the severity of grayscale changes in the image, thereby realizing edge detection. Subsequently, a local area data is selected as a processing unit to calculate the average grayscale value of the area. The specific operation is: select a local area in the image (for example, an area of 8×8 pixels), calculate the average grayscale value of all pixels in the area, and obtain the regional average grayscale value. According to the calculated regional average grayscale value, the contrast enhanced image is adaptively threshold segmented. The specific steps are: for each pixel in the image, the threshold is dynamically adjusted according to the average grayscale value of the local area where it is located. If the grayscale value of the pixel is higher than the average grayscale value of the local area plus a preset threshold offset (for example, 10), the pixel is divided into an edge pixel; otherwise, it is divided into a non-edge pixel. In this way, the edge information of the image defect is segmented. Next, the noise in the edge information of the image defect is removed by opening and closing operations using the 3×3 structural element. The specific operation is as follows: first, an opening operation is performed, that is, corrosion first and then expansion. The corrosion operation uses the 3×3 structural element to scan the image and replaces the grayscale value of the pixels in the area covered by the structural element with the minimum value in the area; the expansion operation replaces the grayscale value of the pixels in the area covered by the structural element with the maximum value in the area. The opening operation removes small noise points and broken connections. Then a closing operation is performed, that is, expansion first and then corrosion, and 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 removal image. Finally, the high-frequency feature enhancement of the edge noise removal image is performed by a high-pass filter. The specific operation is as follows: a convolution operation is performed on the image. For each pixel in the image, the grayscale difference between it and the surrounding pixels is calculated, and the difference is added to the original pixel value, thereby enhancing the high-frequency components in the image, such as edges and details. In this way, a lens panoramic enhanced image is obtained, which has clearer edges and more prominent details, providing a high-quality image foundation for subsequent defect detection.
[0050] As an example of the present invention, refer to Figure 3 As shown, in this example, step S4 includes: Step S41: performing mirror edge defect detection on the lens panoramic enhanced image, setting the threshold to 50-150, and extracting the mirror edge defect image; Step S42: Find the contour on the mirror edge defect image, starting from the upper left corner of the image, scan the image pixel by pixel, and find the edge point; when an edge point is found, track 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: measuring the defect contour perimeter and defect contour area of the mirror surface defect contour data, and determining the mirror surface defect contour aspect ratio according to the defect contour perimeter and defect contour area; Step S44: combining the defect contour perimeter, the defect contour area and the mirror surface defect contour aspect ratio to obtain the mirror surface defect contour parameters; Step S45: Determine the defect type of the mirror defect profile parameters to obtain mirror defect type data; evaluate the defect severity of the mirror defect type data to generate a defect severity evaluation report.
[0051] In an embodiment of the present invention, the mirror edge defect detection is performed on the lens panoramic enhanced image, and the specific operation is: convert the image into a grayscale image, and then use the threshold range of 50-150 for binarization processing, mark the pixel points with grayscale values higher than 150 as defect areas, and mark the pixel points with grayscale values lower than 50 as non-defect areas, so as to extract the mirror edge defect image. Subsequently, the contour is found on the mirror edge defect image. Starting from the upper left corner of the image, the image is scanned pixel by pixel to find the edge point. When an edge point is found, it is tracked along the edge until it returns 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, the defect contour perimeter and defect contour area are measured for 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, the aspect ratio of the mirror defect contour is determined according to the defect contour perimeter and the defect contour area. The specific calculation method is: aspect ratio = maximum width of the contour / maximum height of the contour. Combine the defect contour perimeter, defect contour area, and mirror defect contour aspect ratio to obtain the mirror defect contour parameters. These parameters will serve as the basic data for subsequent defect type judgment. Finally, the defect type is judged on the mirror defect contour parameters to obtain the mirror defect type data. According to the preset defect type standards (such as aspect ratio, area and other features), the defects are classified into scratches, point defects, broken edges and other types. The defect severity is evaluated for the mirror defect type data and a defect severity evaluation report is generated. The evaluation report records the location, type, severity and corresponding image area of each defect in detail, providing a basis for subsequent repair and quality control.
[0052] More importantly, step S42 includes the following steps: Step S421: on the mirror edge defect image, starting from the pixel point at the upper left corner of the image, the image is scanned pixel by pixel to find edge points whose gray value changes exceed a preset threshold; Step S422: when an edge point is found, the coordinate position of the edge point is recorded and marked as visited; the gray value change of the eight adjacent pixels around the current edge point is checked, and the adjacent pixel with the largest gray value change is selected as the next edge point; if there is no pixel with a gray value change exceeding a preset threshold among the eight adjacent pixels, the current edge tracking is considered to be finished; Step S423: Connect the tracked edge points in sequence to form a closed contour line. If the tracking process returns to the starting point, it is considered that a complete defect contour has been formed. 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. Step S425: storing the extracted mirror defect contour data in a structured data format.
[0053] In an embodiment of the present invention, starting from the pixel point at the upper left corner of the mirror edge defect image, the image is scanned pixel by pixel to find an edge point whose grayscale value changes exceed a preset threshold. The preset threshold is adjusted according to the grayscale distribution of the image and is usually set to a fixed value, such as 10. When an edge point is found, the coordinate position of the edge point is recorded and marked as visited; the grayscale value changes of the 8 adjacent pixels around the current edge point are checked, and the adjacent pixel point with the largest grayscale value change is selected as the next edge point. If there is no pixel point whose grayscale value changes exceed the preset threshold among the 8 adjacent pixels around, it is considered that the current edge tracking is over. The tracked edge points are connected in sequence to form a closed contour line. If the starting point is returned during the tracking process, it is considered that a complete defect contour is formed; the above operation is repeated 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; and the extracted mirror defect contour data is stored in a structured data format. The specific operation is: the coordinate point, contour length, contour area and other information of each contour are stored as a data structure, such as a list or an array. The data structure of each contour contains information such as the coordinates of all pixel points of the contour, the perimeter of the contour, the area of the contour, and the aspect ratio of the contour.
[0054] Preferably, step S45 includes the following: Step S451: Determine the defect type according to the mirror defect profile parameters. If the defect profile area is less than 100 square pixels and the mirror defect profile aspect ratio is greater than 5, it is determined to be a mirror scratch; if the defect profile area is greater than 100 square pixels and less than 500 square pixels and the mirror defect profile aspect ratio is less than 2, it is determined to be a mirror stain; if the defect profile area is greater than 500 square pixels and the mirror defect profile aspect ratio is less than 1.5, it is determined to be a mirror edge break; if the defect profile area is less than 200 square pixels and the mirror defect profile aspect ratio is greater than 2 and less than 5, it is determined to be a mirror demolding; Step S452: merge the defect types of mirror scratches, mirror stains, mirror edge breakage and mirror film peeling, and record the defect parameter quantities to obtain mirror defect type data; Step S453: evaluating the severity of the mirror surface defect type data. If the mirror surface scratch length is less than 5 mm, the mirror surface stain area is less than 1 square millimeter, the mirror surface broken edge length is less than 2 mm, and the mirror surface demolding area is less than 0.5 square millimeter, it is judged as a minor mirror surface defect; 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 millimeters, the length of the mirror edge break is between 2 and 5 mm, and the mirror demolding area is between 0.5 and 2 square millimeters, it is determined to be a medium defect on the mirror; Step S455: If the length of the mirror scratch is greater than 10 mm, the mirror stain area is greater than 5 square millimeters, the length of the mirror edge break is greater than 5 mm, and the mirror demolding area is greater than 2 square millimeters, it is judged as a serious defect of the mirror; Step S456: Record the severity of minor mirror defects, medium mirror defects, and severe mirror defects, and generate a defect severity assessment report.
[0055] In an embodiment of the present invention, the defect type is judged according to the mirror defect profile parameters. The specific operation is: if the defect profile area is less than 100 square pixels and the mirror defect profile aspect ratio is greater than 5, it is judged as a mirror scratch; if the defect profile area is greater than 100 square pixels and less than 500 square pixels, and the mirror defect profile aspect ratio is less than 2, it is judged as a mirror stain; if the defect profile area is greater than 500 square pixels and the mirror defect profile aspect ratio is less than 1.5, it is judged as a mirror edge break; if the defect profile area is less than 200 square pixels and the mirror defect profile aspect ratio is greater than 2 and less than 5, it is judged as a mirror demolding. Subsequently, the mirror scratches, mirror stains, mirror edge breakage and mirror demolding are merged into defect types, and the defect parameter quantity is recorded to obtain the mirror defect type data. The specific operation is: the relevant parameters of the above four defect types (such as profile area, aspect ratio, etc.) are classified and summarized to form a complete mirror defect type data table. Next, the mirror defect type data is evaluated for defect severity. The specific operation is: if the length of the mirror scratch is less than 5 mm, the mirror stain area is less than 1 square millimeter, the length of the mirror edge is less than 2 mm, and the mirror demolding area is less than 0.5 square millimeter, it is judged as a slight defect on the mirror; if the length of the mirror scratch is between 5 and 10 mm, the mirror stain area is between 1 and 5 square millimeters, the length of the mirror edge is between 2 and 5 mm, and the mirror demolding area is between 0.5 and 2 square millimeters, it is judged as a medium defect on the mirror; if the length of the mirror scratch is greater than 10 mm, the mirror stain area is greater than 5 square millimeters, the length of the mirror edge is greater than 5 mm, and the mirror demolding area is greater than 2 square millimeters, it is judged as a serious defect on the mirror. Finally, the severity of the minor defects, medium defects and serious defects of the mirror is recorded, and a defect degree assessment report is generated. The specific operation is: defects of different severity are recorded in the assessment report.
[0056] In this specification, an optical lens surface defect detection system based on image processing is provided, which is used to perform 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: The optical lens feature acquisition module is used to obtain the optical lens to be tested; perform surface reflectivity detection on the optical lens to be tested to obtain surface reflectivity data; perform surface curvature recognition on the optical lens to be tested to obtain surface curvature data; The lens multimodal imaging module is used to determine the initial conditions of the illumination light source according to the surface reflectivity data, and to perform optical filtering on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; the filtered light source is used to illuminate the optical lens to be tested at multiple angles, and to perform surface multimodal imaging to obtain a surface multimodal image; The lens panoramic image enhancement module is used to perform image stitching on 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; The lens defect detection and evaluation module is used to identify the mirror defect contour of the lens panoramic enhanced image, and to calculate the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; to judge the defect type of the mirror defect contour parameters to obtain the mirror defect type data; to evaluate the defect severity of the mirror defect type data and generate a defect severity evaluation report.
[0057] Therefore, the embodiments should be regarded as illustrative and non-restrictive from all points, and the scope of the present invention is limited by the appended claims rather than the above description, and it is therefore intended that all changes falling within the meaning and range of equivalent elements of the application documents are included in the present invention.
[0058] The above description is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may 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 the embodiments shown herein, but should conform to the widest scope consistent with the principles and novel features invented herein.
Claims
1. A method for detecting surface defects of an optical lens based on image processing, characterized in that: The following steps are involved: Step S1: obtaining an optical lens to be tested; Performing surface reflectivity test on the optical lens to be tested to obtain surface reflectivity data; Performing surface curvature identification on the optical lens to be tested to obtain surface curvature data; Step S2: determining the initial conditions of the illumination light source according to the surface reflectivity data, and performing optical filtering on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; Using a filtered light source to illuminate the optical lens to be tested at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image; Step S3: stitching the surface multimodal images to generate an optical lens panoramic image; Performing image enhancement on the optical lens panoramic image to obtain a lens panoramic enhanced image; Step S4: identifying the mirror defect contour of the lens panoramic enhanced image, and calculating the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; The defect type is judged on the mirror defect profile parameters to obtain the mirror defect type data; the defect severity is evaluated on the mirror defect type data to generate a defect severity evaluation report.
2. The optical lens surface defect detection method based on image processing according to claim 1, characterized in that: Step S1 includes the following steps: Step S11: obtaining an optical lens to be tested; Step S12: bright field illumination is performed on the optical lens to be tested by using a point light source, and the point light source is located 30-50 cm above the lens to obtain bright field illumination; Step S13: performing dark field illumination on the optical lens to be tested by using a ring light source, and placing the ring light source 20-30 cm below the lens to obtain dark field illumination; Step S14: respectively collecting lens surface images under bright field illumination and dark field illumination, and setting the resolution of the operating camera to be no less than 1920×1080 pixels, the exposure time of the bright field image to 1 / 100 second, and the exposure time of the dark field image to 1 / 50 second, so as to obtain the brightness value of the bright field image and the brightness value of the dark field image; Step S15: Calculate the lens surface reflectivity using the brightness value of the bright field image and the brightness value of the dark field image to obtain surface reflectivity data; Step S16: performing surface curvature recognition on the optical lens to be tested to obtain surface curvature data.
3. The optical lens surface defect detection method based on image processing according to claim 2, characterized in that: Step S16 includes the following steps: Step S161: Select three measuring points on the optical lens to be tested, and record the point located at the geometric center of the lens as the center measuring point; the point located within 1 mm to 3 mm inside the edge of the lens as the edge measuring point; and the point located between the center and the edge of the lens and 5 mm to 10 mm from the center as the middle measuring point; Step S162: Use a laser displacement sensor to measure three measuring points three times, each measuring interval is 0.5 seconds to 1 second, record the curvature radius value of each measurement, and obtain the curvature radius measurement value of the measuring point; Step S163: taking an average of the curvature radius measurement values of the measuring points to obtain the curvature radius value of the measuring points; Step S164: fitting the overall curvature distribution of the optical lens surface to be measured according to the curvature radius value of the measuring point by the least square method to obtain the surface curvature data.
4. The optical lens surface defect detection method based on image processing according to claim 1, characterized in that: Step S2 includes the following steps: Step S21: Determine the initial condition of the illumination light 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 a ring-shaped uniform light source and set the initial brightness to 1200±100cd; Step S22: performing optical filtering on the initial conditions of the illumination light source based on the surface curvature data. If the surface curvature radius is less than 10 mm, a high-pass filter is used, and the cutoff frequency is set to 0.1±0.01 mm; if the surface curvature radius is greater than or equal to 10 mm, a low-pass filter is used, and the cutoff frequency is set to 0.05±0.005 mm; Step S23: irradiating the optical lens to be tested with the filtered light source at multiple angles, and performing surface multimodal imaging to obtain a surface multimodal image.
5. The optical lens surface defect detection method based on image processing according to claim 4, characterized in that: Step S23 includes the following steps: Step S231: installing the filtered light source on an angle-adjustable light source bracket, and setting the irradiation angle range of the filtered light source to 0° to 60°, obtaining the irradiation angle data of the light source, wherein the specific irradiation angles are set to 0°, 30° and 60°, and the irradiation time of each irradiation angle is 2 seconds, 3 seconds, 4 seconds and 5 seconds respectively; Step S232: judging the imaging condition of the lens surface according to the light source illumination angle data, and performing surface imaging mode determination on the imaging condition of the lens surface to obtain the lens surface imaging mode, wherein the lens surface imaging mode includes a bright field imaging mode, a dark field imaging mode and a polarization imaging mode; Step S233: performing multimodal imaging on the optical lens to be tested based on the lens surface imaging mode to generate lens multimodal imaging data; performing image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.
6. The optical lens surface defect detection method based on image processing according to claim 5, characterized in that: 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 a bright field image, set the camera resolution to no less than 2048×2048 pixels, the exposure time to 1 / 125 second, the ISO to 100-200, and record the optical lens bright field image; 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 capture a dark field image, set the camera resolution to no less than 1080×1080 pixels, the exposure time to 1 / 100 second, the ISO to 200-300, and record the optical lens dark field image; 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 polarization images, set the camera resolution to no less than 720×720 pixels, the exposure time to 1 / 60 second, the ISO to 300-400, and record the optical lens polarization image; Step S2337: marking the optical lens bright field image, the optical lens dark field image and the optical lens polarization image as multimodal images to generate lens multimodal imaging data; Step S2338: performing image format conversion on the lens multimodal imaging data to obtain a surface multimodal image.
7. The optical lens surface defect detection method based on image processing according to claim 6, characterized in that: Step S3 includes the following steps: Step S31: performing image feature matching point recognition on the surface multimodal image to obtain image feature matching points; performing multimodal image stitching matching on the surface multimodal image according to the image feature matching points, and setting the overlapping area to 20%-30% of the image width to generate an initial stitched image; Step S32: cutting the stitching edges of the initial stitching image and aligning the images to obtain an optical lens panoramic image; Step S33: converting the optical lens panoramic image into a grayscale image to obtain an optical lens grayscale image; counting the grayscale value pixels of the optical lens grayscale image, and performing cumulative distribution calculation on the grayscale value pixels to generate a histogram equalization image; Step S34: performing contrast enhancement on the histogram equalization image and adjusting the grayscale range to [50, 200] to obtain a contrast enhanced image; Step S35: sharpening the image edges of the contrast-enhanced image to obtain a lens panoramic enhanced image.
8. The optical lens surface defect detection method based on image processing according to claim 1, characterized in that: Step S4 includes the following steps: Step S41: performing mirror edge defect detection on the lens panoramic enhanced image, setting the threshold to 50-150, and extracting the mirror edge defect image; Step S42: Find the contour on the mirror edge defect image, starting from the upper left corner of the image, scan the image pixel by pixel, and find the edge point; when an edge point is found, track 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: measuring the defect contour perimeter and defect contour area of the mirror surface defect contour data, and determining the mirror surface defect contour aspect ratio according to the defect contour perimeter and defect contour area; Step S44: combining the defect contour perimeter, the defect contour area and the mirror surface defect contour aspect ratio to obtain the mirror surface defect contour parameters; Step S45: Determine the defect type of the mirror defect profile parameters to obtain mirror defect type data; evaluate the defect severity of the mirror defect type data to generate a defect severity evaluation report.
9. The optical lens surface defect detection method based on image processing according to claim 8, characterized in that: Step S45 includes the following steps: Step S451: Determine the defect type according to the mirror defect profile parameters. If the defect profile area is less than 100 square pixels and the mirror defect profile aspect ratio is greater than 5, it is determined to be a mirror scratch; if the defect profile area is greater than 100 square pixels and less than 500 square pixels and the mirror defect profile aspect ratio is less than 2, it is determined to be a mirror stain; if the defect profile area is greater than 500 square pixels and the mirror defect profile aspect ratio is less than 1.5, it is determined to be a mirror edge break; if the defect profile area is less than 200 square pixels and the mirror defect profile aspect ratio is greater than 2 and less than 5, it is determined to be a mirror demolding; Step S452: merge the defect types of mirror scratches, mirror stains, mirror edge breakage and mirror film peeling, and record the defect parameter quantities to obtain mirror defect type data; Step S453: evaluating the severity of the mirror surface defect type data. If the mirror surface scratch length is less than 5 mm, the mirror surface stain area is less than 1 square millimeter, the mirror surface broken edge length is less than 2 mm, and the mirror surface demolding area is less than 0.5 square millimeter, it is judged as a minor mirror surface defect; 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 millimeters, the length of the mirror edge break is between 2 and 5 mm, and the mirror demolding area is between 0.5 and 2 square millimeters, it is determined to be a medium defect on the mirror; Step S455: If the length of the mirror scratch is greater than 10 mm, the mirror stain area is greater than 5 square millimeters, the length of the mirror edge break is greater than 5 mm, and the mirror demolding area is greater than 2 square millimeters, it is judged as a serious defect of the mirror; Step S456: Record the severity of minor mirror defects, medium mirror defects, and severe mirror defects, and generate a defect severity assessment report.
10. An optical lens surface defect detection system based on image processing, characterized in that: Used to perform the optical lens surface defect detection method based on image processing as claimed in claim 1, the optical lens surface defect detection system based on image processing comprises: The optical lens feature acquisition module is used to obtain the optical lens to be tested; perform surface reflectivity detection on the optical lens to be tested to obtain surface reflectivity data; perform surface curvature recognition on the optical lens to be tested to obtain surface curvature data; The lens multimodal imaging module is used to determine the initial conditions of the illumination light source according to the surface reflectivity data, and to perform optical filtering on the initial conditions of the illumination light source based on the surface curvature data to generate a filtered light source; the filtered light source is used to illuminate the optical lens to be tested at multiple angles, and to perform surface multimodal imaging to obtain a surface multimodal image; The lens panoramic image enhancement module is used to perform image stitching on 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; The lens defect detection and evaluation module is used to identify the mirror defect contour of the lens panoramic enhanced image, and to calculate the contour parameters of the mirror defect contour to obtain the mirror defect contour parameters; to judge the defect type of the mirror defect contour parameters to obtain the mirror defect type data; to evaluate the defect severity of the mirror defect type data and generate a defect severity evaluation report.
Citation Information
Patent Citations
High-precision defect detection method and system for intelligent glasses
CN118837379A
Workpiece surface defect detection method and system based on optical technology
CN119413802A
Adjustment device for outputting data to adjust a surface inspection device, adjustment data output method, and program
JP5087165B1
Method for optical visual examination of three-dimensional shape
KR1020080061786A
Method of quantifying visual uniformity of planar objects
US6438256B1
Cited By
Machine vision-based heavy and medium plate camber edge enhancement detection method and device, storage medium and terminal
CN120125584A
Method and device for detecting and enhancing camber edges of medium and heavy plates based on machine vision, storage medium, and terminal
CN120125584B
Mirror surface microcrack defect detection method
CN120594554A
A method for detecting micro-cracks on a mirror surface
CN120594554B
Imaging method and imaging device for inner wall surface of cylindrical thin-wall part
CN120629179A