An optical lens edge collapse detection method based on anisotropic diffusion filtering

By constructing a structural tensor matrix and an adaptive diffusion coefficient, combined with polar coordinate transformation and confidence index, the accuracy problem of optical lens edge detection under complex lighting conditions in existing technologies is solved, achieving high-precision and stable edge chipping defect detection.

CN122199589APending Publication Date: 2026-06-12YIDU TONGCHUANG PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YIDU TONGCHUANG PHOTOELECTRIC TECH CO LTD
Filing Date
2026-03-17
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing gradient magnitude-based filtering methods cannot accurately distinguish between real edges and interfering textures when processing irregularly shaped or curved lenses, resulting in insufficient detection accuracy under complex lighting conditions, especially weak edges being over-smoothed or strong texture noise being mistakenly preserved.

Method used

By constructing a structural tensor matrix, calculating the structural orderliness, and introducing an adaptive diffusion coefficient, combined with polar coordinate transformation and confidence index, high-precision detection of the edge of optical lenses is achieved, suppressing the influence of uneven illumination.

Benefits of technology

High-precision automated detection of edge chipping defects on lenses was achieved under complex lighting conditions, effectively suppressing false alarms caused by non-defect interference such as water stains and dust, and improving the stability and accuracy of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199589A_ABST
    Figure CN122199589A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and particularly relates to an optical lens edge collapse detection method based on anisotropic diffusion filtering, which comprises the following steps: obtaining an optical lens edge image, calculating a structure tensor matrix and eigenvalues of a pixel gradient, and constructing a structure order degree reflecting a texture direction; constructing a structure weight term by using the structure order degree, adaptively adjusting a diffusion coefficient of the anisotropic diffusion filtering, and performing a smoothing processing on the image; scanning the filtered image through a polar coordinate transformation, and extracting an edge position sequence and a texture response sequence; constructing a collapse confidence index by combining a geometric residual and a variation coefficient of the texture response sequence, and determining a collapse defect according to the collapse confidence index. By introducing the structure order degree to replace a single gradient amplitude, the present application can effectively distinguish a real edge from a grinding texture, remove noise while retaining a weak edge feature, and improve the accuracy and stability of the collapse detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering. Background Technology

[0002] In the cold processing manufacturing of precision optical components such as spherical lenses, aspherical lenses, and prisms, after processes such as cutting, grinding, and chamfering, the edges of the lenses are prone to chipping defects due to mechanical stress. These chipping defects not only seriously affect the appearance quality of the optical components, but also become stress concentration points during subsequent use, which can easily lead to lens breakage. Therefore, high-precision automated detection of lens edge chipping is a key link in ensuring product yield.

[0003] Currently, the mainstream technology used in the industry for inspection is machine vision, among which anisotropic diffusion filtering is a core image preprocessing method. Traditional anisotropic diffusion filtering algorithms use gradient magnitude to control the diffusion coefficient: diffusion stops in regions with large gradients to preserve edges, and diffusion continues in regions with small gradients to smooth noise.

[0004] However, existing gradient magnitude-based detection methods have significant limitations when dealing with irregularly shaped or curved lenses. Due to the curvature variations at the lens edges, the reflected light intensity varies greatly at different locations under the same lighting conditions. Normal grinding textures in highly reflective areas exhibit extremely large gradients, which are misidentified as edges and retained by the algorithm, resulting in residual noise. Conversely, minor edge chips in low-light areas have extremely small gradients due to insufficient illumination, and are misidentified as noise and smoothed out, leading to feature loss. Furthermore, existing algorithms only utilize grayscale intensity information, ignoring the geometric direction of the edges. True lens edges, regardless of brightness, have a clear linear extension direction, while chipped edges and grinding textures are disordered and chaotic. Traditional methods fail to effectively utilize this structural feature, resulting in an inability to accurately distinguish between true edges and interfering textures under complex lighting conditions. Summary of the Invention

