Lens component defect recognition method and system based on machine vision

Through the lens component defect recognition method based on machine vision, high-resolution image acquisition and feature vector analysis, the problems of low recognition accuracy and low efficiency in traditional methods are solved, and high-precision and efficient defect recognition are achieved.

CN118570208BActive Publication Date: 2024-11-12SHEN ZHEN BLOSSOM ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411052788.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-11-12
Estimated Expiration
2044-08-02

AI Technical Summary

Technical Problem

Traditional lens component defect recognition methods have low accuracy and low efficiency, making it difficult to meet the needs of large-scale production and high-precision detection.

Method used

Using a machine vision-based method, the surface structure images of the lens component are collected through a high-resolution system, image preprocessing, grayscale processing, defect point position determination, defect area segmentation and pixel point-by-point feature vector conversion, combined with mathematical similarity measurement Methods to identify defect types.

Benefits of technology

It improves the accuracy and efficiency of defect identification, reduces the subjectivity and error of human judgment, and meets the needs of large-scale production and high-precision detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570208B_ABST
    Figure CN118570208B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a lens component defect recognition method and system based on machine vision. The method comprises the following steps: performing surface structure image acquisition and image preprocessing on a lens component through a high-resolution machine vision system to obtain a standard image of the surface structure of the lens component; performing image grayscale processing on the standard image of the surface structure of the lens component, and determining the structure defect points and segmenting the defect area to generate an image of the surface structure defect area of ​​the lens component; performing pixel-by-pixel feature vector conversion on the image of the surface structure defect area of ​​the lens component to obtain an image contour-grayscale feature vector of each pixel point of the surface structure defect area; obtaining a grayscale atlas of standard types of lens surface structure defects to perform vector similarity comprehensive calculation and defect type recognition analysis to obtain a lens component surface defect type recognition result. The present invention can realize automatic defect detection and classification of lens components.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a lens component defect recognition method and system based on machine vision. Background Art

[0002] In the field of lens component manufacturing, defect identification is a key link to ensure product quality and improve production efficiency. With the development of machine vision technology, the lens component defect identification method based on machine vision has become a new trend in the industry, providing innovative solutions for improving product quality and production efficiency. By using high-resolution industrial cameras and optical lenses, high-precision image acquisition and data acquisition of lens components are performed. The camera system is installed on the production line or the inspection site, which can capture the microstructure and detail information of the lens surface. In the image acquisition process, appropriate light sources and filtering technologies are used to ensure the acquisition of clear and high-contrast images, providing a reliable data basis for subsequent defect identification and analysis. At the same time, the automatic identification and classification of lens component defects are realized by combining image processing and machine learning algorithms. Through preprocessing, feature extraction and classification algorithms, various defect types in the image, such as bubbles, cracks, scratches, chromatic aberration, etc., can be analyzed. Machine learning models such as support vector machines (SVM) and deep learning neural networks are used to train and optimize recognition algorithms, thereby improving the accuracy and stability of defect recognition. However, the traditional lens component defect recognition method has the problems of low recognition accuracy and low efficiency, which is difficult to meet the needs of large-scale production and high-precision detection. Summary of the invention

[0003] Based on this, it is necessary for the present invention to provide a lens component defect recognition method and system based on machine vision to solve at least one of the above technical problems.

[0004] To achieve the above object, a method for identifying lens component defects based on machine vision comprises the following steps:

[0005] Step S1: collecting a surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; performing image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component;

[0006] Step S2: graying the standard image of the surface structure of the lens component to obtain a grayed image of the surface structure of the lens component; determining the structural defect points of the grayed image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segmenting the defect area of ​​the grayed image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a defect area image of the surface structure of the lens component;

[0007] Step S3: performing pixel-by-pixel feature vector conversion on the image of the surface structural defect area of ​​the lens component to obtain an image contour-grayscale feature vector of each pixel point in the surface structural defect area; obtaining a grayscale atlas of standard types of lens surface structural defects, and performing vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structural defect area based on the grayscale atlas of standard types of lens surface structural defects to obtain an image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type;

[0008] Step S4: performing defect type recognition analysis on the image of the lens component surface structure defect area based on the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type, and obtaining the lens component surface defect type recognition result.

[0009] The present invention firstly uses a high-resolution machine vision system to collect surface structure images of lens components, and can obtain the original image data of the lens surface. These image data are the basis of production quality control and surface inspection, and accurately and comprehensively capture the structural features and details of the lens surface, thereby providing a reliable data basis for subsequent image processing and analysis. At the same time, by performing noise removal processing on the basis of the original image of the surface structure of the lens component, it is to eliminate the background noise or interference existing in the real-time collected lens component image, and also performs histogram equalization processing, which can enhance the image contrast and brightness distribution, so that the surface structure of the lens component can be more clearly distinguished under different lighting conditions, and by performing image registration processing on it, it can ensure that the surface structure images of different lens components are aligned and consistent in space, and the spatial position and angle deviation between images can be corrected by image registration, so that the surface structure images of each lens component can be effectively compared and analyzed, ensuring consistency and comparability in quality control and product evaluation. Secondly, by graying the standard image of the lens component surface structure, the main purpose is to convert the color or multi-channel image into a grayscale image. This processing step helps to simplify the subsequent image analysis and defect detection process, because the grayscale image eliminates the complexity of color information and focuses on the brightness changes and grayscale levels of the image. Through graying, the tiny structural features and defects on the lens surface can be analyzed more accurately. By determining the structural defect points of the grayscale image of the lens component surface structure, that is, identifying and marking the defect points of the lens component surface structure image based on the characteristics of the grayscale changes in the image, these defect points include structural problems such as cracks, bubbles, scratches, etc., and accurate point determination can provide accurate location information and shape description for quality control and further defect analysis. The defect area of ​​the grayscale image of the surface structure of the lens component is segmented based on the defect points of the surface structure image of the lens component, aiming to generate a defect area image of the surface structure of the lens component. This step uses the previously determined defect point information to separate the defect area from the overall image through image segmentation technology, so that the defect area can be observed and analyzed more clearly. The generated defect area image can not only be used for quantitative analysis and evaluation of lens quality, but also provide important guidance for subsequent repair or improvement work. Then, by performing pixel-by-pixel feature vector conversion on each image pixel in the defect area image of the surface structure of the lens component, this process aims to combine the contour features and grayscale information to construct a comprehensive feature vector for each pixel. The feature vector contains various structural information and grayscale information extracted from the image, and is represented in the form of a spatial feature vector, so that the comprehensive features of each pixel are more comparable and descriptive. These feature vectors are the basis for image similarity calculation and defect classification in subsequent steps, and can effectively distinguish different types of defects and perform quantitative analysis.By obtaining the standard type grayscale atlas of lens surface structural defects, this step usually involves extracting representative defect type images from known standard data sets or experimental samples. These images are classified and annotated, and have clear defect features and type classification information. The purpose of obtaining such a standard grayscale atlas is to establish a reference standard for defect classification. By comparing and calculating the similarity with the actual image features, various defect types of the surface structure of the lens component can be effectively identified. In addition, based on the standard type grayscale atlas of lens surface structural defects, the image contour-grayscale feature vector of each pixel point in the surface structural defect area is subjected to vector similarity comprehensive calculation. This calculation process will use mathematical similarity measurement methods (such as Euclidean distance, cosine similarity, etc.) to compare and evaluate the feature vector of each defect area with the standard type feature vector, thereby obtaining the image feature similarity comprehensive distance value between the surface structural defects of the lens component and each defect standard type. These distance values ​​reflect the similarity between each defect area and the standard type, and are an important basis for further identifying and classifying defects, thereby improving the accuracy and efficiency of defect type identification. Finally, by taking the image feature similarity comprehensive distance value between the surface structural defects of the lens component and each standard defect type as an indicator of defect type similarity, and based on the image feature similarity between the surface structural defects of the lens component and each standard defect type, the corresponding surface structural defect area image of the lens component is subjected to defect type identification and analysis. In this step, the actual defect image on the surface of the lens component is analyzed and compared according to the similarity index calculated above. By comparing the image feature similarity values, it is possible to automatically or semi-automatically identify and classify which standard type of defect each defect area belongs to. This automated identification and analysis process greatly improves the efficiency and accuracy of defect detection, reduces the subjectivity and errors of human judgment, and can provide strong support for the production quality control of lens components, thereby meeting the needs of large-scale production and high-precision defect identification and detection.

[0010] Preferably, the present invention further provides a lens assembly defect recognition system based on machine vision, which is used to execute the lens assembly defect recognition method based on machine vision as described above. The lens assembly defect recognition system based on machine vision comprises:

[0011] The lens component surface structure image acquisition module is used to acquire the surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; and perform image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component;

[0012] The lens component structure image defect area segmentation module is used to perform image grayscale processing on the lens component surface structure standard image to obtain a lens component surface structure grayscale image; determine the structural defect points on the lens component surface structure grayscale image to obtain the defect points of the lens component surface structure image; perform defect area segmentation on the lens component surface structure grayscale image based on the defect points of the lens component surface structure image to generate a lens component surface structure defect area image;

[0013] The defect area image pixel similarity calculation module is used to perform pixel-by-pixel feature vector conversion on the lens component surface structure defect area image to obtain the image contour-grayscale feature vector of each pixel point in the surface structure defect area; obtain the lens surface structure defect standard type grayscale atlas, and perform vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structure defect area based on the lens surface structure defect standard type grayscale atlas, so as to obtain the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type;

[0014] The lens component structural image defect type recognition module is used to perform defect type recognition and analysis on the lens component surface structural defect area image based on the image feature similarity comprehensive distance value between the lens component surface structural defect and each defect standard type, so as to obtain the lens component surface defect type recognition result.

[0015] In summary, the present invention provides a lens assembly defect recognition system based on machine vision, which is composed of a lens assembly surface structure image acquisition module, a lens assembly structure image defect area segmentation module, a defect area image pixel similarity calculation module and a lens assembly structure image defect type recognition module. It can realize any lens assembly defect recognition method based on machine vision described in the present invention, and is used to combine the operations between computer programs running on each module to realize the lens assembly defect recognition method based on machine vision. The internal structures of the system cooperate with each other, which can greatly reduce duplication of work and manpower investment, and can quickly and effectively provide a more accurate and efficient lens assembly defect recognition process based on machine vision, thereby simplifying the operation process of the lens assembly defect recognition system based on machine vision. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments thereof made with reference to the following drawings:

[0017] Figure 1 It is a schematic diagram of the steps of the lens component defect recognition method based on machine vision of the present invention;

