Machine vision detection method for distinguishing oil stains and point defects on surface of lens
Through specific optical components and improved machine learning classifiers, the problem of difficulty in distinguishing between oil stains and point defects on the lens surface is solved, achieving efficient and reliable defect detection and reducing the misjudgment rate.
Patent Information
- Application Number
- CN202510822854.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-05
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing machine vision inspection systems find it difficult to effectively distinguish between oil stains on the lens surface and ordinary point defects, resulting in a high misjudgment rate, which affects product quality and yield.
A machine vision system with a specific optical component structure, including a color high-resolution industrial camera, a telecentric lens, and a dual-light source unit, is used to distinguish defects using the differentiated image features generated by the dual light sources, combined with differential operations and an improved MLP classifier.
It achieves accurate distinction between oil stains and point defects, improves detection reliability and robustness, reduces misjudgment rate, and optimizes process decisions.
Smart Images

Figure CN120594528A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine vision detection equipment, and in particular to a machine vision detection method for distinguishing oil stains from point defects on a lens surface. Background Art
[0002] Surface defects such as oil and dust (often appearing as white spots) are common problems in optical lens production.
[0003] However, the impact of these two types of defects on subsequent processes and product performance varies greatly;
[0004] 1. Oil stains, especially certain types of oil stains, are mobile and diffusive. If they are not detected and flow into the lens or contaminate other components, it will cause fatal failures.
[0005] 2. Ordinary point defects such as dust and bright spots are usually static, and their impact is relatively local and controllable.
[0006] Although some existing machine vision inspection systems can detect surface anomalies, their single lighting or imaging structure often cannot provide enough information to reliably distinguish between oil stains with the risk of spreading and ordinary point defects.
[0007] For example, under certain lighting conditions, tiny oil droplets and dust particles may appear as bright or dark spots, leading to confusion.
[0008] This structure, which cannot effectively distinguish the nature of defects, may result in risky oil stains being misjudged as common defects and released, or acceptable common spots being misjudged as oil stains and rejected, resulting in yield loss or potential quality risks.
[0009] Therefore, a system with a specially designed structure is required to obtain image information sufficient to distinguish between these two types of defects. Summary of the Invention
[0010] The main purpose of the present invention is to propose a machine vision detection method for distinguishing between oil stains and point defects on the lens surface, aiming to solve the problem in the existing technology that the detection system structure is difficult to effectively distinguish between oil stains and ordinary point defects on the lens surface, and to provide a machine vision system with a specific optical component structure layout. The system structure can produce differentiated image features, so that the system can reliably distinguish between oil stain defects with diffusion risks and ordinary point defects.
[0011] To achieve the above object, the present invention proposes a machine vision detection method for distinguishing oil stains and point defects on the lens surface, comprising:
[0012] An image acquisition unit, the image acquisition unit comprising a color high-resolution industrial camera and a telecentric lens, wherein a working distance between the telecentric lens and the object to be detected is set to a specific value, and the image acquisition unit comprises a first image acquisition unit and a second image acquisition unit;
[0013] Light source unit: This is the core structural feature of this patent for defect differentiation. Its uniqueness lies in that the light source unit comprises at least two light source sub-units with significantly different structures and illumination characteristics and optimized for the response differences between oil stains and point defects. They are arranged around the sample detection area:
[0014] The light source unit includes a first light source sub-unit and a second light source sub-unit,
[0015] The first light source sub-unit is used for detecting oil stains on ink;
[0016] The first light source subunit adopts a ring light source, and the first light source is used to provide direct light;
[0017] Its special structure is that the diffuser in the standard configuration is removed. This diffuser-less structure produces a more directional, almost direct ring light.
[0018] The second light source sub-unit is used to detect oil stains on the mirror surface;
[0019] The second light source sub-unit adopts a dome light source, and the second light source sub-unit is used to provide diffusely reflected light;
[0020] Its structure provides highly uniform diffuse lighting.
[0021] Image processing unit:
[0022] After the first image acquisition unit and the second image acquisition unit respectively acquire two groups of images of the first light source subunit and the second light source subunit, a subsequent processing flow is performed:
[0023] S1: Perform differential calculation between the real-time acquired image and the pre-stored standard golden sample image to preliminarily identify and locate potential defect areas;
[0024] S2: A machine learning classifier is used to analyze these located defect areas. The classifier is used to enhance the sensitivity to color features and automatically classify the defect types. The machine learning classifier includes distinguishing between oil stain defects and other types of defects.
[0025] Compared with the existing technology, it has the following significant beneficial effects:
[0026] 1. Accurately distinguish defect properties: The specific dual-light source structure is designed to physically enhance the imaging difference between oil stains and common point-like defects (such as white dust spots), providing high-quality raw image information for subsequent differentiation. Combined with a machine learning classifier that improves pixel-level color information, it can more effectively learn and utilize these subtle color differences generated by the dual-light source system, enabling the system to highly accurately distinguish oil stains with a risk of spreading from other types of defects, resolving the pain points of easy confusion and difficulty in differentiation in existing technologies.
[0027] 2. Improved detection reliability and robustness: The golden sample difference method can stably detect any deviations from the standard sample, effectively avoiding missed detections due to complex background textures or individual product differences. The improved MLP classifier, with its special focus on pixel-level color features and ability to learn complex patterns, is more adaptable and robust to oil stains or various types of point defects with slight variations in shape, color, or gloss, compared to fixed rule-based methods, reducing the false positive rate.
[0028] 3. Optimize process decisions: Accurate defect classification information provides a reliable basis for subsequent optimization of front-end processes, avoiding unnecessary losses. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is the system composition diagram;
[0030] Figure 2 It is a detection flow chart;
[0031] Figure 3 Examples of imaging oil stains and white spots;
[0032] Figure 4 It is an improved MLP network model. DETAILED DESCRIPTION
[0033] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0034] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, top, bottom, inside, outside, vertical, horizontal, longitudinal, counterclockwise, clockwise, circumferential, radial, axial...), then the directional indications are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indications will also change accordingly.
[0035] In addition, if there are descriptions involving "first" or "second" in the embodiments of the present invention, the descriptions of "first" or "second" are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that ordinary technicians in this field can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0036] like Figures 1 to 4 As shown, a machine vision detection method for distinguishing oil stains and point defects on the lens surface includes:
[0037] An image acquisition unit, the image acquisition unit comprising a color high-resolution industrial camera and a telecentric lens, wherein a working distance between the telecentric lens and the object to be detected is set to a specific value, and the image acquisition unit comprises a first image acquisition unit and a second image acquisition unit;
[0038] Light source unit: This is the core structural feature of this patent for defect differentiation. Its uniqueness lies in the fact that it comprises at least two light source sub-units with significantly different structures and illumination characteristics, optimized for the differences in response to oil stains and point defects. These sub-units are arranged around the sample inspection area:
[0039] The light source unit includes a first light source sub-unit and a second light source sub-unit,
[0040] The first light source sub-unit is used for detecting oil stains on ink;
[0041] The first light source subunit adopts a ring light source, and the first light source is used to provide direct light;
[0042] Its special structure is that the diffuser in the standard configuration is removed. This diffuser-less structure produces a more directional, almost direct ring light.
[0043] The second light source sub-unit is used to detect oil stains on the mirror surface;
[0044] The second light source sub-unit adopts a dome light source, and the second light source sub-unit is used to provide diffusely reflected light;
[0045] Its structure provides highly uniform diffuse lighting.
[0046] Image processing unit:
[0047] After the first image acquisition unit and the second image acquisition unit respectively acquire two groups of images of the first light source subunit and the second light source subunit, a subsequent processing flow is performed:
[0048] S1: Perform differential calculation between the real-time acquired image and the pre-stored standard golden sample image to preliminarily identify and locate potential defect areas;
[0049] S2: A machine learning classifier is used to analyze these located defect areas. The classifier is used to enhance the sensitivity to color features and automatically classify the defect types. The machine learning classifier includes distinguishing between oil stain defects and other types of defects.
[0050] Specifically, the S1 includes:
[0051] S11: Image processing and defect classification process:
[0052] S111: Image acquisition:
[0053] The sample is placed or transported to the testing location;
[0054] The control unit coordinates the first image acquisition unit to acquire a first color image I1 under the illumination of the first light source subunit (ring light without a diffuser);
[0055] And coordinate the second image acquisition unit to acquire the second color image I2 under the illumination of the second light source sub-unit (dome light).
[0056] These two images capture the sample's response under different lighting conditions.
[0057] Specifically,
[0058] S112: Defect candidate area positioning:
[0059] The control and processing unit will collect the real-time image I k (k=1, 2) and the pre-stored defect-free standard sample I under the corresponding lighting conditions golden,k Perform digital image difference calculation on the reference image;
[0060] The difference operation is used on the region of interest of the current acquisition unit;
[0061] The region of interest is the ink area of the product for the first image acquisition unit and the mirror area for the second image acquisition unit;
[0062] By analyzing the difference results, we can identify the areas that are significantly different from the gold sample.
[0063] The areas with significant differences are marked as potential defect candidates:
[0064]
[0065] Where d(.,.) represents the pixel difference metric function, T k is the preset difference threshold;
[0066] Pixels with a difference threshold of 1 constitute a potential defect area.
[0067] Specifically, S113: Feature extraction and classification:
[0068] For each potential defect area located (by M diff,1 and M diff,2 ), perform connected region analysis (Blob analysis) to obtain independent defect connected regions c i :
[0069] C={c1,c2,...,c N}=CCA(M diff,1 ∪M diff,2) ;
[0070] Where C is the set of all independent defect connected regions.
[0071] Specifically, for the area Area(c i ) The connected area c that meets the point defect definition criteria i Find its circumscribed rectangle B i .
[0072] The bounding rectangle is defined by the minimum and maximum coordinates:
[0073]
[0074] in,
[0075]
[0076] Specifically, intercept its circumscribed rectangle B i The corresponding region image in the original color image is an image to be classified R i .
[0077] The image region extraction operation can be expressed as:
[0078] R i =Extract(I source , B i );
[0079] Among them I source Represents the raw image data used for feature extraction.
[0080] Specifically, the machine learning classifier in S21 is a multi-layer perceptron (MLP) classification model f MLP ;
[0081] The multilayer perceptron (MLP) classification model f MLP Pre-trained and optimized for image patch R i Conduct analysis;
[0082] Improved f MLP The first layer of the model is specifically designed to process pixel-level color information:
[0083] S22 input processing: For image block R i For each pixel position (x, y), get its RGB color vector [R(x, y), G(x, y), B(x, y)].
[0084] S23 pixel-by-pixel linear transformation: The 3D RGB vector of each pixel is transformed through a small, learnable linear transformation (i.e., multiplied by a 3×M weight matrix W rgb , where M is the feature dimension after transformation), mapped to an M-dimensional color feature vector F color (x, y); that is:
[0085] F color (x, y) = W rgb ·[R(x,y),G(x,y),B(x,y)] T ;
[0086] This weight matrix W rgb It is learned through back propagation during the model training phase.
[0087] S24 subsequent processing: image block R i The color feature vector F calculated from all pixels in color (x, y) are input into the subsequent standard layer of MLP (i.e., fully connected layer) for further feature learning and combination.
[0088] S25 design principle: It integrates and encodes color information at the pixel level to more effectively capture the local color feature data emphasized by the patented dual light source system, which can be used to distinguish oil stains from other point defects.
[0089] Specifically, the local color feature data is weakened when the RGB channels are directly flattened or converted into a grayscale image;
[0090] The classification process can be expressed as: L i =f MLP (R i );
[0091] Among them, f MLP Represents the entire classification model including the optimized pixel-by-pixel color processing layer described above;
[0092] L i is the output category label;
[0093] S26 result output: classifier f MLP Output the category judgment L of each candidate area i ; The system integrates the judgment results and generates a final test report to guide subsequent quality control decisions.
[0094] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformation made by using the contents of the present invention specification and drawings under the inventive concept of the present invention, or directly / indirectly applied in other related technical fields, is included in the patent protection scope of the present invention.
Claims
1. A machine vision detection method for distinguishing oil stains and point defects on the lens surface, characterized in that: include, An image acquisition unit, the image acquisition unit comprising a color high-resolution industrial camera and a telecentric lens, wherein a working distance between the telecentric lens and the object to be detected is set to a specific value, and the image acquisition unit comprises a first image acquisition unit and a second image acquisition unit; Light source unit: The light source unit includes a first light source sub-unit and a second light source sub-unit, The first light source sub-unit is used for detecting oil stains on ink; The first light source subunit adopts a ring light source, and the first light source is used to provide direct light; The second light source sub-unit is used to detect oil stains on the mirror surface; The second light source sub-unit adopts a dome light source, and the second light source sub-unit is used to provide diffusely reflected light; Image processing unit: After the first image acquisition unit and the second image acquisition unit respectively acquire two groups of images of the first light source subunit and the second light source subunit, a subsequent processing flow is performed: S1: Perform differential calculation between the real-time acquired image and the pre-stored standard golden sample image to preliminarily identify and locate potential defect areas; S2: These located defect areas are analyzed using a machine learning classifier, which is used to enhance sensitivity to color features and automatically classify defect types. The machine learning classifier includes distinguishing between oil defects and non-oil defects.
2. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 1, wherein: Said S1 comprises: S11: The image processing and defect classification process includes: S111: Image acquisition: The sample is placed or transported to the testing location; The control unit coordinates the first image acquisition unit to acquire a first color image I1 under the illumination of the first light source subunit; And coordinate the second image acquisition unit to acquire the second color image I2 under the illumination of the second light source sub-unit.
3. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 1, wherein: S112: Defect candidate area positioning: The control and processing unit will collect the real-time image I k (k=1, 2) and the pre-stored defect-free standard sample I under the corresponding lighting conditions golden,k Perform digital image difference calculation on the reference image; The difference operation is used on the region of interest of the current acquisition unit; The region of interest is the ink area of the product for the first image acquisition unit and the mirror area for the second image acquisition unit; By analyzing the difference results, we can identify the areas that are significantly different from the gold sample. The areas with significant differences are marked as potential defect candidates: Where d(.,.) represents the pixel difference metric function, T k is the preset difference threshold; Pixels with a difference threshold of 1 constitute a potential defect area.
4. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 1, wherein: S113: Feature extraction and classification: For each potential defect area located (by M diff,1 and M diff,2 ), and perform connected region analysis (Blob analysis) to obtain independent defect connected regions c i : C={c1,c2,...,c N }=CCA(M diff,1 ∪M diff,2 ); Where C is the set of all independent defect connected regions.
5. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 1, wherein: For area(c i ) The connected area c that meets the point defect definition criteria i Find its circumscribed rectangle B i ; The bounding rectangle is defined by the minimum and maximum coordinates: in, 6. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 1, wherein: Intercept its circumscribed rectangle B i The corresponding region image in the original color image is an image to be classified R i ; The image region extraction operation can be expressed as: R i =Extract(I source ,B); Among them I source Represents the raw image data used for feature extraction.
7. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 1, wherein: The machine learning classifier in S21 is a multi-layer perceptron (MLP) classification model f MLP ; Improved f MLP The first layer of the model is specifically designed to process pixel-level color information: S22 input processing: For image block R i For each pixel position (x, y), get its RGB color vector [R(x, y), G(x, y), B(x, y)]; S23 pixel-by-pixel linear transformation: The three-dimensional RGB vector of each pixel is transformed through a small, learnable linear transformation, which is multiplied by a 3×N weight matrix Wr gb , Where M is the transformed feature dimension, mapped to an M-dimensional color feature vector F color (x, y); that is: F color (x,y)=W rgb ·[R(x,y),G(x,y),B(x,y)] T ; S24 subsequent processing: image block R i The color feature vector F calculated from all pixels in color (x, y) are input into the subsequent standard layer of MLP for further feature learning and combination; S25 will integrate and encode color information at the pixel level to distinguish local color feature data of oil stains and other point defects.
8. The machine vision inspection method for distinguishing oil stains from point defects on a lens surface according to claim 7, wherein: The local color feature data is weakened when the RGB channels are directly flattened or converted into a grayscale image; The classification process can be expressed as: L i =f MLP (R i ); Among them, f MLP Represents the entire classification model including the optimized per-pixel color processing layer; L i is the output category label; S26 result output: classifier f MLP Output the category judgment L of each candidate area i ; The system integrates the judgment results and generates a final test report to guide subsequent quality control decisions.