[0005] To address the technical problem that existing gradient magnitude-based filtering methods fail to utilize edge geometry information, resulting in the inability to accurately distinguish between real edges and interfering textures under complex lighting conditions, this invention provides an optical lens edge chipping detection method based on anisotropic diffusion filtering, comprising: acquiring a grayscale image of the optical lens edge, calculating the gradient field of each pixel in the grayscale image, constructing a structure tensor matrix based on the gradient field, performing eigenvalue decomposition on the structure tensor matrix to obtain eigenvalues, and calculating the structural orderliness of each pixel based on the eigenvalues; The structural orderliness is used to construct a structural weight term, and the adaptive diffusion coefficient is determined by combining the gradient magnitude. The image is then iteratively updated using partial differential equations based on the adaptive diffusion coefficient to obtain the filtered image. The filtered image is coarsely extracted for edges and the center of the fitted circle is determined by circle fitting. Polar coordinate transformation is performed with the center of the fitted circle as the origin. Edge points are scanned along the radial ray direction to generate a sequence of the position of the edge points from the fitted circle center and a texture response sequence of the structural tensor feature values ​​in the neighborhood of the edge points. The position sequence is detrended to obtain a geometric residual sequence. The coefficient of variation is calculated based on the local statistical characteristics of the texture response sequence. The edge collapse confidence index is constructed by combining the geometric residual sequence and the coefficient of variation. When the edge collapse confidence index exceeds a preset threshold, it is determined that there is an edge collapse defect at the corresponding position.

[0006] This invention constructs an adaptive diffusion filter guided by structural order, and then reduces the dimensionality of the two-dimensional image into a position sequence and a texture response sequence through polar coordinate transformation. It then integrates geometric residuals and coefficients of variation to construct a chipping confidence index, thereby achieving high-precision automated detection of edge chipping defects on lens under uneven illumination conditions. At the same time, it effectively suppresses false alarms caused by non-defect interference such as water stains and dust.

[0007] Preferably, the structural order is... The calculation formula is as follows: ; In the formula, and Each pixel The two eigenvalues ​​of the structure tensor matrix are given, and , To prevent the first tiny positive constant from having a denominator of zero.

[0008] Structural orderliness is constructed using the ratio of two eigenvalues ​​of the structure tensor matrix. and Because the ratio remains constant when the illumination changes and is magnified or reduced synchronously, the influence of the absolute value of illumination intensity on feature extraction is automatically eliminated, enabling the algorithm to accurately identify linear edge structures even in low-light areas. Preferably, the adaptive diffusion coefficient... The calculation formula is as follows: ; ; In the formula, For structural weights, For structural order, The gradient magnitude of a pixel. The structural sensitivity gain constant is... This is the sharpness control constant. It is the basic gradient threshold constant.

[0009] By incorporating the structural weight term into the diffusion coefficient calculation, the filtering behavior no longer depends solely on the gradient magnitude, but is also controlled by the texture orderliness. For dark edges with high orderliness, the structural weight term is large, diffusion is strongly suppressed, and weak edges are effectively protected. For bright noise with low orderliness, diffusion can proceed, enabling the differentiation between edges and noise even under extremely uneven lighting conditions.

[0010] Preferably, the iterative update of the image using partial differential equations is to obtain the image for the next iteration by adding the product of the current image and the time step and the divergence term, where the divergence term is the divergence of the product of the adaptive diffusion coefficient and the gradient of the current image.

[0011] Preferably, the generation of the position sequence and texture response sequence includes: The filtered image is coarsely extracted for edges and fitted with a circle to obtain the center of the fitted circle. The fitted circle is then scanned along the radial ray direction with the center of the fitted circle as the origin. The point with the largest gradient on each ray is taken as the edge point. The position sequence is formed by recording the Euclidean distance between the edge point and the fitted circle center, and the local mean of the larger eigenvalues ​​of the structural tensor matrix in the neighborhood of the edge point is formed by recording the texture response sequence.

[0012] By scanning along the radial ray with the fitted circle center as the origin and taking the point with the maximum gradient as the edge point, and recording the Euclidean distance and the local mean of the larger feature value, the two-dimensional image analysis is transformed into two one-dimensional sequences, decoupling the geometric information and the texture information, and reducing the computational complexity of subsequent discrimination.

[0013] Preferably, the detrending process of the position sequence to obtain the geometric residual sequence includes: The position sequence is smoothed to obtain a smooth baseline that reflects the overall contour of the lens; The absolute value of the difference between the position sequence and the smoothing baseline is calculated to obtain the geometric residual sequence.