[0018] Figure 2for Figure 1 Detailed step flow diagram of step S1;

[0019] Figure 3 for Figure 1 Detailed step flow chart of step S2 in FIG. DETAILED DESCRIPTION

[0020] 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.

[0021] 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.

[0022] 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.

[0023] To achieve this, please refer to Figures 1 to 3 The present invention provides a method for identifying defects of a lens assembly based on machine vision, the method comprising the following steps:

[0024] Step S1: collecting a surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; performing image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component;

[0025] Step S2: graying the standard image of the surface structure of the lens component to obtain a grayed image of the surface structure of the lens component; determining the structural defect points of the grayed image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segmenting the defect area of ​​the grayed image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a defect area image of the surface structure of the lens component;

[0026] Step S3: performing pixel-by-pixel feature vector conversion on the image of the surface structural defect area of ​​the lens component to obtain an image contour-grayscale feature vector of each pixel point in the surface structural defect area; obtaining a grayscale atlas of standard types of lens surface structural defects, and performing vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structural defect area based on the grayscale atlas of standard types of lens surface structural defects to obtain an image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type;

[0027] Step S4: performing defect type recognition analysis on the image of the lens component surface structure defect area based on the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type, and obtaining the lens component surface defect type recognition result.

[0028] In the embodiment of the present invention, please refer to Figure 1 FIG. 1 is a schematic diagram of the process flow of the lens component defect recognition method based on machine vision of the present invention. In this example, the lens component defect recognition method based on machine vision includes the following steps:

[0029] Step S1: collecting a surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; performing image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component;

[0030] In an embodiment of the present invention, a surface structure image of a lens component is collected by using a high-resolution machine vision system, wherein the machine vision system (including a high-resolution camera or sensor) is configured and calibrated to ensure that it can obtain a detailed image of the lens surface with high precision, thereby obtaining an original image of the surface structure of the lens component. At the same time, the corresponding original image of the surface structure of the lens component is de-noised by using a noise removal method including a filter or mathematical operation, such as a median filter, a Gaussian filter, or a wavelet transform, so as to eliminate any interference or noise introduced during the image acquisition process, and the original image of the surface structure of the lens component obtained after denoising is processed by using a histogram equalization method to enhance the contrast and brightness distribution of the image, so that the surface structure of the lens component can be more clearly discernible under different lighting conditions, and then, by using common edge enhancement techniques including using a sharpening filter, a gradient operation, or an edge detection algorithm (such as Sobel, Canny operator) to The edge details of the original image of the lens component surface structure after equalization are enhanced to highlight the edge and detail features in the lens component surface structure image, further enhancing the visualization effect of the lens component surface structure. The original image of the lens component surface structure obtained after edge enhancement is also registered by using a registration algorithm (such as feature point matching or area matching technology) to accurately align and match multiple images and ensure that the surface structure images of different lens components are spatially aligned and consistent, so that images acquired from different angles or different acquisition times can be accurately superimposed and fused, and finally a standard image of the lens component surface structure is obtained.

[0031] Step S2: graying the standard image of the surface structure of the lens component to obtain a grayed image of the surface structure of the lens component; determining the structural defect points of the grayed image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segmenting the defect area of ​​the grayed image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a defect area image of the surface structure of the lens component;

[0032] In an embodiment of the present invention, the corresponding illumination reflection change loss rate is calculated by using a metric based on pixel gradient, color difference or local contrast, etc., to quantify the reflection sensitivity of the corresponding lens component surface structure standard image, so as to quantitatively analyze the illumination reflection change sensitivity at each pixel, and divide the image into two areas of reflection sensitive and reflection dull. At the same time, according to the reflection sensitive area and reflection dull area of ​​the lens component structure image, firstly, by adjusting the illumination dynamic range of the illumination reflection sensitive area, this process aims to optimize the brightness and contrast in the sensitive area to ensure that it can show the integrity of color and details under various lighting conditions. Secondly, by performing illumination reflection compensation on the divided reflection dull area, this step aims to enhance the visibility and clarity of the dull area, making it more coordinated and natural in the overall image. The compensation method includes adjusting The brightness of pixels in the dull area is adjusted, the contrast is enhanced, or a specific color correction technique is applied to ensure the balance and visual consistency between the reflective dull area and the sensitive area. The adjusted illumination sensitive dynamic range area and the illumination reflection compensation area are fused for image area. The purpose of this step is to merge the processed image area into a single lens component surface structure illumination reflection sensing adjustment image. Then, the corresponding lens component surface structure illumination reflection sensing adjustment image is grayed by using a weighted average method or a color channel-based method to convert the color or multi-channel image into a grayscale image, wherein the brightness value of each pixel represents its intensity in the grayscale image. When processing the lens component surface structure illumination reflection sensing adjustment image, the weighted average method weights and averages the values ​​of the RGB color channels to obtain a single grayscale value. The formula can be expressed as: [grayscale value = 0.299 * R + 0.587 * G + 0.114*B], wherein (R, G, B) represent the pixel values ​​of the red, green, and blue channels, respectively, thereby obtaining a lens component surface structure grayscale image. The texture features of the grayscale image of the lens component surface structure are statistically analyzed by using commonly used texture feature analysis methods including grayscale co-occurrence matrix, local binary pattern, wavelet transform and the like, so as to extract and analyze the texture features of the surface structure from the grayscale image of the lens component surface structure, and determine the structural defect points of the corresponding grayscale image of the lens component surface structure, so as to analyze the areas with abnormal or irregular changes in texture features, and identify the positions of defective pixels, i.e., defect points, which usually indicate flaws, cracks or other undesirable structures on the surface, thereby obtaining the defect points of the lens component surface structure image.Finally, the defect point ranges of the previously determined defect points of the lens component surface structure image are merged by using a clustering algorithm based on neighborhood relationships, so as to merge adjacent and similar defect points into a larger defect area, and determine the outer contour and boundary of the defect area to apply a segmentation algorithm (such as threshold segmentation, region growing, boundary tracking, etc.) to the corresponding lens component surface structure grayscale image to segment the defect area, so as to separate the defect-related area in the image from the background, and finally generate a lens component surface structure defect area image.

[0033] Step S3: performing pixel-by-pixel feature vector conversion on the image of the surface structural defect area of ​​the lens component to obtain an image contour-grayscale feature vector of each pixel point in the surface structural defect area; obtaining a grayscale atlas of standard types of lens surface structural defects, and performing vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structural defect area based on the grayscale atlas of standard types of lens surface structural defects to obtain an image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type;

[0034] In an embodiment of the present invention, an edge detection algorithm (such as Sobel, Canny, etc.) is used to perform point-by-point contour recognition and analysis on each image pixel in the image of the surface structure defect area of ​​the lens component to identify the boundary contour of the pixel inside each defect area, and efficiently extract the edge information of each pixel in the image, including the position, shape, continuity and other features of the edge. At the same time, the grayscale value on each image pixel in the image of the surface structure defect area of ​​the lens component is extracted pixel by pixel, so that the grayscale value of each pixel is extracted, and the image contour features and image grayscale values ​​at each surface structure defect area pixel obtained by the previous analysis are converted into spatial feature vectors to merge the image contour features and grayscale values ​​at each pixel into a comprehensive feature vector. Representative defect type images are also extracted from known standard data sets or experimental samples, including images of defect types such as bubbles, scratches, cracks, and stains. These images are classified and labeled, have clear defect features and type classification information, and contain predefined defect images of different types. Similarly, by segmenting the pixels of each defect type grayscale image in the grayscale atlas of the standard types of lens surface structural defects, and analyzing the contour features and grayscale values ​​of the segmented pixel area images, the specific performance of each defect standard type in image contour and grayscale features is obtained, and at the same time, it is converted into a vector form, and the image contour-grayscale feature vector of each surface structural defect area pixel and the feature vector corresponding to each defect standard type are mapped in the same spatial coordinate system, and the spatial vector distance between the feature vector of each defect pixel to be inspected of each lens component and the feature vector of the pixel corresponding to each defect standard type in the same spatial coordinate system dimension is statistically calculated by using a mathematical similarity measurement method (such as cosine similarity, Euclidean distance, etc.), so as to quantitatively calculate the cumulative sum of the feature vector corresponding to each defect pixel to be inspected and the feature vector of the pixel corresponding to each defect standard type, and make it possible to reflect the total value of the feature similarity distance between each defect to be inspected and different defect types, and finally obtain the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type.

[0035] Step S4: performing defect type recognition analysis on the image of the lens component surface structure defect area based on the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type, and obtaining the lens component surface defect type recognition result.

[0036] In an embodiment of the present invention, the image feature similarity comprehensive distance value between the surface structural defects of the lens component and each standard defect type obtained by quantitative calculation previously is used as an indicator of defect type similarity, and a maximum value screening process is performed based on the determined image feature similarity between the surface structural defects of the lens component and each standard defect type, so as to analyze and compare the actual defect image on the surface of the lens component according to the similarity index obtained by the aforementioned calculation, and screen out the defect type corresponding to the largest image feature similarity value, including bubbles, scratches, cracks, stains, etc., and automatically or semi-automatically identify and classify which standard type of defect each defect area belongs to, and finally obtain the surface defect type recognition result of the lens component.

