An optical lens surface defect digital detection method based on industrial vision
By employing multidimensional illumination field and spectral decomposition technology, the problem of digital quantitative detection of defects on the surface of optical lenses has been solved. This enables the acquisition of multidimensional information in a single imaging session, improving detection efficiency and consistency, providing comprehensive parameters of defects, and meeting the needs of high-speed automated production lines.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANYANG HENGXIN OPTICAL CO LTD
- Filing Date
- 2026-04-27
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies struggle to acquire sufficient optical dimension defect information under single imaging conditions, making it difficult to distinguish the types of defects on the surface of optical lenses, hindering digital and quantitative measurement, and the multiple imaging strategy affects detection consistency and real-time performance.
Using multidimensional illumination field technology, the surface to be tested is illuminated by beams of different wavelengths at a preset angle. Color scattering images are acquired by an industrial camera, and the equivalent depth and type of defects are calculated by spectral decomposition and angle-depth mapping model.
It enables the acquisition of multi-dimensional defect information in a single imaging session, improving detection efficiency and consistency. It can identify parameters such as defect type, depth, length, and area, meeting the real-time requirements of high-speed automated production lines.
Smart Images

Figure CN122434865A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of industrial vision inspection, specifically relating to a digital inspection method for surface defects of optical lenses based on industrial vision. Background Technology
[0002] With the development of precision optical manufacturing technology, optical lenses are increasingly widely used in consumer electronics, aerospace, and medical imaging. Precise inspection of their surface quality has become a crucial step in ensuring the overall imaging performance of the device. Dark-field illumination technology based on the principle of optical scattering is a common method for identifying microscopic defects such as scratches and pits on lens surfaces. This technology illuminates the surface under test with a light source at a specific angle, causing the defect to generate a more significant scattered light signal compared to a flat background. This signal is then captured by an industrial camera to locate the defect.
[0003] However, traditional dark-field inspection methods often employ monochromatic, single-angle illumination, resulting in limited optical information. Surface defects of different physical depths (such as shallow scratches and deep pits) exhibit fundamentally different scattering responses to incident light at different angles, but conventional single-angle illumination can only acquire single scattering intensity information, lacking sufficient dimensions to characterize this difference. This makes it difficult for the inspection system to effectively distinguish the specific type of defect, and even more difficult to achieve digital and quantitative measurement of the physical depth of the defect.
[0004] To obtain more comprehensive defect information, some existing technologies employ a strategy of switching light sources at different angles multiple times and imaging them separately. However, this method not only prolongs the inspection cycle due to multiple imaging processes, making it difficult to meet the real-time requirements of high-speed production lines, but also the mechanical positioning errors between multiple imaging processes can affect the consistency of inspection.
[0005] Therefore, how to acquire defect scattering information with sufficient optical dimensions under single imaging conditions, and thereby realize the digital quantitative detection of physical parameters such as the depth of defects on the surface of optical lenses, is a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0006] The purpose of this invention is to provide a digital detection method for surface defects of optical lenses based on industrial vision, which can effectively solve the problems mentioned in the background art.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A digital detection method for surface defects in optical lenses based on industrial vision includes the following specific steps: Step S1: Construct a multidimensional illumination field. The multidimensional illumination field is formed by illuminating the surface under test with a beam of light having a first wavelength range at a first preset angle, illuminating the surface under test with a beam of light having a second wavelength range at a second preset angle, and illuminating the surface under test with a beam of light having a third wavelength range at a third preset angle. There is a one-to-one physical coding relationship between each wavelength range and each preset angle. Step S2: Acquire a single-frame color scattering image of the lens under test under the multidimensional illumination field using an industrial camera; Step S3: Process the color scattering image to decompose it into first, second and third spectral response matrices corresponding to the first, second and third wavelength ranges, respectively; Step S4: Calculate the equivalent depth of the defect based on the scattered light intensity response value of the defect region extracted from each spectral response matrix and the angle-depth mapping model obtained by calibrating a standard defect sample with a known depth in advance. The angle-depth mapping model is used to describe the physical relationship of nonlinear scattering attenuation of incident light at different preset angles due to the difference in defect depth.
[0008] Furthermore, the specific method for constructing the multidimensional illumination field in step S1 is as follows: A three-layer concentric ring-shaped composite light source structure is constructed. The first-layer ring light source component has a red wavelength range and its beam has an incident angle of 15 degrees at the center point of the surface to be measured. The second-layer ring light source component has a green wavelength range and its beam has an incident angle of 30 degrees at the center point of the surface to be measured. The third-layer ring light source component has a blue wavelength range and its beam has an incident angle of 45 degrees at the center point of the surface to be measured. Each ring light source component is connected to a light source controller that supports three independent pulse width modulation outputs via three independent electrical circuits, and the illumination intensity of each channel is balanced through a pre-calibration process.
[0009] Furthermore, before processing the color scattering image to obtain the spectral response matrix in step S3, a step of performing color crosstalk correction is also included: using a pre-calibrated color correction coefficient matrix to linearly compensate the red, green, and blue channel pixel values of each pixel in the original image to eliminate inter-channel signal crosstalk caused by the overlap of the spectral transmittance curves of the internal filters of the industrial camera. The calibration process of the color correction coefficient matrix and the calibration process of the angle-depth mapping model share the same set of standard diffuse reflector plates and standard defect samples.
[0010] Furthermore, the specific process of pre-calibrating the standard defect samples with known depths in step S4 includes: preparing a set of standard defect samples with different precise depths on the same substrate material as the optical lens; using this detection system to perform image acquisition and spectral decomposition on each standard defect sample, and extracting the average pixel intensity in each spectral response matrix corresponding to each known depth; Using the known depth as the dependent variable and a function based on the ratio of scattered light intensity at different preset angles as the independent variable, regression fitting is performed to determine the scaling coefficients and offsets in the angle-depth mapping model.
[0011] Furthermore, the angle-depth mapping model specifically expresses the quantization relationship between the defect equivalent depth D and the average pixel intensity of each channel in the following form: ,in, , , These represent the average pixel intensity of the defect region in the first, second, and third spectral component matrices, respectively. As the first preset angle, The third preset angle is α, which is the depth scaling coefficient obtained through the calibration process, β is the correction factor used to adjust the contribution weight of the green light channel response, and γ is the depth reference offset obtained through the calibration process.
[0012] Furthermore, before calculating the equivalent depth of the defect in step S4, the method further includes a step of verifying the authenticity of the defect regions extracted from each spectral response matrix: performing dynamic threshold segmentation based on local gray-scale mean and standard deviation on each spectral response matrix to obtain a binarized defect candidate image. A connected component labeling algorithm is used to extract candidate connected components in each binary defect candidate map. Candidate connected components in the same coordinate range in different spectral response matrices are matched. The region is identified as a real defect region only when there are mutually matching candidate connected components in at least two spectral response matrices.
[0013] Furthermore, after calculating the equivalent depth of the defect in step S4, the step further includes a step of digitally describing the geometry of the defect: for the confirmed defect area, the pixel area and pixel perimeter in its image are calculated. The shape factor is calculated based on the pixel area and pixel perimeter to distinguish between near-circular defects and elongated defects; The eigenvalues of the covariance matrix are calculated based on the second-order central moments of the pixels in the defect region, and the major axis length and minor axis length of the defect are calculated based on the eigenvalues.
[0014] Furthermore, after calculating the equivalent depth of the defect in step S4, the method further includes a step of converting the geometric parameters of the image space into the actual size of the physical space: pre-calibrating the pixel equivalent conversion coefficient by photographing a standard grating plate with a known periodic pattern. The calculated defect pixel length and pixel area are multiplied by the pixel equivalent conversion coefficient or its square to obtain the actual physical length and actual physical area of the defect.
[0015] Furthermore, after calculating the equivalent depth of the defect in step S4, the method further includes a step of determining the defect type based on the equivalent depth: comparing the calculated equivalent depth value with a preset depth threshold; when the equivalent depth is less than or equal to the first depth threshold, it is determined to be a shallow scratch; when the equivalent depth is greater than the first depth threshold and less than or equal to the second depth threshold, it is determined to be a deep scratch; when the equivalent depth is greater than the second depth threshold, it is determined to be a base chip. Furthermore, when the average intensity of the defect region extracted from the second spectral response matrix is significantly higher than the average intensity extracted from the first and third spectral response matrices, and the equivalent depth is less than the third depth threshold, it is determined to be a surface attachment.
[0016] Furthermore, in step S2, the process of acquiring a single frame of color scattering image by an industrial camera adopts a trigger synchronization and double buffering mechanism: the sensor detects the position signal of the lens under test, and after the programmable logic controller performs delay compensation, a trigger pulse is sent to the industrial camera and the light source controller simultaneously; the industrial camera responds to the pulse to open the global shutter, and the light source controller synchronously drives each layer of ring light source components to complete pulsed strobe during the camera exposure. The back-end image processing unit receives and processes image data streams transmitted via GigEVision or USB3.0 Vision interfaces by alternately using the first and second buffers.
[0017] In summary, this application includes at least one of the following beneficial technical effects: 1. This invention achieves simultaneous encoding of multiple optical features of different dimensions in a single color scattering image by mechanically arranging multiple wavelength light sources with different incident tilt angles. Compared with the cumbersome process of traditional technology that requires multiple switching of light source angles and multiple imaging, this invention can obtain complete defect scattering information with only a single acquisition, which significantly improves the system detection efficiency and fully meets the real-time requirements of high-speed automated production lines. 2. By utilizing the differences in reflection characteristics of light sources of different wavelengths on the same material surface, this invention can effectively filter out ambient light interference and stray halo obscuring generated by the edge of precision optical lenses through spectral decomposition and differential processing. This processing method significantly enhances the prominence of minute defects in complex backgrounds, greatly reduces the missed detection rate of minute scratches, and significantly improves the consistency and reliability of detection. 3. This invention can not only identify the presence or absence of defects, but also provide comprehensive digital parameters such as the type, depth, length and area of defects. These data provide a scientific basis for the optimization of subsequent production processes. For example, by analyzing the depth distribution pattern of defects, abnormal nodes in the polishing or coating process can be traced, thereby realizing closed-loop management from detection to manufacturing process improvement. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the overall scheme for a digital detection method for surface defects in optical lenses based on industrial vision. Figure 2 A schematic diagram illustrating the core principle of constructing a multidimensional illumination field based on multi-wavelength gradients; Figure 3 This is a flowchart illustrating the logic of spectral component deconstruction and feature extraction based on color space transformation. Figure 4 This is a flowchart for the quantitative calculation and determination of defect physical parameters based on the angle-depth mapping model. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the following description is provided in conjunction with the appendix. Figure 1 To be continued Figure 4 The present invention will be further described in detail below with reference to specific embodiments.
[0020] In the digital inspection method for surface defects of optical lenses based on industrial vision, it is implemented according to a coefficient-based procedure, specifically as follows: First, in step S1, a composite ring light source with multiple wavelengths is configured, and the light sources with multiple wavelengths are set at different incident tilt angles to form a multidimensional illumination field. The specific implementation process of this step is as follows: Step S101: Construct a multi-layered concentric ring-shaped composite light source structure. This composite light source structure includes three independent ring light source components, with the central axis of each ring light source component coinciding with the geometric central axis of the optical lens under test.
[0021] The first-layer ring light source assembly has a ring diameter of 60 mm, on which 24 red light-emitting diode (LED) beads are evenly arranged along the circumference, with a central angle spacing of 15 degrees between adjacent beads. The emission center wavelength of each red LED bead is within a first preset wavelength range of 620 nm to 630 nm, and the half-wavelength is less than 20 nm.
[0022] The installation height of the first-layer ring light source assembly is such that the plane of its light-emitting surface is located 10 mm above the vertex of the test surface of the optical lens under test, and the central axis of the beam of each lamp bead points to the geometric center point of the test surface of the optical lens under test, so that at the center point of the test surface, the angle between the incident beam and the normal direction of that point is 15 degrees, which is the first preset angle.
[0023] The second-layer ring light source assembly has a ring diameter of 90 mm, and 36 green light-emitting diode (LED) beads are evenly arranged along the circumference, with a central angle spacing of 10 degrees between adjacent beads. The emission center wavelength of each green LED bead is within the second preset wavelength range of 520 nm to 530 nm, and the half-wavelength is less than 25 nm.
[0024] The second-layer ring light source assembly is installed at a height such that the plane of its light-emitting surface is located 15 mm above the vertex of the optical lens under test. The central axis of the beam of each lamp bead points to the geometric center point of the optical lens under test. The angle between the incident beam at the center point of the surface under test and the normal direction of that point is 30 degrees, which is used as the second preset angle.
[0025] The third-layer ring light source assembly has a ring diameter of 120 mm, and 48 blue light-emitting diode (LED) beads are evenly arranged along the circumference, with a central angle spacing of 7.5 degrees between adjacent LED beads. The emission center wavelength of each blue LED bead is within the third preset wavelength range of 450 nm to 465 nm, and the half-wavelength is less than 20 nm.
[0026] The installation height of the third-layer ring light source assembly is such that the plane on which its light-emitting surface is located is 20 mm above the vertex of the optical lens under test. The central axis of the beam of each lamp bead points to the geometric center point of the optical lens under test surface. The angle between the incident beam at the center point of the surface under test and the normal direction of that point is 45 degrees, which is the third preset angle.
[0027] Each of the aforementioned ring light source components is fixed to the same optical substrate by an independent structural bracket, and each ring light source component is connected to the light source controller via three independent electrical circuits. The light source controller is a constant current drive module that supports three independent pulse width modulation outputs, with its pulse width modulation frequency set to 20kHz, a maximum output current of 500mA per channel, and a current adjustment resolution of not less than 0.1mA.
[0028] Step S102: Perform pre-calibration of the light source system. Place a standard diffuse reflector on the reference plane of the testing station. The standard diffuse reflector has a hemispherical reflectivity of 99% in the 400 nm to 700 nm wavelength range, and the reflectivity changes with wavelength at a rate of less than 0.1% per nanometer.
[0029] Switch the industrial camera to pre-calibration mode. In this mode, the camera continuously acquires images in 8-bit grayscale mode, with an exposure time set to 1000 microseconds and an analog gain set to 1x. For each acquired image frame, a rectangular region of 400 pixels × 400 pixels is defined in the center of the image as the region of interest. The average grayscale values of the red, green, and blue channels within this region of interest are calculated.
[0030] The light source controller independently adjusts the drive current of the first, second, and third light sources in increments of 0.1 mA. After each current adjustment is completed and the light source output stabilizes, the industrial camera acquires a frame of image and calculates the average grayscale value of each channel within the aforementioned region of interest.
[0031] Once the average grayscale value of any channel reaches the target grayscale value of 128, the corresponding drive current value of that channel is locked, and the drive current of the remaining channels is adjusted until the average grayscale value of all three channels reaches 128.
[0032] After coarse adjustment of the drive current, fine adjustment is performed by dynamically correcting the PWM duty cycle of the LED chips in each layer of the light source. The adjustment step of the PWM duty cycle is 0.1%. During the adjustment process, the grayscale mean values of the red, green, and blue light channel components within the region of interest are continuously calculated. When the absolute value of the maximum deviation between any two pairs of grayscale mean values of the three channels is less than three grayscale levels, the adjustment is stopped, and the current drive current value and PWM duty cycle value of each channel are stored as preset lighting parameters. The grayscale level is calculated based on an 8-bit quantization depth, i.e., the grayscale value range is 0 to 255.
[0033] In summary, step S1 completes the construction and calibration of the multidimensional illumination field. This illumination field can simultaneously provide composite illumination with different wavelengths and incident angles under single exposure conditions, causing various defects on the surface of the optical lens under test to produce differentiated scattering responses.
[0034] Based on this, proceed to step S2, where an industrial camera is used to acquire a color scattering image of the lens under test under this multidimensional illumination field to obtain raw image data for subsequent analysis and processing.
[0035] The next step, S2, involves acquiring a color scattering image of the lens under test under composite illumination using an industrial camera, including the following steps: Step S201: Construct the trigger sensing link for the detection station. Install a laser displacement sensor or photoelectric sensor on the side of the conveyor belt detection station, with the sensor's detection beam positioned perpendicular to the conveyor belt's movement direction.
[0036] When the carrier carrying the optical lens to be tested moves to the testing station with the conveyor belt, the leading edge of the carrier enters the effective detection range of the sensor, the sensor generates an edge trigger signal and immediately outputs it to the digital input port of the programmable logic controller (PLC).
[0037] In step S202, the PLC performs delay compensation for the trigger timing. After receiving the sensor trigger signal, the PLC starts a preset delay compensation timer. The delay compensation value is calculated based on the conveyor belt running linear speed and the physical distance from the sensor installation position to the center of the industrial camera's field of view, and is used to compensate for the deviation between the actual stopping position and the theoretical trigger position caused by the mechanical inertia of the vehicle.
[0038] After the delay compensation is completed, the PLC sends trigger pulse signals simultaneously to the external trigger input interface of the industrial camera and the synchronous trigger input interface of the light source controller through its digital output port.
[0039] In step S203, the industrial camera responds to the trigger pulse and performs exposure. The industrial camera uses a high-resolution CMOS image sensor equipped with a global shutter, and the individual pixel size is selected between 3.45 micrometers and 5.5 micrometers. The external trigger mode of the camera is set to rising edge trigger.
[0040] Upon receiving the rising edge of the trigger pulse, the industrial camera immediately opens the global shutter for exposure, with the exposure time set to a preset fixed value between 500 microseconds and 2000 microseconds. This exposure duration is selected under the constraint that the amount of motion blur produced by the lens under test within its field of view is less than one pixel.
[0041] In step S204, the light source controller drives the composite light source to complete synchronous strobe. Synchronized with step S203, after receiving the trigger pulse from the PLC, the light source controller drives the first-layer ring light source component (red light source), the second-layer ring light source component (green light source), and the third-layer ring light source component (blue light source) to simultaneously illuminate in a pulsed manner according to the lighting parameters pre-stored within the controller. The strobe duration covers the entire exposure time of the industrial camera.
[0042] The peak operating current of each light source during the strobe period is adjusted to 3 to 5 times its respective rated continuous operating current to enhance the illumination intensity during the effective exposure period.
[0043] Step S205: Generation and data stream transmission of the color scattering image. After exposure, the industrial camera's internal analog-to-digital converter converts the accumulated charge of each pixel in the CMOS sensor into 24-bit color digital image data, with each of the red, green, and blue color channels occupying 8 bits of quantization width. This image data is output in its original Bayer format or in standard RGB format after internal camera processing, and transmitted to the back-end image processing unit via a GigE Vision protocol interface or a USB 3.0 Vision protocol interface.
[0044] Step S206: Implement a double buffering mechanism during image data transmission. A first buffer and a second buffer are allocated in the memory of the backend image processing unit. When a complete frame of image data is received from the interface, it is first filled into the first buffer. After filling is complete, a ready signal is sent to the processing unit.
[0045] While the image data in the first buffer is being read and processed, the incoming data stream for the next frame is automatically switched and filled into the second buffer. The two buffers work alternately to avoid image frame loss due to processing unit computation time or instantaneous bandwidth fluctuations in the data transmission bus.
[0046] In summary, step S2 yields a high-quality color scattering image formed by a single exposure under a complex multidimensional illumination field. In this image, various defects on the lens surface, based on their own geometric characteristics, exhibit differentiated scattering responses to illumination of different wavelengths and incident angles, which are encoded into specific color and brightness distributions.
[0047] Using this image as input data, proceed to step S3, where a color space conversion algorithm is used to decompose it into independent spectral components, providing a basis for the subsequent quantitative extraction of defect features.
[0048] The next step, S3, involves using a color space conversion algorithm to decompose the color scattering image into independent spectral components. This includes the following implementation steps: Step S301: The color scattering image is converted into a multi-dimensional numerical matrix. After receiving the 24-bit color scattering image transmitted in step S2, the back-end image processing unit parses it into a three-dimensional numerical matrix with a height of H, a width of W, and 3 channels in memory.
[0049] The first dimension of the matrix corresponds to the row coordinates of the image, the second dimension corresponds to the column coordinates of the image, and the third dimension corresponds to the pixel intensity values of the red, green and blue channels, respectively. The intensity value of each channel is stored in 8-bit unsigned integer format, with a value range of 0 to 255.
[0050] Step S302: Normalize the format of the original image data. If the image data output by the industrial camera is in Bayer format, i.e., adjacent pixels correspond to an interlaced arrangement of red, green, and blue filters, then first use a bilinear interpolation algorithm or an edge-guided interpolation algorithm to convert the Bayer format data into a standard RGB format where each pixel position has three independent channel values for red, green, and blue. If the industrial camera has already completed this conversion internally and directly outputs standard RGB format data, then skip this step and proceed directly to step S303.
[0051] Step S303: Perform color crosstalk correction. Because the spectral transmittance curves of the red, green, and blue filters inside the industrial camera overlap in adjacent wavelength bands—for example, the red filter has a weak transmittance of approximately 5% to 15% for green light near a wavelength of 520 nm—a small amount of green light response component that should be recorded by the green channel is mixed into the pixel values of the red channel. Similarly, similar crosstalk exists between the green and blue channels. To eliminate the interference of this spectral crosstalk on subsequent quantitative analysis, a preset color correction coefficient matrix is used to linearly compensate the pixel values of each channel.
[0052] The calibration method for the color correction coefficient matrix is as follows: After the detection system is built, only the first layer of red light source, the second layer of green light source, and the third layer of blue light source are lit in sequence. Each time the light is lit, the same standard white diffuse reflector is photographed with an industrial camera.
[0053] The average response values of the red, green, and blue channels are extracted from the image taken when only the red light source is lit, forming the first column of crosstalk response data; the average response values of the three channels are extracted from the image taken when only the green light source is lit, forming the second column of data; and the average response values of the three channels are extracted from the image taken when only the blue light source is lit, forming the third column of data.
[0054] Arrange the above 9 response values into a 3x3 original crosstalk matrix. Invert this matrix and multiply it by the ideal response matrix to obtain the color correction coefficient matrix. The ideal response matrix is a diagonal matrix, where the diagonal elements are the response values of the corresponding color channel when only the corresponding color light source is lit, and the off-diagonal elements are 0.
[0055] During the formal detection process, for each pixel location in the image, the original red, green, and blue channel pixel values are used to form a 3x1 column vector, which is then multiplied by the color correction coefficient matrix to obtain the corrected red, green, and blue pixel values.
[0056] The corrected red channel component restores the scattering field distribution generated purely by the incident red light at the first preset angle, the corrected green channel component restores the scattering field distribution generated purely by the incident green light at the second preset angle, and the corrected blue channel component restores the scattering field distribution generated purely by the incident blue light at the third preset angle.
[0057] Step S304: Decompose the corrected three-channel color image into a single-channel grayscale matrix. The corrected red channel data is extracted into a grayscale matrix with height H and width W, denoted as the first spectral component matrix. Each element in this matrix is the pixel intensity of the corrected red channel, mainly carrying scattering information from minor defects such as shallow scratches.
[0058] The corrected green channel data is extracted into a second spectral component matrix, primarily carrying scattering information from medium-scale surface undulations. The corrected blue channel data is extracted into a third spectral component matrix, primarily carrying scattering information from deep pits or substrate damage. These three single-channel grayscale matrices are stored in the image processing unit's pre-defined storage space, serving as the basic data source for subsequent geometric parameter calculations.
[0059] Step S305: Perform histogram equalization on each single-channel grayscale matrix. For the first spectral component matrix, the second spectral component matrix, and the third spectral component matrix, respectively, statistically analyze their grayscale histogram distributions, calculate the cumulative distribution function, and map the original grayscale values to new grayscale values, so that the grayscale histogram of the output image approximately follows a uniform distribution.
[0060] This processing enhances the visual contrast between the defect area and the background area, facilitating subsequent defect boundary identification. It should be noted that in the subsequent step S4, when quantitative calculations based on brightness ratios are performed, the raw linear grayscale values stored in step S304 without histogram equalization are used to ensure the physical consistency of the quantitative calculation results.
[0061] Step S3 yields three single-channel grayscale images that respectively reflect the red light scattering response at the first preset angle, the green light scattering response at the second preset angle, and the blue light scattering response at the third preset angle.
[0062] These three images depict the defect features of the same surface under test from different optical dimensions, providing input data for the quantitative calculation of the physical parameters of the defects in step S4 by combining the angle-depth mapping model.
[0063] Finally, for step S4, based on the brightness response values of each channel and combined with the preset angle-depth mapping model, the physical parameters of the defect are calculated, specifically according to the following steps: Step S401: Adaptive threshold segmentation is performed on the first spectral component matrix, the second spectral component matrix, and the third spectral component matrix respectively. For each single-channel grayscale matrix, a local neighborhood window of size M×M pixels is defined centered on each pixel, where M is a preset pixel constant, preferably an odd number between 5 and 15. The local mean μ and local standard deviation σ of the grayscale values of all pixels within this window are calculated.
[0064] The adaptive segmentation threshold for the pixel location is calculated using the formula T = μ + k·σ, where T is the segmentation threshold and k is a preset sensitivity coefficient ranging from 0.5 to 2.0. If the current pixel's grayscale value is greater than T, the pixel is marked as a foreground candidate point; otherwise, it is marked as background. Through the above adaptive thresholding process, the binarized defect candidate image for each channel is obtained.
[0065] Step S402: Extract connected components and determine the physical boundaries of defects in the binarized defect candidate images of each channel. An 8-adjacent connected component labeling algorithm is used to cluster the foreground pixels in the binary image; each set of connected pixels constitutes a candidate defect region.
[0066] For each candidate defect region, the grayscale gradient magnitude of each pixel within the region is calculated. The gradient is obtained by synthesizing the first derivatives along the horizontal and vertical directions using the Sobel operator. Pixels with gradient magnitudes greater than a preset gradient threshold are defined as the physical boundary of the defect region. This boundary determination method eliminates the interference of background brightness gradients on the definition of the defect range.
[0067] Step S403: Perform coordinate alignment and matching of the multi-channel connected components. Map the connected components extracted from the first, second, and third spectral component matrices to a unified global coordinate system. Since the three single-channel images originate from the same original color scattering image, each pixel corresponds one-to-one in space, and alignment can be completed directly using the same row and column coordinate indices.
[0068] For each connected component detected in the first spectral component matrix, a search is conducted within the same coordinate range of the second and third spectral component matrices to determine if a corresponding connected component exists. If a connected component at the corresponding position is detected in at least two channels, the region is confirmed as a real defect, and the defect region is located in all three channels.
[0069] Step S404: Calculate the pixel intensity feature values of each defect region in the three channels. For each defect region confirmed in step S403, calculate the grayscale values of all pixels within that region in the first spectral component matrix, the second spectral component matrix, and the third spectral component matrix, respectively.
[0070] Calculate the arithmetic mean of the gray values of all pixels within the connected region of the defect in the first spectral component matrix, denoted as the average pixel intensity IR of the first channel. Calculate the arithmetic mean of the gray values of all pixels within the connected region of the defect in the second spectral component matrix, denoted as the average pixel intensity IG of the second channel.
[0071] Calculate the arithmetic mean of the gray values of all pixels within the connected region of the defect in the third spectral component matrix, denoted as the third channel average pixel intensity IB. The aforementioned IR, IG, and IB are all taken from the original linear gray values stored in step S304 without histogram equalization.
[0072] Step S405 introduces an angle-depth mapping model to calculate the equivalent depth of the defect. This model is a set of nonlinear response equations established in the three-dimensional spectral response space, used to describe the mapping relationship between the defect depth and the intensity of scattered light from each channel.
[0073] The model is built on the following physical principles: shallow scratches are very shallow and produce a strong scattering response to red light incident at the first preset angle, while the scattering cross-section of blue light incident at the third preset angle is significantly reduced; deep pits or substrate damage cause multiple scattering, resulting in a strong scattered echo signal of blue light incident at the third preset angle.
[0074] Depth calculation is performed using the following formula: ; The symbols in the above formulas have the following meanings: D is the calculated equivalent depth of the defect region, in micrometers; The average pixel intensity of the first spectral component matrix within the same defect connected domain is dimensionless. The average pixel intensity of the second spectral component matrix within the same defect connected domain is dimensionless. The average pixel intensity of the third spectral component matrix within the same defect connected domain is dimensionless. The first preset angle mentioned in step S101 has a value of 15 degrees; The third preset angle mentioned in step S101 is 45 degrees; α is the depth scaling coefficient, used to convert the logarithmic value in parentheses into a depth value in micrometers; β is the green light channel intensity correction factor, used to adjust the contribution weight of the green light channel response to the depth calculation; γ is the depth reference offset, used to compensate for the inherent bias of the system, in micrometers.
[0075] The aforementioned correction coefficients α, β, and γ were obtained through the following calibration process. A set of standard defect samples with known depths were prepared. These standard defect samples were fabricated using an ion beam etching process on a substrate material similar to that of an optical lens, forming a series of rectangular grooves, each 5 micrometers wide and 200 micrometers long, but with varying depths. The depth values of each groove ranged from 0.5 micrometers to 10 micrometers at 0.5 micrometer intervals, with each depth value containing at least three duplicate samples. The calibrated detection system of this application was used to acquire images and perform spectral decomposition on each standard defect sample, extracting the IR, IG, and IB measurements corresponding to each sample with known depths. The known depth value was used as the dependent variable, and... Using α as the independent variable, a linear regression fitting is performed using the least squares method. The slope of the fitted line is the depth scaling coefficient α, and the intercept is the depth reference offset γ. The initial value of β is set to 1.0. Based on this, iterative optimization is used to minimize the root mean square error of depth prediction within different depth intervals, and the final value of β is determined. After calibration, α, β, and γ are stored as preset parameters in the configuration file of the image processing unit for use in each detection.
[0076] Step S406: Make a preliminary determination of the defect type based on the calculated equivalent depth D. When D is less than or equal to 2.0 micrometers, the defect type is determined to be shallow scratch; when D is greater than 2.0 micrometers and less than or equal to 5.0 micrometers, the defect type is determined to be deep scratch; when D is greater than 5.0 micrometers, the defect type is determined to be substrate edge chipping.
[0077] If the average pixel intensity IG of the second channel in the defective region is significantly higher than that of IR and IB, and the calculated depth is less than 1.0 micrometer, then the defect type is classified as an attachment. This classification threshold can be adjusted according to the quality standards in actual production.
[0078] Step S407: Digitally describe the geometry of the defect. For each connected component of the defect, calculate its second-order central moment. Let the set of pixel coordinates within the connected component be... Let i = 1, 2, ..., N, where N is the total number of pixels in the connected component. First, calculate the centroid coordinates of the connected component. Then calculate the following second moment: , , Construct the covariance matrix from the above second-order moments, and solve for the eigenvalues λ1 and λ2 of this matrix, where... .
[0079] The length of the major axis L is determined by the formula The length of the minor axis W is calculated according to the formula. Calculation. The shape factor F is defined as... , where A is the area of the connected region and P is the perimeter of the connected region. The roundness index C is defined as... ,in Let C be the area of the smallest bounding rectangle of the connected region. When C is greater than 0.7 and F is greater than 0.8, the defect is judged as a near-circular pit; when C is less than 0.4, it is judged as a long strip-shaped scratch.
[0080] Step S408: Convert the pixel size in the image space to the actual size in the physical space. The pixel equivalent conversion coefficient is pre-calibrated. Specifically, a standard grating plate with a known periodic pattern is placed at the inspection station. This standard grating plate is engraved with equally spaced parallel lines with a period of 100 micrometers.
[0081] The industrial camera of this application's detection system captures an image of the standard grating plate. The number of pixels occupied by N cycles along the direction perpendicular to the lines is measured in the image, where N is an integer between 10 and 20. The formula for calculating the pixel equivalent conversion factor K is as follows: ,in K represents the number of pixels occupied by N cycles, where K is in micrometers per pixel.
[0082] Actual length of the defect Through formula Calculation, where This refers to the pixel length of the major or minor axis of the defect in the image, obtained in step S407. The actual area of the defect. Through formula Calculation, where Let be the pixel area of the connected region. The maximum depth of the defect is directly calculated using the D value obtained in step S405.
[0083] Step S409: Generate and output a complete digital defect report. For each optical lens under test, summarize all detected defect areas, and record the following parameters for each defect area: defect number, defect type, scratch length or pit diameter, defect area, maximum depth, and center coordinates in the image. This digital report is stored in a local database in a structured data format and simultaneously transmitted to the manufacturing execution system via an industrial Ethernet interface.
[0084] Step S4 completes the quantitative conversion process from a three-channel grayscale image to defect physical parameters. The obtained parameters, such as defect type, depth, length, and area, form the data basis for subsequent quality assessment and process optimization.
[0085] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, the embodiments should be regarded as exemplary and non-limiting in all respects.
[0086] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A digital detection method for surface defects of optical lenses based on industrial vision, characterized in that, Includes the following steps: Step S1: Construct a multidimensional illumination field. The multidimensional illumination field is formed by illuminating the surface under test with a beam of light having a first wavelength range at a first preset angle, illuminating the surface under test with a beam of light having a second wavelength range at a second preset angle, and illuminating the surface under test with a beam of light having a third wavelength range at a third preset angle. There is a one-to-one physical coding relationship between each wavelength range and each preset angle. Step S2: Acquire a single-frame color scattering image of the lens under test under the multidimensional illumination field using an industrial camera; Step S3: Process the color scattering image to decompose it into first, second and third spectral response matrices corresponding to the first, second and third wavelength ranges, respectively; Step S4: Calculate the equivalent depth of the defect based on the scattered light intensity response value of the defect region extracted from each spectral response matrix and the angle-depth mapping model obtained by calibrating a standard defect sample with a known depth in advance. The angle-depth mapping model is used to describe the physical relationship of nonlinear scattering attenuation of incident light at different preset angles due to the difference in defect depth.
2. The digital detection method for optical lens surface defects based on industrial vision according to claim 1, characterized in that, The specific method for constructing the multidimensional lighting field in step S1 is as follows: A three-layer concentric ring-shaped composite light source structure is constructed. The first-layer ring light source component has a red wavelength range and its beam has an incident angle of 15 degrees at the center point of the surface to be measured. The second-layer ring light source component has a green wavelength range and its beam has an incident angle of 30 degrees at the center point of the surface to be measured. The third-layer ring light source component has a blue wavelength range and its beam has an incident angle of 45 degrees at the center point of the surface to be measured. Each ring light source component is connected to a light source controller that supports three independent pulse width modulation outputs via three independent electrical circuits, and the illumination intensity of each channel is balanced through a pre-calibration process.
3. The digital detection method for optical lens surface defects based on industrial vision according to claim 1, characterized in that, Before processing the color scattering image to obtain the spectral response matrix in step S3, a step of performing color crosstalk correction is also included: using a pre-calibrated color correction coefficient matrix to linearly compensate the red, green, and blue channel pixel values of each pixel in the original image to eliminate the signal crosstalk between channels caused by the overlap of the spectral transmittance curves of the internal filters of the industrial camera. The calibration process of the color correction coefficient matrix and the calibration process of the angle-depth mapping model share the same set of standard diffuse reflector plates and standard defect samples.
4. The digital detection method for optical lens surface defects based on industrial vision according to claim 1, characterized in that, The specific process of pre-calibrating the standard defect sample with a known depth in step S4 includes: preparing a set of standard defect samples with different precise depths on the same substrate material as the optical lens; using this detection system to perform image acquisition and spectral decomposition on each standard defect sample, and extracting the average pixel intensity in each spectral response matrix corresponding to each known depth. Using the known depth as the dependent variable and a function based on the ratio of scattered light intensity at different preset angles as the independent variable, regression fitting is performed to determine the scaling coefficients and offsets in the angle-depth mapping model.
5. The digital detection method for optical lens surface defects based on industrial vision according to claim 4, characterized in that, The angle-depth mapping model specifically expresses the quantization relationship between the defect equivalent depth D and the average pixel intensity of each channel in the following form: ,in, , , These represent the average pixel intensity of the defect region in the first, second, and third spectral component matrices, respectively. As the first preset angle, The third preset angle is α, which is the depth scaling coefficient obtained through the calibration process, β is the correction factor used to adjust the contribution weight of the green light channel response, and γ is the depth reference offset obtained through the calibration process.
6. The digital detection method for optical lens surface defects based on industrial vision according to claim 1, characterized in that, Before calculating the equivalent depth of the defect in step S4, the method further includes a step of verifying the authenticity of the defect regions extracted from each spectral response matrix: dynamic threshold segmentation based on local gray mean and standard deviation is performed on each spectral response matrix to obtain a binarized defect candidate image. A connected component labeling algorithm is used to extract candidate connected components in each binary defect candidate map. Candidate connected components in the same coordinate range in different spectral response matrices are matched. The region is identified as a real defect region only when there are mutually matching candidate connected components in at least two spectral response matrices.
7. The digital detection method for optical lens surface defects based on industrial vision according to claim 1, characterized in that, After calculating the equivalent depth of the defect in step S4, the method further includes a step of digitally describing the geometry of the defect: for the confirmed defect area, the pixel area and pixel perimeter in its image are calculated. The shape factor is calculated based on the pixel area and pixel perimeter to distinguish between near-circular defects and elongated defects; The eigenvalues of the covariance matrix are calculated based on the second-order central moments of the pixels in the defect region, and the major axis length and minor axis length of the defect are calculated based on the eigenvalues.
8. The digital detection method for optical lens surface defects based on industrial vision according to claim 7, characterized in that, After calculating the equivalent depth of the defect in step S4, the method further includes converting the geometric parameters of the image space into the actual size of the physical space: pre-calibrating the pixel equivalent conversion coefficient by photographing a standard grating plate with a known periodic pattern. The calculated defect pixel length and pixel area are multiplied by the pixel equivalent conversion coefficient or its square to obtain the actual physical length and actual physical area of the defect.
9. The digital detection method for optical lens surface defects based on industrial vision according to claim 1, characterized in that, After calculating the equivalent depth of the defect in step S4, the method further includes a step of determining the defect type based on the equivalent depth: comparing the calculated equivalent depth value with a preset depth threshold; when the equivalent depth is less than or equal to the first depth threshold, it is determined to be a shallow scratch; when the equivalent depth is greater than the first depth threshold and less than or equal to the second depth threshold, it is determined to be a deep scratch; when the equivalent depth is greater than the second depth threshold, it is determined to be a base chip. Furthermore, when the average intensity of the defect region extracted from the second spectral response matrix is significantly higher than the average intensity extracted from the first and third spectral response matrices, and the equivalent depth is less than the third depth threshold, it is determined to be a surface attachment.
10. The digital detection method for optical lens surface defects based on industrial vision according to claim 2, characterized in that, In step S2, the process of acquiring a single frame of color scattering image by an industrial camera adopts a trigger synchronization and double buffering mechanism: the sensor detects the position signal of the lens under test, and after the programmable logic controller performs delay compensation, a trigger pulse is sent to the industrial camera and the light source controller at the same time; the industrial camera responds to the pulse and opens the global shutter, and the light source controller synchronously drives each layer of ring light source components to complete pulsed strobe during the camera exposure. The back-end image processing unit receives and processes image data streams transmitted via GigE Vision or USB 3.0 Vision interfaces by alternately using the first and second buffers.