[0014] By performing large-window smoothing on the position sequence to obtain the baseline, and then calculating the absolute value of the difference to obtain the geometric residual sequence, the low-frequency shape contour interference caused by the lens's own eccentricity or non-circular design is effectively eliminated, so that the geometric residual sequence only retains the local abrupt change information caused by the actual edge breakage.

[0015] Preferably, the edge collapse confidence index The calculation formula is as follows: ; In the formula, For angle index, It is a geometric residual sequence. The standard deviation of the texture response sequence within the local window. This represents the arithmetic mean of the texture response sequence within a local window. This is the weighting adjustment coefficient. To prevent the second small positive constant with a denominator of zero.

[0016] Preferably, after acquiring the grayscale image of the optical lens edge, the method further includes: The grayscale image is Gaussian smoothed to suppress thermal noise generated by the image sensor.

[0017] Preferably, when constructing the structure tensor matrix, a local weighted average of the gradient outer product is performed, and a Gaussian kernel is used to perform a convolution operation with the gradient outer product matrix.

[0018] When constructing the structure tensor matrix, a local weighted average of the gradient outer product is performed, and neighborhood information is introduced through Gaussian kernel convolution operation, so that the structure tensor matrix has the ability to resist isolated noise interference, and the obtained eigenvalues ​​more accurately reflect the local texture direction rather than single-point noise.

[0019] Preferably, the method further includes marking the regions where the edge collapse confidence index exceeds a preset threshold on a grayscale image and outputting the detection result of the edge collapse defect.

[0020] The technical solution of the present invention has the following beneficial technical effects: This invention introduces structural orderliness based on the ratio of eigenvalues ​​of the structural tensor, incorporating texture geometry information into the diffusion coefficient control system. This frees the filtering process from a single dependence on the absolute magnitude of the gradient amplitude, thereby strongly suppressing diffusion at weak light and dark edges to protect defect features, and effectively promoting diffusion at strong reflective noise to eliminate interference. This solves the core contradiction of traditional methods where uneven lighting leads to over-smoothing of weak edges and mis-preservation of strong texture noise.

[0021] Based on this, the two-dimensional image problem is reduced to two one-dimensional signals, position sequence and texture response sequence, by polar coordinate transformation. Then, the edge chipping confidence index is constructed by multiplication fusion. The edge chipping confidence index only shows a significant peak when the geometric concavity and texture roughness are synchronously abnormal. In this way, the complex image defect detection is transformed into a one-dimensional peak detection with high signal-to-noise ratio, so that single interference factors such as water stains and dust cannot trigger false alarms. Finally, high-precision and high-stability automated detection of edge chipping defects of precision optical lenses is achieved. Attached Figure Description

[0022] Figure 1 This is a flowchart of an optical lens edge chipping detection method based on anisotropic diffusion filtering according to an embodiment of the present invention.

[0023] Figure 2This is a schematic diagram illustrating a comparison of the edge signal processing effects of existing technologies and the present invention; Figure 3 This is a schematic diagram illustrating the distribution of the edge collapse confidence index calculated by the present invention. Detailed Implementation

[0024] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0025] Reference Figure 1 An optical lens edge chipping detection method based on anisotropic diffusion filtering includes steps S101 to S104: S101. Obtain the grayscale image of the edge of the optical lens, calculate the gradient field of each pixel in the image, construct the structure tensor matrix based on the gradient field, and perform eigenvalue decomposition on the structure tensor matrix to obtain eigenvalues. Calculate the structural orderliness of each pixel based on the eigenvalues.

[0026] Specifically, high-resolution grayscale images of the edges of optical lenses are acquired using industrial cameras. and grayscale images Gaussian smoothing is performed to obtain the input image. To suppress thermal noise generated by the image sensor, Gaussian kernel standard deviation The value range is [0.3, 2.0]. A balance needs to be struck between noise suppression and edge fidelity. If the value is too large, the image becomes excessively blurry, and weak edge features are suppressed; if the value is too small, sensor thermal noise residue is significant, interfering with subsequent gradient calculations. In another embodiment, for images acquired by a high-resolution industrial camera, the Gaussian kernel standard deviation... It is 1.2.