[0037] The present invention firstly uses a high-resolution machine vision system to collect surface structure images of lens components, and can obtain the original image data of the lens surface. These image data are the basis of production quality control and surface inspection, and accurately and comprehensively capture the structural features and details of the lens surface, thereby providing a reliable data basis for subsequent image processing and analysis. At the same time, by performing noise removal processing on the basis of the original image of the surface structure of the lens component, it is to eliminate the background noise or interference existing in the real-time collected lens component image, and also performs histogram equalization processing, which can enhance the image contrast and brightness distribution, so that the surface structure of the lens component can be more clearly distinguished under different lighting conditions, and by performing image registration processing on it, it can ensure that the surface structure images of different lens components are aligned and consistent in space, and the spatial position and angle deviation between images can be corrected by image registration, so that the surface structure images of each lens component can be effectively compared and analyzed, ensuring consistency and comparability in quality control and product evaluation. Secondly, by graying the standard image of the lens component surface structure, the main purpose is to convert the color or multi-channel image into a grayscale image. This processing step helps to simplify the subsequent image analysis and defect detection process, because the grayscale image eliminates the complexity of color information and focuses on the brightness changes and grayscale levels of the image. Through graying, the tiny structural features and defects on the lens surface can be analyzed more accurately. By determining the structural defect points of the grayscale image of the lens component surface structure, that is, identifying and marking the defect points of the lens component surface structure image based on the characteristics of the grayscale changes in the image, these defect points include structural problems such as cracks, bubbles, scratches, etc., and accurate point determination can provide accurate location information and shape description for quality control and further defect analysis. The defect area of ​​the grayscale image of the surface structure of the lens component is segmented based on the defect points of the surface structure image of the lens component, aiming to generate a defect area image of the surface structure of the lens component. This step uses the previously determined defect point information to separate the defect area from the overall image through image segmentation technology, so that the defect area can be observed and analyzed more clearly. The generated defect area image can not only be used for quantitative analysis and evaluation of lens quality, but also provide important guidance for subsequent repair or improvement work. Then, by performing pixel-by-pixel feature vector conversion on each image pixel in the defect area image of the surface structure of the lens component, this process aims to combine the contour features and grayscale information to construct a comprehensive feature vector for each pixel. The feature vector contains various structural information and grayscale information extracted from the image, and is represented in the form of a spatial feature vector, so that the comprehensive features of each pixel are more comparable and descriptive. These feature vectors are the basis for image similarity calculation and defect classification in subsequent steps, and can effectively distinguish different types of defects and perform quantitative analysis.By obtaining the standard type grayscale atlas of lens surface structural defects, this step usually involves extracting representative defect type images from known standard data sets or experimental samples. These images are classified and annotated, and have clear defect features and type classification information. The purpose of obtaining such a standard grayscale atlas is to establish a reference standard for defect classification. By comparing and calculating the similarity with the actual image features, various defect types of the surface structure of the lens component can be effectively identified. In addition, based on the standard type grayscale atlas of lens surface structural defects, the image contour-grayscale feature vector of each pixel point in the surface structural defect area is subjected to vector similarity comprehensive calculation. This calculation process will use mathematical similarity measurement methods (such as Euclidean distance, cosine similarity, etc.) to compare and evaluate the feature vector of each defect area with the standard type feature vector, thereby obtaining the image feature similarity comprehensive distance value between the surface structural defects of the lens component and each defect standard type. These distance values ​​reflect the similarity between each defect area and the standard type, and are an important basis for further identifying and classifying defects, thereby improving the accuracy and efficiency of defect type identification. Finally, by taking the image feature similarity comprehensive distance value between the surface structural defects of the lens component and each standard defect type as an indicator of defect type similarity, and based on the image feature similarity between the surface structural defects of the lens component and each standard defect type, the corresponding surface structural defect area image of the lens component is subjected to defect type identification and analysis. In this step, the actual defect image on the surface of the lens component is analyzed and compared according to the similarity index calculated above. By comparing the image feature similarity values, it is possible to automatically or semi-automatically identify and classify which standard type of defect each defect area belongs to. This automated identification and analysis process greatly improves the efficiency and accuracy of defect detection, reduces the subjectivity and errors of human judgment, and can provide strong support for the production quality control of lens components, thereby meeting the needs of large-scale production and high-precision defect identification and detection.

[0038] Preferably, step S1 comprises the following steps:

[0039] Step S11: collecting a surface structure image of the lens assembly through a high-resolution machine vision system to obtain an original image of the surface structure of the lens assembly;

[0040] Step S12: performing noise removal processing on the original image of the surface structure of the lens assembly to obtain a noise-removed image of the surface structure of the lens assembly;

[0041] Step S13: performing histogram equalization processing on the denoised image of the lens component surface structure to obtain a lens component surface structure equalized image;

[0042] Step S14: performing edge detail enhancement processing on the equalized image of the lens component surface structure to obtain an edge enhanced image of the lens component surface structure;

[0043] Step S15: performing image registration processing on the edge enhanced image of the lens component surface structure to obtain a standard image of the lens component surface structure.

[0044] As an embodiment of the present invention, refer to Figure 2 As shown, Figure 1 Detailed step flow diagram of step S1 in FIG. 1 , in this embodiment, step S1 includes the following steps:

[0045] Step S11: collecting a surface structure image of the lens assembly through a high-resolution machine vision system to obtain an original image of the surface structure of the lens assembly;

[0046] In an embodiment of the present invention, a surface structure image of a lens assembly is collected by using a high-resolution machine vision system, wherein the machine vision system (including a high-resolution camera or sensor) is configured and calibrated to ensure that it can obtain detailed images of the lens surface with high precision and capture subtle surface features and structures, and the lens assembly is placed at a fixed position and angle to ensure that the image collected each time remains consistent and comparable, thereby obtaining the original image data of the lens surface and ultimately obtaining the original image of the surface structure of the lens assembly.

[0047] Step S12: performing noise removal processing on the original image of the surface structure of the lens assembly to obtain a noise-removed image of the surface structure of the lens assembly;

[0048] In an embodiment of the present invention, noise is removed from the corresponding original image of the surface structure of the lens component by using a noise removal method including a filter or mathematical operation, such as median filtering, Gaussian filtering or wavelet transform, so as to eliminate any interference or noise introduced during the image acquisition process, such as sensor noise, the influence of ambient light or electronic noise, and finally obtain a denoised image of the surface structure of the lens component.

[0049] Step S13: performing histogram equalization processing on the denoised image of the lens component surface structure to obtain a lens component surface structure equalized image;

[0050] In an embodiment of the present invention, a denoised image of the surface structure of a lens component obtained after denoising is processed by using a histogram equalization method, wherein histogram equalization is a method for enhancing image contrast and brightness distribution, so as to enhance the contrast and brightness distribution of an image, so that the surface structure of the lens component can be more clearly discernible under different lighting conditions, thereby enabling the image to be visually more layered and detailed, including calculating the histogram of the image, and remapping the pixel values ​​according to its brightness distribution, and finally obtaining a balanced image of the surface structure of the lens component.

[0051] Step S14: performing edge detail enhancement processing on the equalized image of the lens component surface structure to obtain an edge enhanced image of the lens component surface structure;

[0052] In an embodiment of the present invention, common edge enhancement techniques including sharpening filters, gradient operations or edge detection algorithms (such as Sobel and Canny operators) are used to enhance the edge details of the corresponding lens component surface structure equalized image to highlight the edge and detail features in the lens component surface structure image, further enhance the visualization effect of the lens component surface structure, thereby making the edge lines in the lens surface structure clearer and more obvious, and finally obtaining an edge enhanced image of the lens component surface structure.

[0053] Step S15: performing image registration processing on the edge enhanced image of the lens component surface structure to obtain a standard image of the lens component surface structure.

[0054] In an embodiment of the present invention, a registration algorithm (such as feature point matching or area matching techniques) is used to perform image registration on the edge enhanced images of the surface structure of the lens component obtained after edge enhancement, so as to accurately align and match multiple images, and ensure that the surface structure images of different lens components are spatially aligned and consistent, so that images acquired from different angles or at different acquisition times can be accurately superimposed and fused, and finally a standard image of the surface structure of the lens component is obtained.

[0055] The present invention firstly acquires the original image data of the lens surface by using a high-resolution machine vision system to collect the surface structure image of the lens assembly. These image data are the basis of production quality control and surface inspection. By accurately and comprehensively capturing the structural features and details of the lens surface, a reliable data basis is provided for subsequent image processing and analysis. Secondly, by performing noise removal processing on the basis of the original image of the surface structure of the lens assembly, the background noise or interference existing in the real-time collected lens assembly image is eliminated, so as to obtain a clear and accurate denoised image reflecting the real structure of the lens surface. The key to this step is to improve the signal-to-noise ratio of the image, reduce the error in the subsequent processing process, and ensure that the analyzed image data has high quality and reliability. Then, by performing histogram equalization processing on the denoised image of the surface structure of the lens assembly, the contrast and brightness distribution of the image can be enhanced, so that the surface structure of the lens assembly can be more clearly discernible under different lighting conditions. The histogram equalization adjusts the contrast distribution of the image, so that the image is more visually rich in layers and details, which is helpful for subsequent image analysis and feature extraction. Next, edge detail enhancement processing is performed on the basis of the equalized image to highlight the edge and detail features in the surface structure image of the lens component. This enhancement can make the edges in the image clearer and more obvious, which helps to further analyze the microstructure and surface defects of the lens surface, thereby providing more accurate data support for quality control and product evaluation. Finally, by performing image registration processing on the edge-enhanced image of the surface structure of the lens component, the surface structure images of different lens components can be spatially aligned and consistent. Image registration can correct the spatial position and angle deviation between images, so that the surface structure images of each lens component can be effectively compared and analyzed, ensuring consistency and comparability in quality control and product evaluation.

[0056] Preferably, step S2 comprises the following steps:

[0057] Step S21: performing a quantitative calculation of the light reflection sensitivity of pixels on the standard image of the lens component surface structure to obtain the light reflection change sensitivity of each pixel in the lens component structure image;

[0058] Step S22: segmenting the standard image of the surface structure of the lens component into reflection-sensitive regions based on the sensitivity of each pixel point in the structure image of the lens component to obtain the light reflection-sensitive region of the structure image of the lens component and the light reflection-insensitive region of the structure image of the lens component;

[0059] Step S23: adjusting the illumination dynamic range of the illumination reflection sensitive area of ​​the lens component structure image to obtain the illumination sensitive dynamic range adjustment area of ​​the lens component structure image; performing illumination reflection compensation on the illumination reflection dull area of ​​the lens component structure image to obtain the illumination reflection compensation area of ​​the lens component structure image; performing image region fusion on the illumination sensitive dynamic range adjustment area of ​​the lens component structure image and the illumination reflection compensation area of ​​the lens component structure image to obtain the illumination reflection sensing adjustment image of the lens component surface structure;

[0060] Step S24: performing image grayscale processing on the lens component surface structure light reflection sensing adjustment image to obtain a lens component surface structure grayscale image;

[0061] Step S25: determining the structural defect points of the grayscale image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segmenting the defect area of ​​the grayscale image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a surface structure defect area image of the lens component.

[0062] As an embodiment of the present invention, refer to Figure 3 As shown, Figure 1 Detailed step flow diagram of step S2 in FIG. 1 , in this embodiment, step S2 includes the following steps:

[0063] Step S21: performing a quantitative calculation of the light reflection sensitivity of pixels on the standard image of the lens component surface structure to obtain the light reflection change sensitivity of each pixel in the lens component structure image;

[0064] In an embodiment of the present invention, the corresponding illumination reflection change loss rate is calculated by using a metric based on pixel gradient, color difference or local contrast, and the reflection sensitivity of the corresponding lens component surface structure standard image is quantitatively calculated to quantitatively analyze the sensitivity of illumination reflection change at each pixel, and understand the response degree of different areas in the image to illumination change. The brightness and color changes of the surrounding pixels are also considered to determine the reaction sensitivity of the corresponding pixel under illumination change, and finally the sensitivity of illumination reflection change at each pixel in the lens component structure image is obtained.

[0065] Step S22: segmenting the standard image of the surface structure of the lens component into reflection-sensitive regions based on the sensitivity of each pixel point in the structure image of the lens component to obtain the light reflection-sensitive region of the structure image of the lens component and the light reflection-insensitive region of the structure image of the lens component;

[0066] In an embodiment of the present invention, by combining the sensitivity of light reflection changes at each pixel point in the lens component structure image obtained by previous quantitative calculation, commonly used segmentation techniques including threshold segmentation, edge detection or pixel clustering-based methods are used to segment the reflection sensitive area of ​​the corresponding lens component surface structure standard image, so as to divide the image into two areas of reflection sensitive and reflection dull. According to the sensitivity value calculated previously, a threshold or segmentation algorithm is applied to determine which areas belong to the reflection sensitive area and which areas belong to the reflection dull area, and finally the light reflection sensitive area of ​​the lens component structure image and the light reflection dull area of ​​the lens component structure image are obtained.

[0067] Step S23: adjusting the illumination dynamic range of the illumination reflection sensitive area of ​​the lens component structure image to obtain the illumination sensitive dynamic range adjustment area of ​​the lens component structure image; performing illumination reflection compensation on the illumination reflection dull area of ​​the lens component structure image to obtain the illumination reflection compensation area of ​​the lens component structure image; performing image region fusion on the illumination sensitive dynamic range adjustment area of ​​the lens component structure image and the illumination reflection compensation area of ​​the lens component structure image to obtain the illumination reflection sensing adjustment image of the lens component surface structure;

[0068] In the embodiment of the present invention, by further processing the reflection sensitive area and the reflection dull area of ​​the lens component structure image, first, by adjusting the illumination dynamic range of the illumination reflection sensitive area, this process aims to optimize the brightness and contrast in the sensitive area to ensure that it can show the integrity of color and details under various illumination conditions. The typical processing method includes dynamic range compression or stretching of the pixel values ​​in the sensitive area to adapt to the image display requirements under different illumination conditions, thereby obtaining the illumination sensitive dynamic range adjustment area of ​​the lens component structure image. At the same time, by performing illumination reflection compensation on the divided reflection dull area, this step aims to enhance the visibility and clarity of the dull area, making it more coordinated and natural in the overall image. The compensation method includes adjusting the brightness of the pixels in the dull area, enhancing the contrast or applying a specific color correction technology to ensure the balance and visual consistency between the reflection dull area and the sensitive area, thereby obtaining the illumination reflection compensation area of ​​the lens component structure image. Finally, the adjusted illumination sensitive dynamic range area and illumination reflection compensation area are subjected to image region fusion. The purpose of this step is to merge the processed image areas into a single lens component surface structure illumination reflection sensing adjustment image. Regional fusion usually involves pixel-level mixing or weighted combination to ensure that the transition between each area is natural and seamless, and has a good visual integration effect, thereby ensuring the visual consistency and naturalness of the subsequent grayscale processing of the image, and finally obtaining the lens component surface structure illumination reflection sensing adjustment image.

[0069] Step S24: performing image grayscale processing on the lens component surface structure light reflection sensing adjustment image to obtain a lens component surface structure grayscale image;

[0070] In an embodiment of the present invention, a weighted averaging method or a color channel-based method is used to grayscale the corresponding lens component surface structure illumination reflection sensing adjustment image to convert a color or multi-channel image into a grayscale image, wherein the brightness value of each pixel represents its intensity in the grayscale image. When processing the lens component surface structure illumination reflection sensing adjustment image, the weighted averaging method weights and averages the values ​​of the RGB color channels to obtain a single grayscale value. The formula can be expressed as: [grayscale value = 0.299 * R + 0.587 * G + 0.114*B], wherein (R, G, B) represent the pixel values ​​of the red, green and blue channels, respectively, and finally a grayscale image of the lens component surface structure is obtained.

[0071] Step S25: determining the structural defect points of the grayscale image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segmenting the defect area of ​​the grayscale image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a surface structure defect area image of the lens component.

[0072] In an embodiment of the present invention, a statistical analysis of texture features is performed on a grayscale image of the surface structure of a lens component by using commonly used texture feature analysis methods including grayscale co-occurrence matrix, local binary pattern, wavelet transform and the like, so as to extract and analyze the texture features of the surface structure from the grayscale image of the surface structure of the lens component, including texture feature information such as grayscale changes, directionality, and frequency of local pixels, and to determine the structural defect points of the corresponding grayscale image of the surface structure of the lens component, so as to analyze areas with abnormal or irregular changes in texture features, and identify the positions of defective pixels, i.e., defect points, which usually indicate flaws, cracks or other undesirable structures on the surface, thereby obtaining the defect points of the surface structure image of the lens component. At the same time, the defect point ranges of the previously determined defect points of the lens component surface structure image are merged by using a clustering algorithm based on neighborhood relationships, so as to merge the detected discrete defect points according to the spatial relationship between them, so as to merge adjacent and similar defect points into a larger defect area, and determine the outer contour and boundary of the defect area to apply a segmentation algorithm (such as threshold segmentation, region growing, boundary tracking, etc.) to the corresponding lens component surface structure grayscale image to segment the defect area, so as to separate the defect-related area in the image from the background, thereby generating a defect area image with high contrast and clarity, and finally generating a lens component surface structure defect area image.

[0073] The present invention first performs a quantitative calculation of the illumination reflection sensitivity of the pixel points on the standard image of the lens component surface structure, which means that by analyzing the sensitivity of each pixel point in the image to the illumination reflection change, the response characteristics of the lens surface structure under different illumination conditions can be determined. This calculation can provide a basis for subsequent image processing and ensure accurate adjustment and optimization for illumination conditions. The standard image of the lens component surface structure is segmented into reflection sensitive areas based on the sensitivity of each pixel point in the lens component structure image to clearly divide it into illumination reflection sensitive areas and reflection dull areas. This segmentation can not only help identify the reflection characteristics of different areas on the lens surface, but also help with subsequent local processing and optimization to ensure balanced and consistent illumination effects at different locations. The illumination dynamic range of the illumination reflection sensitive area of ​​the lens component structure image is also adjusted to optimize the illumination effect of the sensitive area in the lens component structure image. Through dynamic range adjustment, it can be ensured that the brightness and contrast of the sensitive area maintain a suitable visual effect under different illumination conditions, thereby improving the visual quality and expressiveness of the image. At the same time, by performing light reflection compensation on the areas with dull light reflection of the lens component structure image, the aim is to make up for the insufficient or uneven light in these areas. Through compensation processing, the brightness and color of the dull areas can be adjusted to keep the visual effect consistent with other parts, and improve the balance and integrity of the overall image, thereby providing basic data guarantee for the subsequent grayscale processing process. The image areas that have undergone light dynamic range adjustment and light reflection compensation processing are also merged. This step not only integrates the optimization effects of different processing areas, but also ensures the visual consistency and naturalness of the image, thereby providing optimized image output for the subsequent grayscale processing process. Secondly, by performing image grayscale processing on the image of the light reflection sensing adjustment of the surface structure of the lens component, the main purpose is to convert the color or multi-channel image into a grayscale image. This processing step helps to simplify the subsequent image analysis and defect detection process, because the grayscale image eliminates the complexity of color information and focuses on the brightness change and grayscale level of the image. Through grayscale, the tiny structural features and defects on the surface of the lens can be analyzed more accurately. Then, the structural defect points are determined by the grayscale image of the surface structure of the lens component. That is, the defect points of the surface structure image of the lens component are identified and marked based on the characteristics of the grayscale changes in the image. These defect points include structural problems such as cracks, bubbles, scratches, etc. Through precise point determination, accurate location information and shape description can be provided for quality control and further defect analysis.Finally, the defect area of ​​the grayscale image of the lens component surface structure is segmented based on the defect points of the lens component surface structure image, aiming to generate a defect area image of the lens component surface structure. This step utilizes the previously determined defect point information to separate the defect area from the overall image through image segmentation technology, so that the defect area can be more clearly observed and analyzed. The generated defect area image can not only be used for quantitative analysis and evaluation of lens quality, but also provide important guidance for subsequent repair or improvement work.

[0074] Preferably, step S21 includes the following steps:

[0075] Step S211: segmenting the standard image of the lens component surface structure into pixels to obtain a pixel region image of each lens component surface structure;

[0076] In an embodiment of the present invention, image pixel segmentation is performed on the corresponding standard image of the surface structure of the lens component by using image processing techniques, such as threshold segmentation, edge detection, region growing and the like, so as to segment the entire standard image of the surface structure of the lens component into multiple pixel region images, each pixel region image represents a small area on the lens surface, and finally each pixel region image of the surface structure of the lens component is obtained.

[0077] Step S212: performing illumination condition inference estimation on the image of each pixel point area of ​​the surface structure of each lens component to obtain illumination estimation conditions of each pixel point area of ​​the lens component;

[0078] In an embodiment of the present invention, the lighting conditions are estimated by inferring the image of the pixel area of ​​the surface structure of each lens component. This process involves inferring the approximate lighting conditions of each area based on influencing factors such as the brightness, color of the pixels in the image and the intensity of the surrounding light, where the lighting conditions may include information such as light intensity, light source direction, and light source type, and ultimately the lighting estimation conditions of each pixel area of ​​the lens component are obtained.

[0079] Step S213: dynamically changing constraint design is performed on the illumination estimation conditions of each lens component pixel area to obtain the illumination dynamic change range constraint conditions of each lens component pixel area;

[0080] In an embodiment of the present invention, a dynamic change constraint design is performed on the illumination estimation conditions of each pixel area of ​​a lens component. The purpose of this step is to design and set the illumination dynamic change range constraint conditions for each pixel area based on the illumination estimation information obtained in the first two steps. The design of the dynamic change constraint needs to take into account the characteristics of the lens surface structure and the existing external illumination changes. The dynamic constraint conditions may include the speed and amplitude of illumination change, and the change pattern in different time periods, etc., and finally the illumination dynamic change range constraint conditions for each pixel area of ​​the lens component are obtained.

[0081] Step S214: Calculating the pixel reflection loss of each lens component surface structure pixel area image based on the illumination dynamic change range constraint condition of each lens component pixel area, so as to obtain the illumination reflection change loss rate at each lens component surface structure pixel area;