[0027] Further, calculate the input image The gradient field, i.e., the input image calculated using the Sobel operator or the central difference method. Each pixel Gradient in the horizontal direction and the gradient in the vertical direction For each pixel in the image, construct a... Symmetric positive semidefinite matrix This refers to the structure tensor matrix. To make the structure tensor matrix robust, a locally weighted average of the gradient outer product is applied using a Gaussian kernel. Convolution operation with the gradient outer product matrix, Gaussian kernel Standard deviation The spatial range of the aggregated neighborhood information of the structural tensor matrix is ​​determined, for example, It is 1.5. The value range is [0.5, 3.0]. When the skewness is small, there is insufficient neighborhood information, and the structural tensor matrix is ​​still affected by single-point noise, resulting in a decrease in the stability of the structural order. When the value is too large, the neighborhood range is too wide, and adjacent texture regions are mixed in the calculation, which reduces the ability of structural order to distinguish local texture direction.

[0028] ; In the formula, This represents the convolution operation. Then, for each pixel's structure tensor matrix... Eigenvalue decomposition yields two eigenvalues. and And assume . Represents the energy in the local principal direction. This represents energy perpendicular to the principal direction. Based on these two eigenvalues, the structural order is constructed. :

[0029] In the relation, To prevent the first tiny positive constant with a denominator of zero, preferably, 10 -5 , Its purpose is to prevent division by zero overflow when the sum of the feature values ​​of the dark area approaches zero, and its magnitude should be much smaller than the typical value of the sum of the feature values ​​of the normal area. The value range is

[10] . -7 10 -3 If the value is too large, it will compress the dynamic range of the structural order, making it difficult to distinguish between linear edges and messy textures.

[0030] The following uses specific numerical values ​​to verify the calculation logic of structural orderliness: At a certain linear edge, the energy is mainly concentrated in one direction, and the calculated eigenvalues ​​are... It is 100. It is 2. 10 -5 10 -5 If the degree of structural order can be ignored during calculation, then... At this point, the structural orderliness approaches 1, indicating that there is a clear linear structure at the current pixel, which conforms to the geometric features of the edge.

[0031] In a region with a chaotic texture, the energy in all directions is approximately approximate, and the calculated eigenvalues ​​are... It is 50. If the value is 48, then the structural orderliness is... At this point, the structural orderliness approaches 0, indicating that the texture is disordered at the pixels in the messy texture area.

[0032] By constructing structural orderliness, structural information representing texture direction can be extracted from the original image. Structural orderliness utilizes the ratio relationship of eigenvalues, when... and Simultaneously, when magnified or reduced, the ratio remains unchanged, automatically eliminating the influence of light intensity, thus constructing a geometric feature field unaffected by the absolute value of light intensity, providing a reliable basis for subsequent adaptive filtering.

[0033] S102. Construct a structural weight term using structural orderliness, determine the adaptive diffusion coefficient by combining the gradient magnitude, and iteratively update the image using partial differential equations based on the adaptive diffusion coefficient to obtain the filtered image.

[0034] Specifically, based on structural order Constructing structural weight terms :

[0035] Then determine the adaptive diffusion coefficient :

[0036] In the formula, The structural sensitivity gain constant determines the amplification factor of structural orderliness on diffusion suppression. Considering that the difference in structural orderliness between ordered edges and cluttered noise in lens edge detection scenarios is typically greater than 0.5, we will... Setting it to 10 will provide sufficient differentiation. The value range is [1, 50]. When As the threshold approaches, the structural weights contribute little to the modulation of the diffusion coefficient, and the filtering behavior degenerates into a traditional mode that relies solely on the gradient magnitude; when When the upper limit is exceeded, even areas with moderate orderliness will be overprotected, resulting in insufficient smoothing. In another embodiment, for curved lenses with severe reflections, The value is set at 25 to enhance the protection of ordered edges.

[0037] This is the sharpness control constant, which controls the steepness of the exponential function, i.e., the growth rate of the structural weight term as the structural orderliness changes from low to high. Taking 2 as an example, the region with an orderliness of 0.3 corresponds to The region with an orderliness of 0.9 corresponds to The weights of the two differ by approximately 3.3 times, demonstrating reasonable selectivity. In other embodiments, the weights can be adjusted based on the complexity of the texture features. , The value range is [0.5, 5]; when When the value is below 0.5, the weight differences between regions with different degrees of order are not significant, and the filter selectivity is weakened; when the value exceeds 5, the response curve is too steep, and grinding marks with moderate degree of order will also be used as edge protection, which will introduce interference.