[0082] In an embodiment of the present invention, the loss of pixel reflectivity is calculated for each corresponding pixel area image of the surface structure of the lens component by combining the dynamic range constraint of illumination of each pixel area of ​​the lens component obtained by previous analysis. In this step, the reflection characteristics of each pixel area under different illumination conditions are analyzed by using a physical model or a mathematical calculation method. Specifically, the surface reflectivity, illumination direction, and incident angle of each pixel are considered to calculate the loss rate of reflected light under different illumination conditions. These loss rates reflect the visual impact of illumination changes on the lens surface structure, and finally the loss rate of illumination reflection change at each pixel area of ​​the surface structure of the lens component is obtained.

[0083] Step S215: quantify the light reflection change sensitivity of each lens component surface structure pixel area image according to the light reflection change loss rate at each lens component surface structure pixel area, and obtain the light reflection change sensitivity at each pixel point in the lens component structure image.

[0084] In an embodiment of the present invention, the sensitivity to light reflection changes is quantitatively calculated for each corresponding pixel area image of the surface structure of the lens component by combining the light reflection change loss rate at each pixel area of ​​the lens component surface structure obtained by previous quantitative calculation, so as to quantify the sensitivity of each pixel point to light changes, that is, its response degree to light reflection characteristics under different lighting conditions, thereby helping to identify the area that is most sensitive to lighting conditions, and finally obtaining the sensitivity to light reflection changes at each pixel point in the lens component structure image.

[0085] The present invention first performs image pixel segmentation on the standard image of the surface structure of the lens component to analyze and process the color, brightness and surrounding environment of each pixel, so that the image can be segmented into multiple specific pixel areas. The key to this step is to accurately capture the structural details of the lens surface, ensuring that the subsequent illumination condition inference and dynamic change constraints can be accurately operated at the fine-grained pixel level. Through pixel segmentation, complex surface structures can be effectively processed to provide an accurate data basis for subsequent illumination analysis. Secondly, by performing illumination condition inference and estimation on the image of the pixel area of ​​the surface structure of each lens component, the illumination environment and conditions of each pixel area are obtained. This inference process infers the illumination conditions of each area in the image based on the grayscale level, brightness and other characteristics of each area, including factors such as light intensity and light source direction. The accuracy of illumination inference directly affects the effectiveness of the subsequent illumination dynamic change constraint design, and is an important prerequisite for ensuring the accuracy of the calculation of the illumination reflection change loss rate. Then, the illumination estimation conditions of each lens component pixel area are dynamically changed to determine the range constraint of each area's illumination dynamic change. This step takes into account the changes in the reflection characteristics of the lens surface under different illumination conditions, and formulates dynamic illumination change constraints to ensure that the changes in light reflection under different illumination environments can be effectively dealt with in practical applications. The accuracy and rationality of the dynamic change constraint design are crucial for the subsequent calculation of the loss rate of illumination reflection change, and lay a solid foundation for the quantification of illumination sensitivity. Next, the pixel reflection loss of the surface structure pixel area image is calculated according to the illumination dynamic change range constraint of each lens component pixel area. This step combines the dynamically changing illumination constraint conditions to accurately calculate the light reflection change loss rate of each pixel area under specific illumination conditions. The calculation basis of the loss rate includes factors such as light reflectivity and surface roughness, thereby providing a detailed description of the light reflection characteristics of the lens component surface structure. Finally, the sensitivity to light reflection changes of each pixel area image of the lens component surface structure is quantified according to the light reflection change loss rate at the pixel area of ​​the surface structure of each lens component. This step aims to quantify the sensitivity of each pixel to light changes, that is, its response to light reflection characteristics under different lighting conditions. By quantifying the sensitivity to light reflection changes, detailed quantitative data can be provided for the analysis of the optical properties of the lens components, thereby supporting the optimization and improvement of product design and quality control.

[0086] Preferably, step S214 includes the following steps:

[0087] The illumination change is divided frame by frame according to the illumination dynamic change range constraint condition of each lens component pixel point area, and the time-series frame by frame illumination intensity change value of each lens component pixel point area is obtained;

[0088] In an embodiment of the present invention, the corresponding dynamic range constraint conditions of illumination are divided frame by frame for the pixel area of ​​each lens component, so that the illumination conditions of each pixel area of ​​the lens component are divided into different frames in a time series, so as to capture and record the changes in illumination intensity in the time dimension. This means that it is necessary to first define the range and conditions of illumination changes, such as under what circumstances it is considered that the illumination has changed significantly, and then divide the entire video or sequence image frame by frame, so that frame-by-frame illumination intensity change values ​​can be obtained for each pixel area. These values ​​correspond to the illumination intensity of the pixel area at each moment, and can reflect the changes in image pixels under different illumination conditions, and finally obtain the time-series frame-by-frame illumination intensity change values ​​for each pixel area of ​​the lens component.

[0089] Preferably, based on the time-series frame-by-frame illumination intensity variation value of each lens component pixel area, the illumination reflection analysis of each lens component surface structure pixel area image is performed to obtain the optical reflection response process of the surface structure image of each lens component pixel area in each time-series frame;

[0090] In an embodiment of the present invention, by combining the time-series frame-by-frame illumination intensity change values ​​of each lens component pixel area previously divided, a frame-by-frame illumination reflection analysis is performed on the corresponding pixel area image of the surface structure of each lens component, so as to analyze the optical reflection response process of each pixel area at different moments, that is, the change in the reflection characteristics of the lens surface structure under different illumination conditions, and describe in detail the dynamic reflection behavior of the pixel area of ​​the lens component during the illumination change process, so as to help understand and describe the visual changes of each pixel area under different illumination, and finally obtain the optical reflection response process of the surface structure image of each pixel area of ​​the lens component at each time frame.

[0091] Preferably, the incident angle and reflection angle measurement process of the surface structure image optical reflection response process of each lens component pixel area in each time sequence frame is performed to obtain the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time sequence frame;

[0092] In an embodiment of the present invention, computer vision technology is used in combination with image processing algorithms to achieve this, such as edge detection, angle estimation or feature point matching methods to measure the incident angle and reflection angle of the optical reflection response process of the surface structure image of each pixel area at each moment. This involves measuring the incident light angle and reflected light angle of each pixel area in the image. The incident angle usually refers to the angle at which light reaches the pixel from the light source, and the reflection angle refers to the angle at which light is reflected from the pixel, so as to understand the incidence and reflection of light on the surface, and finally obtain the image illumination incident angle and image illumination reflection angle of each pixel area of ​​the lens component in each time frame.

[0093] Preferably, the pixel reflection loss of each lens component surface structure pixel area image is calculated based on the image light incident angle and the image light reflection angle of each lens component pixel area in each time frame, so as to obtain the light reflection change loss rate at each lens component surface structure pixel area.

[0094] In an embodiment of the present invention, by combining the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time frame obtained by previous measurement, a pixel reflectivity loss calculation is performed on the corresponding image of each lens component surface structure pixel area using techniques including ray tracing based on a physical model, reflectivity estimation or statistical analysis, so as to evaluate the reflection loss rate of each pixel area during the illumination change process, wherein the reflection loss rate refers to the loss ratio of reflected light due to the characteristics of the surface structure when the illumination conditions change, thereby quantitatively analyzing the reflection loss of each pixel area under different illumination conditions, and finally obtaining the illumination reflection change loss rate at each lens component surface structure pixel area.

[0095] The present invention first divides the illumination changes frame by frame by the constraints of the illumination dynamic change range of each lens component pixel area. This step focuses on dividing the illumination conditions of each lens component pixel area into different frames according to the time series to capture and record the changes in illumination intensity in the time dimension. Through frame-by-frame division, the illumination change characteristics of the lens surface in different time periods can be accurately grasped, providing a time series data basis for subsequent illumination reflection analysis. Secondly, based on the time-series frame-by-frame illumination intensity change value of each lens component pixel area, the illumination frame-by-frame reflection analysis of each lens component surface structure pixel area image is performed. This step aims to analyze the optical reflection response process of each pixel area at different times, that is, the reflection characteristics of the lens surface structure change under different illumination conditions. Through the illumination frame-by-frame reflection analysis, the dynamic reflection behavior of the lens component pixel area during the illumination change process can be described in detail, providing an in-depth perspective and data support for understanding and optimizing the optical performance of the lens surface. Then, the incident angle and reflection angle are measured for the optical reflection response process of the surface structure image of each lens component pixel area in each time frame. The main purpose of this step is to measure the incident angle and reflection angle of the light on the lens surface in each time frame, so as to understand the incidence and reflection of light on the surface. By accurately measuring the incident and reflection angles, the optical behavior of the lens component in actual use can be more accurately simulated and analyzed, providing the necessary angle information support for the calculation of the light reflection change loss rate. Finally, the pixel reflection loss is calculated for each lens component surface structure pixel area image based on the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time frame. This step uses the measured illumination angle data to calculate the illumination reflection change loss rate of each pixel area at different times. The calculation of the reflection loss rate takes into account factors such as the incident angle, reflection angle, and surface characteristics, thereby providing a quantitative result that accurately describes the change in the optical performance of the lens component.

[0096] Preferably, step S25 comprises the following steps:

[0097] Step S251: performing structural texture feature analysis on the grayscale image of the lens component surface structure to obtain structural texture feature data of the lens component surface structure;

[0098] In an embodiment of the present invention, a statistical analysis of texture features of a grayscale image of the surface structure of a lens component is performed by using commonly used analysis methods including grayscale co-occurrence matrix, local binary pattern, wavelet transform, etc., so as to extract and analyze the texture features of the surface structure from the grayscale image of the surface structure of the lens component, including texture feature information such as grayscale changes, directionality, frequency, etc. of local pixels, and finally obtain texture feature data of the surface structure of the lens component.

[0099] Step S252: determining the structural defect points of the grayscale image of the surface structure of the lens component based on the surface structure texture feature data of the lens component, and obtaining the defect points of the surface structure image of the lens component;

[0100] In an embodiment of the present invention, the structural defect points of the corresponding lens component surface structure grayscale image are determined by combining the lens component surface structure texture feature data obtained in the previous analysis to analyze the areas where the texture features are abnormal or irregularly changed, and identify the positions of defective pixels, that is, defect points. These defect points usually indicate flaws, cracks or other undesirable structures on the surface, and finally the defect points of the lens component surface structure image are obtained.

[0101] Step S253: merging the defect point range of the defect point of the lens component surface structure image to obtain a lens component surface structure defect point merged area;

[0102] In an embodiment of the present invention, a clustering algorithm based on neighborhood relationships is used to merge the defect point ranges of the previously determined defect points in the surface structure image of the lens component, so as to merge the detected discrete defect points according to the spatial relationship between them, and merge adjacent and similar defect points into a larger defect area, thereby forming a defect area with more practical significance and operability, and finally obtaining a merged area of ​​defect points on the surface structure of the lens component.

[0103] Step S254: performing a region size and shape analysis on the lens component surface structure defect point merged region to obtain the size of the lens component surface structure defect region and the shape of the lens component surface structure defect region; performing region boundary positioning processing on the lens component surface structure defect point merged region based on the size of the lens component surface structure defect region and the shape of the lens component surface structure defect region to obtain the boundary distribution range of the lens component surface structure defect region;

[0104] In the embodiment of the present invention, the size and shape of the merged region of the lens component surface structure defect points obtained by merging previously are statistically analyzed by using a mathematical statistical method, so as to analyze and examine the geometric features of the defect region, such as the area, perimeter, and shape, to quantify the size and shape characteristics of each defect region, thereby obtaining the size of the lens component surface structure defect region and the shape of the lens component surface structure defect region. At the same time, by combining the size of the lens component surface structure defect region and the shape of the lens component surface structure defect region obtained by the previous analysis, the corresponding lens component surface structure defect point merged region is identified and analyzed by using morphological operations, edge detection algorithms, or curve fitting techniques, so as to accurately locate the boundary distribution range of the defect region, that is, to determine the outer contour and boundary of the defect region, and finally obtain the boundary distribution range of the lens component surface structure defect region.

[0105] Step S255: segmenting the defective regions of the grayscale image of the surface structure of the lens component based on the boundary distribution range of the defective regions of the surface structure of the lens component to generate an image of the defective regions of the surface structure of the lens component.

[0106] In an embodiment of the present invention, a segmentation algorithm (such as threshold segmentation, region growing, boundary tracking, etc.) is applied to the corresponding grayscale image of the lens component surface structure in combination with the previously determined distribution range of the boundary of the defect area of ​​the lens component surface structure to segment the defect area, so as to separate the defect-related area in the image from the background, thereby generating a defect area image with high contrast and clarity, and finally generating an image of the defect area of ​​the lens component surface structure.

[0107] The present invention first analyzes the structural texture features of the grayscale image of the surface structure of the lens component, mainly by calculating the texture features of each area in the image, such as the grayscale co-occurrence matrix, the directional gradient histogram, etc., to describe the microscopic morphology and texture distribution characteristics of the surface structure. These feature data can not only reflect the physical properties of the surface such as roughness and granularity, but also provide quantitative basic data for subsequent defect detection and positioning. At the same time, the structural defect points of the grayscale image of the surface structure of the lens component are determined based on the texture feature data of the surface structure of the lens component. This step analyzes the areas with abnormal or irregular changes in texture features to identify the locations of defective pixels, that is, defect points. These defect points usually indicate flaws, cracks or other undesirable structures on the surface, which are the key starting points for further evaluation and processing. Secondly, by merging the defect point range of the initially determined defect points of the lens component surface structure image to obtain a larger defect point merged area, this step aims to merge adjacent and similar defect points into a larger area, thereby forming a more practical and operational defect area. The merged area is more conducive to subsequent analysis and processing, and can effectively reduce misidentification and improve the accuracy of defect detection. Then, by further analyzing the area size and shape of the merged lens component surface structure defect point merged area, this analysis examines the geometric features such as the area, perimeter, and shape of the defect area to quantify and describe the specific characteristics of the defect. Through these data, the severity and morphological characteristics of the defect can be evaluated, providing a detailed reference for subsequent repair or improvement. Next, the lens component surface structure defect point merged area is processed by regional boundary positioning based on the size of the lens component surface structure defect area and the shape of the lens component surface structure defect area. This step focuses on accurately locating the boundary distribution range of the defect area, that is, determining the outer contour and boundary of the defect area. Through accurate boundary positioning, the defect area can be effectively distinguished from the surrounding normal structure, providing a basis for subsequent segmentation and analysis. Finally, the defect area of ​​the grayscale image of the lens component surface structure is segmented based on the boundary distribution range of the defect area on the lens component surface structure. This step will mark the defect area in the image and generate a defect area image with high contrast and clarity. These images can intuitively display the defects of the surface structure, thereby providing important visual feedback and quantitative data support for quality control and process optimization.

[0108] Preferably, step S3 comprises the following steps:

[0109] Step S31: performing pixel-by-pixel contour recognition and analysis on each image pixel point in the image of the surface structural defect area of ​​the lens component to obtain image contour feature data at each pixel point in the surface structural defect area;

[0110] In an embodiment of the present invention, an edge detection algorithm (such as Sobel, Canny, etc.) is used to perform point-by-point contour recognition analysis on each image pixel in the image of the surface structure defect area of ​​the lens component to identify the boundary contour of the pixel points inside each defect area, and efficiently extract the edge information of each pixel point in the image, including the position, shape, continuity and other features of the edge, thereby helping to identify the boundary of the defect area, forming a contour composed of a series of continuous pixels, and finally obtaining the image contour feature data at the pixel points of each surface structure defect area.

[0111] Step S32: performing pixel-by-pixel grayscale value extraction processing on each image pixel point in the image of the surface structural defect area of ​​the lens component to obtain the image grayscale value at each pixel point in the surface structural defect area;

[0112] In an embodiment of the present invention, the grayscale value of each image pixel in the image of the surface structure defect area of ​​the lens component is extracted point by point, so that the grayscale value of each pixel is extracted and stored as numerical data. These grayscale values ​​reflect the brightness or color intensity of different pixels in the defect area, and finally the image grayscale value at each pixel in the surface structure defect area is obtained.

[0113] Step S33: performing spatial feature vector conversion on the image contour feature data and the image grayscale value at each pixel point in the surface structural defect area to obtain the image contour-grayscale feature vector of each pixel point in the surface structural defect area;

[0114] In an embodiment of the present invention, the image contour feature data and image grayscale values ​​at each pixel point in the surface structure defect area obtained by previous analysis are converted into spatial feature vectors to merge the image contour features and grayscale values ​​at each pixel point into a comprehensive feature vector. The spatial feature vector may include a geometric description of the contour features and numerical information of the grayscale values, which is used to more comprehensively characterize the visual features of each defective pixel point, and finally the image contour-grayscale feature vector of each pixel point in the surface structure defect area is obtained.

[0115] Step S34: obtaining a grayscale atlas of standard types of lens surface structural defects;

[0116] In an embodiment of the present invention, representative defect type images, including images of defect types such as bubbles, scratches, cracks, and stains, are extracted from known standard data sets or experimental samples. These images are classified and labeled, and have clear defect characteristics and type classification information. They include predefined defect images of different types, which are used as reference data sets for comparison and analysis. The image sets obtained from these collections are an important basis for training and verifying defect recognition algorithms, and ultimately a grayscale atlas of standard types of lens surface structural defects is obtained.

[0117] Step S35: Based on the grayscale atlas of standard types of lens surface structural defects, a vector similarity comprehensive calculation is performed on the image contour-grayscale feature vector of each pixel point in the surface structural defect area to obtain the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type.

[0118] In an embodiment of the present invention, pixel points of each defect type grayscale image in the grayscale atlas of standard types of lens surface structural defects are segmented, and contour features and grayscale values ​​of the segmented pixel area images are analyzed to obtain the specific performance of each defect standard type in image contour and grayscale features, and convert them into vector form at the same time. The image contour-grayscale feature vector of each surface structural defect area pixel and the feature vector corresponding to each defect standard type are mapped in the same spatial coordinate system, and the spatial vector distance between the feature vector of each defect pixel to be inspected of each lens component and the feature vector of the pixel corresponding to each defect standard type in the same spatial coordinate system dimension is statistically calculated by using a mathematical similarity measurement method (such as cosine similarity, Euclidean distance, etc.), so as to quantitatively calculate the cumulative sum of the feature vector corresponding to each defect pixel to be inspected and the feature vector of the pixel corresponding to each defect standard type, and make it possible to reflect the total value of the feature similarity distance between each defect to be inspected and different defect types, and finally obtain the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type.

[0119] The present invention firstly performs pixel-by-pixel contour recognition and analysis on each image pixel point in the image of the defective area of ​​the lens component surface structure to obtain the image contour feature data at each pixel point. This process first performs edge detection on the image to identify the boundary contour of the pixel points inside each defective area. Through edge detection algorithms (such as Sobel, Canny, etc.), the edge information of each point in the image can be efficiently extracted, including the position, shape, continuity and other characteristics of the edge. These data are very critical for the subsequent defect type classification and positioning, and can accurately describe the morphology and structural characteristics of each defective area, and provide detailed basic information for image analysis and processing. Secondly, by performing pixel-by-pixel gray value extraction and processing on each pixel point in the image of the defective area of ​​the lens component surface structure, the gray level of each pixel point can be obtained, that is, the value reflecting the brightness and hue of the image. These gray values ​​reflect the light intensity and color depth of each point in the image, which are important data for characterizing the image characteristics inside the defective area. By accurately extracting the gray information of each pixel point, the gray level distribution characteristics of the image can be established, providing the necessary input data for the subsequent feature vector conversion and similarity calculation. Then, the image contour feature data and image grayscale values ​​of each pixel point in the surface structural defect area are converted into spatial feature vectors. This process aims to combine the contour features and grayscale information to construct a comprehensive feature vector for each pixel point. The feature vector contains various structural information and grayscale information extracted from the image, which are expressed in the form of spatial feature vectors, making the comprehensive features of each pixel point more comparable and descriptive. These feature vectors are the basis for image similarity calculation and defect classification in subsequent steps, and can effectively distinguish different types of defects and perform quantitative analysis. Next, by obtaining a standard type grayscale atlas of lens surface structural defects, this step usually involves extracting representative defect type images from known standard data sets or experimental samples. These images are classified and annotated, and have clear defect features and type classification information. The purpose of obtaining such a standard grayscale atlas is to establish a reference standard for defect classification. By comparing and calculating similarity with actual image features, various defect types of the surface structure of the lens component can be effectively identified. Finally, based on the grayscale atlas of standard types of lens surface structural defects, the image contour-grayscale feature vector of each pixel in the surface structural defect area is subjected to a vector similarity comprehensive calculation. This calculation process will use mathematical similarity measurement methods (such as Euclidean distance, cosine similarity, etc.) to compare and evaluate the feature vector of each defect area with the feature vector of the standard type, thereby obtaining the image feature similarity comprehensive distance values ​​between the surface structural defects of the lens component and each standard defect type. These distance values ​​reflect the degree of similarity between each defect area and the standard type, and are an important basis for further identifying and classifying defects.