[0038] The gradient magnitude of the current pixel is, i.e. . The basic gradient threshold constant should be determined by referring to the statistical distribution of gradient magnitudes in the noisy region of the image. In practice, the median of the gradient magnitudes in the noisy region can be used as the initial reference value. For example, It is 10. The value range is [3, 30]. When the gradient is much larger than the actual noise gradient level, the gradient term Generally small, with overly active diffusion, weak edges are at risk of being smoothed out; conversely... When the gradient is too small, the gradient term in most regions is much greater than 1, diffusion almost completely stops, and the smoothing ability is lost.

[0039] After determining the adaptive diffusion coefficient, the Gaussian-smoothed input image is... As the initial iteration image Using partial differential equations to process images Subsequent iterations, exemplarily The number of iterations is 10. The value range is [5, 30], and the number of iterations is... With time step The total diffusion amount is determined by the number of iterations. With time step Adjustments are required, namely When taking the upper limit of 0.25 It can be reduced appropriately. When taking the lower limit, it needs to be increased. To achieve the same smoothness depth. Insufficient iterations result in residual noise affecting subsequent edge detection; excessive iterations gradually erode edge details. The expression for iterative updates is:

[0040] In the formula, For the first The image at the next iteration, For the first The image at the next iteration, For the time step, to ensure numerical stability, The time step is set to 0.25 to ensure the numerical stability of the discretized partial differential equations. It should not exceed 0.25. The value range is [0.1, 0.25]. Exceeding the upper limit will cause numerical divergence, resulting in the destruction of image information; below the lower limit, the diffusion amount in a single iteration is too small, requiring a significant increase in the number of iterations to obtain an equivalent smoothing effect, thus reducing computational efficiency. This is the divergence term, i.e., the adaptive diffusion coefficient. With the current image gradient The divergence of the product of .

[0041] The following section details the parameter substitution calculations for the adaptive diffusion coefficient adjustment logic: In the dark edge region, weak light causes the gradient magnitude to... Smaller, for example It is 5, which is less than The basic gradient threshold constant is 10, but due to the structural orderliness at the dark edges... Even with a value of 0.9, it still exhibits a highly ordered linear structure. Calculate the structure weight term: Substituting into the expression for the adaptive diffusion coefficient: The adaptive diffusion coefficient is 0.061, which is close to 0. Diffusion is strongly suppressed, and dark edges are effectively protected and will not be smoothed out due to small gradients.

[0042] In bright noise regions, noise caused by strong reflections leads to changes in gradient amplitude. The value is 20, which is greater than the basic gradient threshold constant. The value is 10, but due to the chaotic structure at the noise point, the structural order is... The value is 0.1. Calculate the structure weight term: Substituting into the expression for the adaptive diffusion coefficient: The adaptive diffusion coefficient in the bright noise region is also small, dominated by the gradient term, consistent with the logic of traditional anisotropic diffusion filtering. However, under moderate gradient noise, due to the structural weight term... The value is 13.2, which is much smaller than 61.5 at the edge. The diffusion coefficient is relatively large, allowing for smooth progress.

[0043] By introducing a structural weight term to correct the adaptive diffusion coefficient, strong texture noise can be effectively smoothed out while preserving weak edges, thus solving the threshold failure problem caused by uneven illumination.

[0044] S103. Perform polar coordinate transformation on the filtered image, scan along the radial ray direction to find edge points, and generate the position sequence of the edge points from the fitted circle center and the texture response sequence of the structural tensor feature values ​​in the neighborhood of the edge points.

[0045] Specifically, the filtered image is first subjected to coarse edge extraction, that is, an edge detection algorithm is used to extract the set of coarse edge points of the lens contour. For example, edge detection algorithms include, but are not limited to, the Canny edge detection algorithm or a fixed threshold binarization method. Based on this, the center of the fitted circle is determined through circle fitting, that is, the set of coarse edge points is fitted with a circle using a least-squares circle fitting algorithm to obtain the fitted circle center of the optical lens. And the fitted radius. The least squares circle fitting algorithm determines the center coordinates and radius of the circle by minimizing the sum of the squared distances from all coarse edge points to the fitted circle circumference. This is a well-known technique in image processing and will not be elaborated upon here. Using the fitted circle center... Using the origin as the angle As the independent variable, The range of values ​​is to The filtered image is scanned along the radial ray direction.

[0046] It should be noted that for non-standard circular irregular lenses, the fitted circle center obtained by least-squares circle fitting is not a strict geometric center, but rather the best approximation center of the overall contour. Since the low-frequency offset caused by the lens's own shape contour is eliminated through detrending processing in subsequent step S104, minor deviations in the fitted circle center will not affect the sensitivity of the geometric residual sequence to detecting local abrupt changes in edge breakage. In another embodiment, the scanning origin can be determined using ellipse fitting or centroid calculation based on the actual lens shape.

[0047] On each ray, find the point with the largest gradient as the edge point, and record two key pieces of information about the edge point to form two one-dimensional sequences: Position sequence For the first The Euclidean distance between the edge point and the fitted circle center at each sampling angle, the position sequence reflects the geometric contour of the edge; Texture response sequence For the first The larger eigenvalue among the eigenvalues ​​of the structure tensor matrix in the neighborhood of the edge point at each sampling angle. The local mean, Representing the main direction energy, the texture response sequence reflects the roughness or reflectivity of the edge surface at the corresponding location; In the formula, For discretized angle indexes, For example, The value is 360, meaning that samples are taken every 1°. The value range is [180, 720]. When the angle is too small, the resolution is insufficient, and edge chipping defects with a narrow span may fall between two adjacent sampling angles and be missed. When the value is too large, the computational load of a single detection increases linearly, and overly dense sampling introduces redundant noise when the edge point positioning accuracy is limited.

[0048] By scanning along the radial ray angle by angle and recording the Euclidean distance and the local mean of the larger eigenvalues, the two-dimensional image analysis is transformed into a problem of processing two one-dimensional sequences. Geometric information and texture information are decoupled, and the computational complexity is reduced accordingly.

[0049] S104. Detrend the position sequence to obtain the geometric residual sequence. Calculate the coefficient of variation based on the local statistical characteristics of the texture response sequence. Combine the geometric residual sequence and the coefficient of variation to construct the edge collapse confidence index. When the edge collapse confidence index exceeds the preset threshold, it is determined that there is an edge collapse defect at the corresponding position.

[0050] Specifically, due to the possibility that the lens may be eccentric or designed to be non-circular, the position sequence Shape profiles containing low frequencies. For positional sequences. Smoothing is performed by using a large-window filter to fit the overall contour of the lens and obtain a smooth baseline. For example, a moving average filter is used with a smoothing window length of 51 sampling points to calculate the geometric residual sequence: ; Geometric residual sequence The unit of measurement is pixels, representing the degree of deviation of the edge point from the ideal contour. For example, the smoothing window length of the moving average filter is 51 sampling points, and the window length ranges from [21, 101]. This should be much larger than the typical span of edge chipping defects in the angular domain to adequately fit the overall contour shape of the lens. If the smoothing window length is too small, the local depressions caused by edge chipping are partially incorporated into the baseline, leading to an underestimation of the geometric residual and an increased risk of missed detection. If the window length is too large, the high-frequency shape changes of the non-circular lens contour cannot be adequately tracked by the baseline, resulting in false residuals and an increased false alarm rate.

[0051] Subsequently, a collapse confidence index was constructed. The confidence index for edge chipping is based on the fact that genuine edge chipping is inevitably accompanied by geometric depressions and texture fluctuations caused by cross-sectional roughness, i.e., geometric residual sequences. Large numerical value and large coefficient of variation. Collapse edge confidence index. The calculation expression is:

[0052] In the formula, Indexed by angle Texture response sequence within a centered local window standard deviation Texture response sequence within the same local window The arithmetic mean of the local window is used, for example, the length of the local window is 5, and the value of the local window length is in the range of [3, 15], which should match the typical span of the chipping defect in the angular domain. When the window length is less than 3, the statistical samples of the standard deviation and mean are too few, and a single abnormal sampling point can cause the coefficient of variation to fluctuate drastically; when the window length exceeds 15, the texture change signal of the chipping area is diluted by the surrounding normal area, and the positioning accuracy decreases. It is the coefficient of variation, which physically represents surface roughness and is a dimensionless number. For example, the weighting adjustment coefficient is... The weight is set to 5. In other embodiments, the weight adjustment coefficient can be set according to the actual application scenario and requirements. ,and The value range of is [1, 20]. An excessively high index can make the edge collapse confidence index too sensitive to the texture variation coefficient, and normal texture fluctuations may be amplified into false alarms. If the value is too small, the texture information will not contribute enough to the edge collapse confidence index, and the judgment will rely solely on the geometric residual, resulting in a decrease in the ability to resist interference. To prevent the second tiny positive constant with a denominator of zero, for example, It is 0.01. Functions and Similarly, both are used to prevent division by zero, but and The numerical magnitudes are different. Corresponding to the order of magnitude of eigenvalues, while The corresponding texture response sequence is on the order of magnitude of the mean. The range of values ​​for is [ [1], needs to be selected according to the actual range of texture response values, so that... Compared to The normal value can be ignored.

[0053] The following verifies the discrimination logic of the edge collapse confidence index, comparing the calculation results for normal edges, interference scenarios, and real edge collapse: At normal edges, the edges are smooth, and the geometric residual sequence... The value is 0.5 pixels, the texture is consistent with small fluctuations, and the arithmetic mean of the texture response sequence within the local window. 100, standard deviation The value is 2. The coefficient of variation is calculated as follows: Collapse confidence index The edge collapse confidence index value is extremely low and will not trigger an alarm.

[0054] At locations with water stains or dust interference, slight geometric abrupt changes may occur, affecting the geometric residual sequence. It has 2 pixels, but the surface is still smooth with minimal texture fluctuation. It is 80. The value is 4. The coefficient of variation is calculated as follows: Collapse confidence index Although there are geometric deviations, the edge collapse confidence index value is suppressed because the texture is normal, thus avoiding false alarms.

[0055] At the actual edge collapse point, there is a clear gap, and the geometric residual sequence... The image resolution is 10 pixels, the surface is rough, and the reflections and flicker are severe, causing drastic fluctuations in texture values. It is 100. The value is 40. The coefficient of variation is calculated as follows: Collapse confidence index The edge collapse confidence index showed a significant peak, far exceeding the values ​​of normal edges and interference scenes, making it highly susceptible to detection by a preset threshold. For example, the preset threshold... The preset threshold is 15. The value range is [5, 50]. In actual production, it can be determined by the known defect markings on the calibration sample: select the minimum value that allows all known chipped edges to be detected while preventing alarms from being triggered in normal areas. The value serves as the working threshold. When the threshold is too low, the false alarm rate increases; when the threshold is too high, minor edge defects may be missed.

[0056] The edge collapse confidence index adopts a multiplicative fusion strategy. The value will only increase significantly when both the geometric residual and the texture variation coefficient are abnormal. Single interference factors such as water stains or dust cannot independently trigger the over-threshold response, thus transforming edge collapse detection into a one-dimensional peak discrimination with high signal-to-noise ratio.

[0057] After the edge collapse confidence index exceeds a preset threshold, the area where the edge collapse confidence index exceeds the preset threshold is marked on the grayscale image, and the detection result of the edge collapse defect is output.

[0058] Reference Figure 2 The horizontal axis represents the sampling points at the edge expansion location, and the vertical axis represents the geometric amplitude of the edge. The original acquired signal is noisy, showing numerous burrs caused by grinding textures and a deep valley formed by edge chipping in the middle. The curves obtained from existing processing techniques show that the deep valleys of defects are excessively smoothed, resulting in blurred features. The curves obtained from the processing of this invention show that while removing most of the background noise and burrs, the sharp edges of the deep valleys of defects are completely preserved, verifying the superiority of adaptive diffusion filtering.

[0059] Reference Figure 3 The horizontal axis represents the sampling points at the edge expansion location, and the vertical axis represents the confidence index value of the edge collapse. Figure 3 The defect judgment threshold line in the code is the preset threshold. In non-defect areas, the edge collapse confidence index curve is close to 0, indicating that the algorithm has a strong ability to suppress normal textures and minor interferences; at defect locations, the edge collapse confidence index curve exhibits an extremely high and sharp single peak, exceeding the preset threshold. This indicates that the proposed method has high accuracy and high signal-to-noise ratio in locating edge chipping defects.

[0060] It should be noted that those skilled in the art can make various modifications and improvements without departing from the inventive concept, and these all fall within the scope of protection of this invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering, characterized in that, include: A grayscale image of the edge of an optical lens is acquired, the gradient field of each pixel in the grayscale image is calculated, a structure tensor matrix is ​​constructed based on the gradient field, and eigenvalue decomposition is performed on the structure tensor matrix to obtain eigenvalues. The structural orderliness of each pixel is calculated based on the eigenvalues. The structural orderliness is used to construct a structural weight term, and the adaptive diffusion coefficient is determined by combining the gradient magnitude. The image is then iteratively updated using partial differential equations based on the adaptive diffusion coefficient to obtain the filtered image. The filtered image is coarsely extracted for edges and the center of the fitted circle is determined by circle fitting. Polar coordinate transformation is performed with the center of the fitted circle as the origin. Edge points are scanned along the radial ray direction to generate a sequence of the position of the edge points from the fitted circle center and a texture response sequence of the structural tensor feature values ​​in the neighborhood of the edge points. The position sequence is detrended to obtain a geometric residual sequence. The coefficient of variation is calculated based on the local statistical characteristics of the texture response sequence. The edge collapse confidence index is constructed by combining the geometric residual sequence and the coefficient of variation. When the edge collapse confidence index exceeds a preset threshold, it is determined that there is an edge collapse defect at the corresponding position.

2. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, The degree of structural order The calculation formula is as follows: ; In the formula, and Each pixel The two eigenvalues ​​of the structure tensor matrix are given, and , To prevent the first small positive constant from having a denominator of zero.

3. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, The adaptive diffusion coefficient The calculation formula is as follows: ; ; In the formula, For structural weights, For structural order, The gradient magnitude of a pixel. The structural sensitivity gain constant is... This is the sharpness control constant. It is the basic gradient threshold constant.

4. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 3, characterized in that, The iterative update of the image using partial differential equations is to obtain the image for the next iteration by adding the product of the current image and the time step and the divergence term. The divergence term is the divergence of the product of the adaptive diffusion coefficient and the gradient of the current image.

5. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, The generation of the position sequence and texture response sequence includes: The filtered image is coarsely extracted for edges and fitted with a circle to obtain the center of the fitted circle. The fitted circle is then scanned along the radial ray direction with the center of the fitted circle as the origin. The point with the largest gradient on each ray is taken as the edge point. The position sequence is formed by recording the Euclidean distance between the edge point and the fitted circle center, and the local mean of the larger eigenvalues ​​of the structural tensor matrix in the neighborhood of the edge point is formed by recording the texture response sequence.

6. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, The process of detrending the position sequence to obtain the geometric residual sequence includes: The position sequence is smoothed to obtain a smooth baseline that reflects the overall contour of the lens; The absolute value of the difference between the position sequence and the smoothing baseline is calculated to obtain the geometric residual sequence.

7. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, The confidence index of edge collapse The calculation formula is as follows: ; In the formula, For angle index, It is a geometric residual sequence. The standard deviation of the texture response sequence within the local window. This represents the arithmetic mean of the texture response sequence within a local window. This is the weighting adjustment coefficient. To prevent the second small positive constant with a denominator of zero.

8. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, After acquiring the grayscale image of the optical lens edge, the process further includes: The grayscale image is Gaussian smoothed to suppress thermal noise generated by the image sensor.

9. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, When constructing the structure tensor matrix, a local weighted average of the gradient outer product is performed, and a Gaussian kernel is used to perform a convolution operation with the gradient outer product matrix.

10. The method for detecting edge chipping of optical lenses based on anisotropic diffusion filtering according to claim 1, characterized in that, It also includes marking areas where the edge breakage confidence index exceeds a preset threshold on a grayscale image and outputting the detection results of the edge breakage defect.