[0120] Preferably, step S35 includes the following steps:

[0121] Step S351: performing pixel feature vector analysis on the grayscale atlas of standard types of lens surface structural defects to obtain an image contour-grayscale feature vector corresponding to each pixel of each standard defect type;

[0122] In an embodiment of the present invention, pixel points of each defect type grayscale image in the grayscale atlas of standard types of lens surface structural defects are segmented, and contour features and grayscale values ​​of the segmented pixel area images are analyzed to obtain the specific performance of each defect standard type in image contour and grayscale features. This involves detailed feature extraction of each standard type image, including the shape of the edge contour, the distribution of grayscale levels, and the existing texture features, and converting them into vector form to ensure accurate extraction of the feature vector of each defect type, and finally obtaining the image contour-grayscale feature vector of each pixel corresponding to each defect standard type.

[0123] Step S352: performing coordinate system same-dimension mapping transformation on the image contour-grayscale feature vector of each pixel point in the surface structure defect area and the image contour-grayscale feature vector of each pixel point corresponding to each defect standard type, so as to obtain the feature vector of the pixel point of each defect to be inspected of each lens component and the feature vector of the pixel point corresponding to each defect standard type in the same spatial coordinate system dimension;

[0124] In an embodiment of the present invention, the image contour-grayscale feature vector of each pixel point in the surface structure defect area and the image contour-grayscale feature vector of each pixel point corresponding to each defect standard type are mapped in detail to the geometric and spatial coordinate systems, so as to achieve quantitative calculation of the image contour-grayscale feature vector of each pixel point in the surface structure defect area and the feature vector corresponding to each defect standard type in the same spatial coordinate system, thereby ensuring comparison of different defect types and positions in the same coordinate system, and finally obtaining the feature vector of the defect pixel point of each lens component to be inspected and the feature vector of the pixel point corresponding to each defect standard type in the same spatial coordinate system dimension.

[0125] Step S353: Perform vector similarity comprehensive calculation between the feature vector of the defect pixel point of each lens component to be inspected and the feature vector of the pixel point corresponding to each defect standard type in the same spatial coordinate system dimension to obtain the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type.

[0126] In an embodiment of the present invention, a mathematically similarity measurement method (such as cosine similarity, Euclidean distance, etc.) is used to perform statistical calculation of the spatial vector distance between the feature vector of the defect pixel point of each lens component to be inspected and the feature vector of the pixel point corresponding to each defect standard type in the same spatial coordinate system dimension, so as to quantitatively calculate the cumulative sum of the feature vector corresponding to each defect pixel point to be inspected and the feature vector of the pixel point corresponding to each defect standard type, and make it possible to reflect the total value of the feature similarity distance between each defect to be inspected and different defect types, and finally obtain the image feature similarity comprehensive distance value between the surface structure defect of the lens component and each defect standard type.

[0127] The present invention firstly analyzes the pixel feature vector of the grayscale atlas of the standard types of lens surface structural defects to obtain the specific performance of each standard defect type in image contour and grayscale features. This analysis involves detailed feature extraction of each standard type image, including the shape of the edge contour, the distribution of grayscale levels and the existing texture features. Through these feature vectors, a feature model of each defect type can be established to provide basic data for subsequent similarity calculation. Then, by performing a coordinate system same-dimensional mapping transformation on the image contour-grayscale feature vector of each pixel point in the surface structural defect area and the image contour-grayscale feature vector of each pixel point corresponding to each defect standard type, the image contour-grayscale feature vector of each pixel point in the surface structural defect area can be compared with the feature vector corresponding to each defect standard type in the same spatial coordinate system. This transformation ensures the direct comparability between the feature vector of the defect pixel point to be detected and the feature vector of the standard type, and provides a unified mathematical framework for subsequent similarity calculation. Through the mapping transformation, the difference and similarity between the features of each defect to be detected and the standard type can be effectively evaluated, and different types of lens surface structural defects can be further accurately identified and classified. Finally, by performing a comprehensive calculation of vector similarity between the feature vectors of the defect pixels of each lens component to be inspected and the feature vectors of the pixels corresponding to each defect standard type in the same spatial coordinate system dimension, the similarity between the feature vectors of the defect pixels of each lens component to be inspected and the feature vectors of the pixels corresponding to each defect standard type can be evaluated and analyzed. This calculation is based on mathematical similarity measurement methods (such as cosine similarity, Euclidean distance, etc.), which converts the differences between feature vectors into numerical indicators, which are used to quantify the similarity between the surface structural defects of the lens and each standard type. The comprehensive distance value reflects the overall feature similarity between each defect to be inspected and different defect types, and is the key basis for defect classification and quantitative analysis based on image features.

[0128] Preferably, step S4 comprises the following steps:

[0129] Step S41: taking the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type as the defect type similarity, so as to obtain the image feature similarity between the surface structural defect of the lens component and each defect standard type;

[0130] In an embodiment of the present invention, the image feature similarity comprehensive distance value between the surface structural defects of the lens component and each defect standard type obtained by previous quantitative calculation is used as an indicator of defect type similarity. This value is used to reflect the overall similarity between the surface defects of the lens to be inspected and the known standard types, and finally the image feature similarity between the surface structural defects of the lens component and each defect standard type is obtained.

[0131] Step S42: Based on the image feature similarity between the lens component surface structural defect and each defect standard type, the corresponding lens component surface structural defect area image is subjected to defect type recognition analysis to obtain a lens component surface defect type recognition result.

[0132] In an embodiment of the present invention, by performing maximum value screening processing on the image feature similarity between the previously determined surface structural defects of the lens component and each standard defect type, the actual defect image of the lens component surface is analyzed and compared according to the similarity index obtained by the above calculation, and the defect type corresponding to the largest image feature similarity value is screened out, including bubbles, scratches, cracks, stains, etc., and each defect area automatically or semi-automatically identifies and classifies which standard type of defect it belongs to, and finally obtains the surface defect type recognition result of the lens component.

[0133] The present invention firstly uses the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type as the defect type similarity index. This value reflects the overall similarity between the surface defect of the lens to be inspected and the known standard type. It is based on the feature vector similarity data calculated in the above steps. Through mathematical similarity measurement methods, such as cosine similarity or Euclidean distance, the difference between the feature vectors can be quantified as a comprehensive distance value. This similarity value can not only help identify and quantify different types of lens surface defects, but also provide a comparable standard for evaluating the accuracy and efficiency of the defect detection system. Finally, based on the image feature similarity between the surface structural defect of the lens component and each defect standard type, the corresponding lens component surface structural defect area image is subjected to defect type recognition and analysis. In this step, the actual defect image of the lens component surface is analyzed and compared according to the similarity index calculated above. By comparing the image feature similarity values, each defect area can be automatically or semi-automatically identified and classified into which standard type of defect it belongs. This automated recognition and analysis process greatly improves the efficiency and accuracy of defect detection, reduces the subjectivity and error of human judgment, and thus provides strong support for the production quality control of the lens component.

[0134] Preferably, the present invention further provides a lens assembly defect recognition system based on machine vision, which is used to execute the lens assembly defect recognition method based on machine vision as described above. The lens assembly defect recognition system based on machine vision comprises:

[0135] The lens component surface structure image acquisition module is used to acquire the surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; and perform image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component;

[0136] The lens component structure image defect area segmentation module is used to perform image grayscale processing on the lens component surface structure standard image to obtain a lens component surface structure grayscale image; determine the structural defect points on the lens component surface structure grayscale image to obtain the defect points of the lens component surface structure image; perform defect area segmentation on the lens component surface structure grayscale image based on the defect points of the lens component surface structure image to generate a lens component surface structure defect area image;

[0137] The defect area image pixel similarity calculation module is used to perform pixel-by-pixel feature vector conversion on the lens component surface structure defect area image to obtain the image contour-grayscale feature vector of each pixel point in the surface structure defect area; obtain the lens surface structure defect standard type grayscale atlas, and perform vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structure defect area based on the lens surface structure defect standard type grayscale atlas, so as to obtain the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type;

[0138] The lens component structural image defect type recognition module is used to perform defect type recognition and analysis on the lens component surface structural defect area image based on the image feature similarity comprehensive distance value between the lens component surface structural defect and each defect standard type, so as to obtain the lens component surface defect type recognition result.

[0139] In summary, the present invention provides a lens assembly defect recognition system based on machine vision, which is composed of a lens assembly surface structure image acquisition module, a lens assembly structure image defect area segmentation module, a defect area image pixel similarity calculation module and a lens assembly structure image defect type recognition module. It can realize any lens assembly defect recognition method based on machine vision described in the present invention, and is used to combine the operations between computer programs running on each module to realize the lens assembly defect recognition method based on machine vision. The internal structures of the system cooperate with each other, which can greatly reduce duplication of work and manpower investment, and can quickly and effectively provide a more accurate and efficient lens assembly defect recognition process based on machine vision, thereby simplifying the operation process of the lens assembly defect recognition system based on machine vision.

[0140] 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.

[0141] 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 identifying lens component defects based on machine vision, It is characterized in that The following steps are involved: Step S1: collecting a surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; performing image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component; Step S2: grayscale the standard image of the surface structure of the lens component to obtain a grayscale image of the surface structure of the lens component; determine the structural defect points of the grayscale image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segment the defect area of ​​the grayscale image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a defect area image of the surface structure of the lens component; wherein step S2 includes the following steps: Step S21: performing a quantitative calculation of the light reflection sensitivity of pixels on the standard image of the lens component surface structure to obtain the light reflection change sensitivity of each pixel in the lens component structure image; wherein step S21 includes the following steps: Step S211: segmenting the standard image of the lens component surface structure into pixels to obtain a pixel region image of each lens component surface structure; Step S212: performing illumination condition inference estimation on the image of each pixel point area of ​​the surface structure of each lens component to obtain illumination estimation conditions of each pixel point area of ​​the lens component; Step S213: dynamically changing constraint design is performed on the illumination estimation conditions of each lens component pixel area to obtain the illumination dynamic change range constraint conditions of each lens component pixel area; Step S214: Calculating the pixel reflection loss of each lens component surface structure pixel area image based on the illumination dynamic change range constraint condition of each lens component pixel area to obtain the illumination reflection change loss rate at each lens component surface structure pixel area; wherein step S214 includes the following steps: The illumination change is divided frame by frame according to the illumination dynamic change range constraint condition of each lens component pixel point area, and the time-series frame by frame illumination intensity change value of each lens component pixel point area is obtained; Based on the time-series frame-by-frame illumination intensity variation value of each lens component pixel area, the illumination reflection analysis of each lens component surface structure pixel area image is performed frame by frame to obtain the optical reflection response process of the surface structure image of each lens component pixel area in each time-series frame; The incident angle and reflection angle are measured and processed for the optical reflection response process of the surface structure image of each lens component pixel area in each time frame, so as to obtain the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time frame; Calculate the pixel reflection loss of each lens component surface structure pixel area image based on the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time frame, so as to obtain the illumination reflection change loss rate at each lens component surface structure pixel area; Step S215: quantifying the light reflection change sensitivity of each lens component surface structure pixel area image according to the light reflection change loss rate at each lens component surface structure pixel area, and obtaining the light reflection change sensitivity at each pixel point in the lens component structure image; Step S22: segmenting the standard image of the surface structure of the lens component into reflection-sensitive regions based on the sensitivity of each pixel point in the structure image of the lens component to obtain the light reflection-sensitive region of the structure image of the lens component and the light reflection-insensitive region of the structure image of the lens component; Step S23: adjusting the illumination dynamic range of the illumination reflection sensitive area of ​​the lens component structure image to obtain the illumination sensitive dynamic range adjustment area of ​​the lens component structure image; performing illumination reflection compensation on the illumination reflection dull area of ​​the lens component structure image to obtain the illumination reflection compensation area of ​​the lens component structure image; performing image region fusion on the illumination sensitive dynamic range adjustment area of ​​the lens component structure image and the illumination reflection compensation area of ​​the lens component structure image to obtain the illumination reflection sensing adjustment image of the lens component surface structure; Step S24: performing image grayscale processing on the lens component surface structure light reflection sensing adjustment image to obtain a lens component surface structure grayscale image; Step S25: determining the structural defect points of the grayscale image of the surface structure of the lens component to obtain the defect points of the surface structure image of the lens component; segmenting the defect area of ​​the grayscale image of the surface structure of the lens component based on the defect points of the surface structure image of the lens component to generate a surface structure defect area image of the lens component; Step S3: performing pixel-by-pixel feature vector conversion on the image of the surface structural defect area of ​​the lens component to obtain an image contour-grayscale feature vector of each pixel point in the surface structural defect area; obtaining a grayscale atlas of standard types of lens surface structural defects, and performing vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structural defect area based on the grayscale atlas of standard types of lens surface structural defects to obtain an image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type; Step S4: performing defect type recognition analysis on the image of the lens component surface structure defect area based on the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type, and obtaining the lens component surface defect type recognition result.

2. The method for identifying lens component defects based on machine vision according to claim 1, It is characterized in that Step S1 includes the following steps: Step S11: collecting a surface structure image of the lens assembly through a high-resolution machine vision system to obtain an original image of the surface structure of the lens assembly; Step S12: performing noise removal processing on the original image of the surface structure of the lens assembly to obtain a noise-removed image of the surface structure of the lens assembly; Step S13: performing histogram equalization processing on the denoised image of the lens component surface structure to obtain a lens component surface structure equalized image; Step S14: performing edge detail enhancement processing on the equalized image of the lens component surface structure to obtain an edge enhanced image of the lens component surface structure; Step S15: performing image registration processing on the edge enhanced image of the lens component surface structure to obtain a standard image of the lens component surface structure.

3. The method for identifying lens component defects based on machine vision according to claim 1, It is characterized in that Step S25 includes the following steps: Step S251: performing structural texture feature analysis on the grayscale image of the lens component surface structure to obtain structural texture feature data of the lens component surface structure; Step S252: determining the structural defect points of the grayscale image of the surface structure of the lens component based on the surface structure texture feature data of the lens component, and obtaining the defect points of the surface structure image of the lens component; Step S253: merging the defect point range of the defect point of the lens component surface structure image to obtain a lens component surface structure defect point merged area; Step S254: performing a region size and shape analysis on the lens component surface structure defect point merged region to obtain the size of the lens component surface structure defect region and the shape of the lens component surface structure defect region; performing region boundary positioning processing on the lens component surface structure defect point merged region based on the size of the lens component surface structure defect region and the shape of the lens component surface structure defect region to obtain the boundary distribution range of the lens component surface structure defect region; Step S255: segmenting the defective regions of the grayscale image of the surface structure of the lens component based on the boundary distribution range of the defective regions of the surface structure of the lens component to generate an image of the defective regions of the surface structure of the lens component.

4. The method for identifying lens component defects based on machine vision according to claim 1, It is characterized in that Step S3 includes the following steps: Step S31: performing pixel-by-pixel contour recognition and analysis on each image pixel point in the image of the surface structural defect area of ​​the lens component to obtain image contour feature data at each pixel point in the surface structural defect area; Step S32: performing pixel-by-pixel grayscale value extraction processing on each image pixel point in the image of the surface structural defect area of ​​the lens component to obtain the image grayscale value at each pixel point in the surface structural defect area; Step S33: performing spatial feature vector conversion on the image contour feature data and the image grayscale value at each pixel point in the surface structural defect area to obtain the image contour-grayscale feature vector of each pixel point in the surface structural defect area; Step S34: obtaining a grayscale atlas of standard types of lens surface structural defects; Step S35: Based on the grayscale atlas of standard types of lens surface structural defects, a vector similarity comprehensive calculation is performed on the image contour-grayscale feature vector of each pixel point in the surface structural defect area to obtain the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type.

5. The method for identifying lens component defects based on machine vision according to claim 4, It is characterized in that Step S35 includes the following steps: Step S351: performing pixel feature vector analysis on the grayscale atlas of standard types of lens surface structural defects to obtain an image contour-grayscale feature vector corresponding to each pixel of each standard defect type; Step S352: performing coordinate system same-dimension mapping transformation on the image contour-grayscale feature vector of each pixel point in the surface structure defect area and the image contour-grayscale feature vector of each pixel point corresponding to each defect standard type, so as to obtain the feature vector of the pixel point of each defect to be inspected of each lens component and the feature vector of the pixel point corresponding to each defect standard type in the same spatial coordinate system dimension; Step S353: Perform vector similarity comprehensive calculation between the feature vector of the defect pixel point of each lens component to be inspected and the feature vector of the pixel point corresponding to each defect standard type in the same spatial coordinate system dimension to obtain the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type.

6. The method for identifying lens component defects based on machine vision according to claim 1, It is characterized in that Step S4 includes the following steps: Step S41: taking the image feature similarity comprehensive distance value between the surface structural defect of the lens component and each defect standard type as the defect type similarity, so as to obtain the image feature similarity between the surface structural defect of the lens component and each defect standard type; Step S42: Based on the image feature similarity between the lens component surface structural defect and each defect standard type, the corresponding lens component surface structural defect area image is subjected to defect type recognition analysis to obtain a lens component surface defect type recognition result.

7. A lens component defect recognition system based on machine vision, It is characterized in that The lens assembly defect recognition system based on machine vision is used to perform the lens assembly defect recognition method based on machine vision as claimed in claim 1, and the lens assembly defect recognition system based on machine vision comprises: The lens component surface structure image acquisition module is used to acquire the surface structure image of the lens component through a high-resolution machine vision system to obtain an original image of the surface structure of the lens component; and perform image preprocessing on the original image of the surface structure of the lens component to obtain a standard image of the surface structure of the lens component; The lens component structure image defect area segmentation module is used to perform image pixel segmentation on the lens component surface structure standard image to obtain each lens component surface structure pixel area image; perform illumination condition inference estimation on each lens component surface structure pixel area image to obtain illumination estimation conditions for each lens component pixel area; perform dynamic change constraint design on the illumination estimation conditions for each lens component pixel area to obtain illumination dynamic change range constraint conditions for each lens component pixel area; The illumination change is divided frame by frame for the illumination dynamic change range constraint conditions of each lens component pixel area, and the time-series frame-by-frame illumination intensity change value of each lens component pixel area is obtained; based on the time-series frame-by-frame illumination intensity change value of each lens component pixel area, the illumination reflection analysis is performed on the image of each lens component surface structure pixel area, and the optical reflection response process of the surface structure image of each lens component pixel area in each time-series frame is obtained; the incident angle and reflection angle are measured and processed for the optical reflection response process of the surface structure image of each lens component pixel area in each time-series frame, so as to obtain the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time-series frame; based on the image illumination incident angle and image illumination reflection angle of each lens component pixel area in each time-series frame, the pixel reflection loss is calculated for each lens component surface structure pixel area image, so as to obtain the illumination reflection change loss rate at each lens component surface structure pixel area; according to the illumination reflection change loss rate at each lens component surface structure pixel area, the surface structure of each lens component is measured and processed. The sensitivity of the structural pixel point area image to light reflection change is quantified to obtain the sensitivity of light reflection change at each pixel point in the lens component structure image; the reflection sensitive area of ​​the standard image of the lens component surface structure is segmented based on the sensitivity of light reflection change at each pixel point in the lens component structure image to obtain the light reflection sensitive area of ​​the lens component structure image and the light reflection dull area of ​​the lens component structure image; the light dynamic range of the light reflection sensitive area of ​​the lens component structure image is adjusted to obtain the light sensitive dynamic range adjustment area of ​​the lens component structure image; the light reflection dull area of ​​the lens component structure image is compensated for light reflection to obtain the light reflection compensation area of ​​the lens component structure image; the light sensitive dynamic range adjustment area of ​​the lens component structure image and the light reflection compensation area of ​​the lens component structure image are image-region-fused to obtain the light reflection sensing adjustment image of the lens component surface structure; the light reflection sensing adjustment image of the lens component surface structure is grayed to obtain the grayed image of the lens component surface structure; the structural defect point position is determined on the grayed image of the lens component surface structure to obtain the defect point position of the lens component surface structure image;Segmenting the defect area of ​​the grayscale image of the surface structure of the lens component based on the defect points of the image of the surface structure of the lens component to generate an image of the defect area of ​​the surface structure of the lens component; The defect area image pixel similarity calculation module is used to perform pixel-by-pixel feature vector conversion on the lens component surface structure defect area image to obtain the image contour-grayscale feature vector of each pixel point in the surface structure defect area; obtain the lens surface structure defect standard type grayscale atlas, and perform vector similarity comprehensive calculation on the image contour-grayscale feature vector of each pixel point in the surface structure defect area based on the lens surface structure defect standard type grayscale atlas, so as to obtain the image feature similarity comprehensive distance value between the lens component surface structure defect and each defect standard type; The lens component structural image defect type recognition module is used to perform defect type recognition and analysis on the lens component surface structural defect area image based on the image feature similarity comprehensive distance value between the lens component surface structural defect and each defect standard type, so as to obtain the lens component surface defect type recognition result.