Error compensation method for circle diameter measurement based on CCD image sensor

Through dynamic light intensity evaluation and deep learning edge compensation model, the problems of edge blur and optical path deviation in the circular diameter measurement of transparent objects are solved, and high-precision circular diameter measurement is achieved.

CN120635176BActive Publication Date: 2025-10-21HANGZHOU SAITE SENSING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511141019.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2025-10-21
Estimated Expiration
2045-08-15

AI Technical Summary

Technical Problem

The existing CCD circular diameter measurement method has edge blur and optical path deviation when measuring transparent objects, resulting in high measurement errors.

Method used

Through dynamic light intensity evaluation and correction, combined with a deep learning edge compensation model, the image edge coordinate point set is obtained, and the actual circle radius is calculated through circle parameter fitting, and multi-dimensional compensation is performed to reduce measurement errors.

Benefits of technology

It effectively reduces the error in measuring the circular diameter of transparent objects, improves measurement precision and accuracy, and adapts to measurement needs under different light intensity and temperature conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635176B_ABST
    Figure CN120635176B_ABST
Patent Text Reader

Abstract

The application discloses a circle diameter measurement error compensation method based on a CCD image sensor, and the method comprises the following steps: acquiring a digital image of an object to be measured; performing dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image; generating an image edge coordinate point set through a preset edge compensation model on the corrected digital image; acquiring candidate points based on the image edge coordinate point set; generating a fitting circle through circle parameter fitting based on the candidate points; and calculating and acquiring an actual circle radius through a preset calibration proportion coefficient based on the fitting circle. Through dynamic light intensity evaluation and correction, the current light intensity parameter can be evaluated and adaptively adjusted to improve the contrast of the real edge. Meanwhile, through the preset edge compensation model, the real edge can be accurately positioned in a deep learning manner, so that the circle diameter measurement error of a transparent object is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a method for compensating circular diameter measurement errors based on a CCD image sensor. Background Art

[0002] CCD image sensors achieve circular diameter measurement through optical imaging and algorithm analysis. They can realize non-contact batch detection and efficiently adapt to the needs of automated production. They have become one of the mainstream technologies for circular diameter measurement.

[0003] The existing CCD circular diameter measurement method is mainly achieved through image edge extraction combined with circle fitting. It is currently relatively mature and has high accuracy in the measurement of conventional opaque, high-contrast objects. However, for the circular diameter measurement of transparent objects, due to the differences in light transmittance and refractive index of transparent objects, the circular diameter measurement of the object is prone to edge blur and optical path deviation, resulting in high measurement errors. Summary of the Invention

[0004] The purpose of this application is to provide a circular diameter measurement error compensation method based on a CCD image sensor, which performs multi-dimensional compensation on the circular diameter measurement of transparent objects to reduce measurement errors.

[0005] In a first aspect, the present application provides a method for compensating circular diameter measurement errors based on a CCD image sensor, which adopts the following technical solution:

[0006] Acquire a digital image of the object to be measured;

[0007] Performing dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image;

[0008] For the corrected digital image, a set of image edge coordinate points is generated by using a preset edge compensation model;

[0009] Based on the image edge coordinate point set, obtain candidate points;

[0010] Based on the candidate points, a fitting circle is generated by fitting the circle parameters;

[0011] Based on the fitted circle, the actual circle radius is calculated and obtained by presetting the calibration scale coefficient.

[0012] Through the above technical solution, dynamic light intensity evaluation and correction can be used to reduce the interference of light intensity changes on the edge detection of transparent objects. In addition, through the edge compensation model, the real edge can be accurately located through deep learning, thereby reducing the circular diameter measurement error of transparent objects.

[0013] Optionally, performing dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image includes:

[0014] Perform edge extraction on the digital image to obtain an initial edge mask;

[0015] Based on the initial edge mask, calculate and obtain the edge contrast mean;

[0016] Based on the initial edge mask, the pseudo edge ratio is obtained by using preset screening rules;

[0017] Determine whether the edge contrast mean is within a preset edge contrast mean threshold range and the pseudo edge ratio is less than a preset pseudo edge ratio threshold;

[0018] If not, determining the deviation mode and the deviation amplitude, and generating a light intensity correction coefficient according to the deviation mode and the deviation amplitude;

[0019] Based on the light intensity correction coefficient, a corrected digital image is generated.

[0020] Optionally, determining the deviation mode and the deviation amplitude, and generating the light intensity correction coefficient according to the deviation mode and the deviation amplitude, includes:

[0021] Determining a first deviation direction and a first deviation amplitude based on an edge contrast mean and a preset edge contrast mean threshold;

[0022] Determining a second deviation direction and a second deviation amplitude based on the pseudo edge ratio and a preset pseudo edge ratio threshold;

[0023] determining a deviation pattern based on the first deviation direction and the second deviation direction;

[0024] Based on the deviation mode, the corresponding deviation adjustment coefficient is matched through the preset edge correction library;

[0025] Based on the first deviation amplitude and the second deviation amplitude, a light intensity correction coefficient is generated through the deviation adjustment coefficient.

[0026] Optionally, it is characterized in that, after the dynamic light intensity evaluation and correction of the digital image is performed to generate a corrected digital image, the method further comprises:

[0027] Based on the digital image, obtain the current light intensity parameters;

[0028] Based on the light intensity parameters, the lighting characteristics of the image are determined through the preset parameter threshold;

[0029] Based on the illumination characteristics of the image, the corresponding preprocessing strategy is matched through the preset image preprocessing information library;

[0030] The digital image is preprocessed according to the preprocessing strategy.

[0031] Optionally, it is characterized in that, after the corrected digital image is subjected to a preset edge compensation model to generate an image edge coordinate point set, the method further comprises:

[0032] Obtain material information of the object to be measured and determine the temperature compensation threshold based on the material information;

[0033] If the temperature of the current measurement environment triggers the temperature compensation threshold, the temperature influence coefficient is determined through the preset temperature influence information library;

[0034] Based on the temperature influence coefficient, the image edge coordinate point set is corrected.

[0035] Optionally, obtaining candidate points based on the image edge coordinate point set includes:

[0036] Based on the image edge coordinate point set, obtain the grayscale value and neighborhood variance of the edge point;

[0037] Based on the gray value and neighborhood variance of the edge points, the image edge coordinate point set is preliminarily screened by a preset gray threshold and a preset neighborhood variance threshold to obtain preliminary candidate points;

[0038] Based on the preliminary candidate points, the normal vector angle difference between two adjacent edge coordinate points is calculated in sequence, and the candidate points are obtained by screening using a preset normal vector angle difference threshold.

[0039] Optionally, after generating a fitted circle by fitting circle parameters based on the candidate points, the following steps may be performed:

[0040] Verify the fitted circle and obtain the verification result;

[0041] If the verification result is passed, the current candidate point, fitting circle and associated measurement information are recorded and stored;

[0042] If the verification result is a verification failure, a first prompt message is output to indicate that the fitted circle is incorrect.

[0043] Optionally, verifying the fitted circle and obtaining a verification result includes:

[0044] Based on the fitted circle, valid edge points are obtained from the candidate points by presetting a specific distance threshold;

[0045] Calculate the effective edge point ratio and determine whether the effective edge point ratio is lower than the preset ratio threshold;

[0046] If the percentage of valid edge points is lower than the preset percentage threshold, the verification result is recorded as verification failure;

[0047] Calculate the average distance from the effective edge points to the fitting circle, record it as the fitting residual, and determine whether the fitting residual exceeds the preset fitting residual threshold;

[0048] If the fitting residual does not exceed the preset fitting residual threshold, the validation result is recorded as passed;

[0049] If the fitting residual exceeds the preset fitting residual threshold, the verification result is recorded as verification failure.

[0050] In a second aspect, the present application provides a circular diameter measurement error compensation system based on a CCD image sensor, comprising:

[0051] The data acquisition module 101 is used to acquire a digital image of the object to be measured;

[0052] A dynamic light intensity correction module 102 is used to perform dynamic light intensity evaluation and correction on a digital image to generate a corrected digital image;

[0053] The image edge compensation module 103 is used to generate an image edge coordinate point set for the corrected digital image using a preset edge compensation model;

[0054] The fitting circle generating module 104 is used to obtain candidate points based on the image edge coordinate point set, and generate a fitting circle based on the candidate points by fitting circle parameters;

[0055] The circle diameter result acquisition module 105 is used to calculate and obtain the actual circle radius based on the fitted circle by using a preset calibration scale coefficient.

[0056] In a third aspect, the present application provides a computer-readable storage medium storing a computer program that can be loaded by a processor and execute the above-mentioned circular diameter measurement error compensation method based on a CCD image sensor.

[0057] To summarize, the present application firstly evaluates and adaptively adjusts the current light intensity parameters through dynamic light intensity evaluation and correction to reduce the interference of light intensity changes on the edge detection of transparent objects, thereby improving the contrast of the real edge; in addition, by presetting the edge compensation model, multi-dimensional learning is performed on transparent objects with different material refractive indices and different thicknesses in a deep learning manner to help accurately locate the real edge of the object, thereby reducing the circular diameter measurement error of the transparent object; in addition, the circular diameter measurement error of the transparent object is further reduced by increasing compensation for the influence of temperature on the transparent object and performing geometric correction on the candidate points for generating the fitting circle. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 This is a flow chart of a method for compensating circular diameter measurement errors based on a CCD image sensor provided in an embodiment of the present application;

[0059] Figure 2This is a flow chart of light intensity evaluation and correction of a digital image provided by an embodiment of the present application;

[0060] Figure 3 This is a flow chart of generating a light intensity correction coefficient according to a deviation mode and a deviation amplitude provided in an embodiment of the present application;

[0061] Figure 4 This is a flowchart of obtaining candidate points based on an image edge coordinate point set provided by an embodiment of the present application;

[0062] Figure 5 This is a flow chart of verifying a fitted circle and obtaining a verification result provided by an embodiment of the present application;

[0063] Figure 6 These are the modules of a circular diameter measurement error compensation system based on a CCD image sensor provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] The following is combined with Figure 1 -Attached Figure 6 , further details of this application are given.

[0065] This application provides a method for compensating circular diameter measurement errors based on a CCD image sensor. Figure 1 , including the following steps:

[0066] S100: Acquire a digital image of the object to be measured.

[0067] Because this application is for measuring the circular diameter of transparent objects, the object to be measured is a circular object or a transparent object containing a circle that needs to be measured; the digital image is an image captured by a CCD image sensor. The object to be measured is optically refracted by the lens, and an inverted and reduced real image will be formed on the photosensitive surface of the CCD sensor. The digital image here defaults to a grayscale image.

[0068] In the embodiment of the present application, a digital image of the object to be measured is first acquired through a CCD image sensor.

[0069] S200 , performing dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image.

[0070] Since transparent objects are easily affected by surface reflected light, internal refracted light, and background light, the generated digital images will have blurred edges. Therefore, the light intensity of the digital images needs to be evaluated and adjusted to maximize the contrast of the edges.

[0071] Therefore, in an embodiment of the present application, after obtaining a digital image of the object to be measured, the light intensity of the digital image will be evaluated first to determine whether the current light intensity is appropriate. If it is not appropriate, the light intensity parameters will be adjusted and then the digital image will be regenerated.

[0072] Specifically, see Figure 2 , performing dynamic light intensity evaluation and correction on a digital image to generate a corrected digital image, comprising the following steps:

[0073] S210: Extract edges of the digital image to obtain an initial edge mask.

[0074] S220 : Calculate and obtain an edge contrast mean based on the initial edge mask.

[0075] S230 : Based on the initial edge mask, obtain the pseudo edge ratio through a preset screening rule.

[0076] S240: Determine whether the edge contrast mean is within a preset edge contrast mean threshold range and whether the pseudo edge ratio is less than a preset pseudo edge ratio threshold.

[0077] S250: If not, determine the deviation mode and deviation amplitude, and generate a light intensity correction coefficient according to the deviation mode and deviation amplitude.

[0078] S260: Generate a corrected digital image based on the light intensity correction coefficient.

[0079] Among them, the initial edge mask is a binary image, where edge pixels are 1 and non-edge pixels are 0. Edge extraction of the digital image is performed using a commonly used edge detection algorithm, such as the Canny and Sobel algorithms. The initial edge mask can be obtained by performing initial edge extraction on the digital image under the current light intensity through the edge detection algorithm.

[0080] Edge contrast is used to measure the clarity of true edge areas. The higher the edge contrast, the clearer the edge and the easier it is to distinguish. The false edge ratio is used to quantify the proportion of non-real edges in the image (such as non-real contours formed by reflective spots and refracted light spots).

[0081] For each edge pixel in the initial edge mask, the grayscale difference between it and the neighboring pixels, that is, the contrast, is calculated, and then the contrast of all initial edge pixels is averaged to obtain the edge contrast mean.

[0082] At the same time, based on the initial edge mask, the proportion of pseudo edges can be obtained through preset screening rules. The preset screening rules here are to screen pseudo edge pixels based on the characteristics of pseudo edges. For example, through connected domain analysis screening, isolated edge areas with an area less than the set threshold are eliminated, such as connected domains with an area less than 5 pixels are judged as pseudo edges; through prior contour screening, the initial edge points are fitted with a circle using the least squares method, the distance from each edge point to the fitted circle is calculated, and the points whose distance exceeds the set threshold are judged as pseudo edges.

[0083] After obtaining the pseudo-edge pixels through the screening rules, the pseudo-edge ratio can be calculated, that is, the ratio of the number of pseudo-edge pixels to the total number of pixels in the initial edge mask.

[0084] The larger the edge contrast mean, the better, but it cannot be too large, that is, a threshold range will be set for the edge contrast mean, that is, the preset edge contrast mean threshold range, which includes the lower limit threshold and upper threshold The lower threshold represents the minimum requirement for edge clarity; the upper threshold is used to avoid overexposure of the edge due to excessive light intensity. For example, for transparent glass objects, the lower threshold Set to 30~50, upper threshold Set to 150~200.

[0085] The smaller the pseudo edge ratio, the better. A threshold is also set for the pseudo edge ratio, that is, the preset pseudo edge ratio threshold , represents the maximum allowable false edge ratio. If it exceeds this ratio, it means that the reflection / refraction interference is serious. For example, the preset false edge ratio threshold Set to 5%~10%.

[0086] By presetting the edge contrast mean threshold range and the false edge ratio threshold, it is possible to determine whether the current light intensity is appropriate. <Edge Contrast Mean< And the proportion of pseudo edges is less than , the current light intensity is considered appropriate, otherwise it means that the current light intensity is not appropriate and needs to be adjusted.

[0087] To adjust the current light intensity, it is necessary to determine the deviation between the edge contrast and the pseudo-edge ratio and the corresponding threshold. There are five types of deviations, each corresponding to a deviation mode, as shown in Table 1.

[0088] Table 1

[0089]

[0090] Among them, "positive" means that the edge contrast is too high and the proportion of false edges exceeds the standard, and both require the light intensity to be weakened; "negative" means that the edge contrast is insufficient, and the light intensity needs to be enhanced.

[0091] After the deviation mode and deviation amplitude are determined, the light intensity correction coefficient can be generated according to the deviation mode and deviation amplitude. For details, see Figure 3 , including the following steps:

[0092] S251 : Determine a first deviation direction and a first deviation amplitude based on an edge contrast mean and a preset edge contrast mean threshold.

[0093] S252: Determine a second deviation direction and a second deviation amplitude based on the pseudo edge ratio and a preset pseudo edge ratio threshold.

[0094] S253: Determine a deviation mode based on the first deviation direction and the second deviation direction.

[0095] S254 , based on the deviation mode, matching the corresponding deviation adjustment coefficient through the preset edge correction library.

[0096] S255. Generate a light intensity correction coefficient based on the first deviation amplitude and the second deviation amplitude using the deviation adjustment coefficient.

[0097] Among them, the first deviation direction corresponds to the contrast deviation direction in Table 1, the second deviation direction corresponds to the pseudo edge deviation direction in Table 1; the first deviation amplitude corresponds to the contrast deviation amplitude in Table 1 The second deviation amplitude represents the pseudo edge deviation amplitude in Table 1 .

[0098] Based on the first deviation direction and the second deviation direction, a deviation mode can be determined. Then, based on the deviation mode, a corresponding deviation adjustment coefficient can be matched through a preset edge correction library. The preset edge correction library here refers to an edge correction information library determined based on edge contrast and pseudo-edge ratio, which includes multiple deviation modes, each of which has a corresponding deviation adjustment coefficient. The deviation adjustment coefficients here are also divided into two categories: the deviation adjustment coefficient for contrast is denoted as α, and the deviation adjustment coefficient for pseudo-edge is denoted as β.

[0099] Based on the deviation adjustment coefficient and the corresponding deviation amplitude, a light intensity correction coefficient can be generated.

[0100] The light intensity correction coefficient is ,but It can be expressed as:

[0101]

[0102] Among them, the contrast deviation amplitude and pseudo-edge deviation amplitude , a corresponding sign (+ / -) will be attached according to the corresponding deviation direction to indicate whether the current light intensity is increased or decreased.

[0103] After calculating the light intensity correction coefficient, the current light intensity can be corrected, that is, the corrected light intensity = current light intensity × (1- ).

[0104] For example, the current light intensity is 80%, =150, the actual edge contrast average is 200, that is =50, =10%, the actual pseudo edge ratio is 12%, that is =2%, deviation adjustment coefficient α=0.4, β=0.3. By substituting, we can calculate the light intensity correction coefficient =0.192, corrected light intensity = 80% × (1-0.192) = 64.6%.

[0105] It is worth noting that the light intensity correction coefficient can be assigned corresponding weights according to the importance of edge contrast and pseudo-edge, and can be flexibly set according to actual conditions. This application does not make any specific restrictions.

[0106] After obtaining the corrected light intensity, the CCD image sensor can be used to capture the image again based on the corrected light intensity to obtain a corrected digital image. After obtaining the corrected digital image, the light intensity will be evaluated and corrected again until the light intensity meets the set conditions.

[0107] After obtaining the corrected digital image, the digital image will be preprocessed, specifically including the following steps:

[0108] S261. Obtain current light intensity parameters based on the digital image.

[0109] S262: Determine the illumination characteristics of the image based on the light intensity parameter and a preset parameter threshold.

[0110] S263. Based on the illumination characteristics of the image, a corresponding preprocessing strategy is matched through a preset image preprocessing information library.

[0111] S264: Perform image preprocessing on the digital image according to the preprocessing strategy.

[0112] Among them, the light intensity parameters include the overall grayscale mean G, the highlight ratio H and the grayscale standard deviation S. Among them, the overall grayscale mean reflects the overall brightness of the image; the highlight ratio reflects the degree of reflection / overexposure; the grayscale standard deviation reflects the image contrast, that is, the difference between transparent objects and the background.

[0113] Since the image quality of transparent objects is greatly affected by light intensity, image preprocessing also needs to be adaptively adjusted according to changes in light intensity.

[0114] Therefore, in an embodiment of the present application, the current light intensity parameters are first determined based on the digital image, and then the lighting characteristics of the image are determined based on the light intensity parameters, and then the image is pre-processed in a targeted manner, so as to provide more accurate edge contour information for subsequent circular diameter measurement.

[0115] Among them, the lighting characteristics of the image include excessive light intensity, too low light intensity, moderate light intensity and uneven light intensity; the preset parameter threshold is the threshold set for the light intensity parameter based on the lighting characteristics of the image. For example, the parameter threshold for moderate light intensity is: 80≤G≤180, H≤5%, S≤30; the parameter threshold for excessive light intensity is: G>180, H>5%; the parameter threshold for insufficient light intensity is: G<80, S<20; the parameter threshold for uneven light intensity is: 80≤G≤180, S>50.

[0116] It is worth noting that the setting of parameter thresholds does not cover all digital ranges. When determining the lighting features of an image based on the parameter thresholds, they will be matched one by one according to priority. For example, the overall grayscale mean G will be considered first, then the highlight ratio H, and finally the grayscale standard deviation S will be considered to determine the matching lighting features.

[0117] After determining the lighting characteristics of the image, the corresponding preprocessing strategy will be matched through the preset image preprocessing information library. The preset image preprocessing information library here contains multiple preprocessing operations. For example, for excessive light intensity, histogram equalization will be used to weaken contrast enhancement, region generation method will be used to strengthen highlight restoration, and threshold segmentation will be used to reduce the missegmentation of overexposed areas.

[0118] After matching the corresponding preprocessing strategy, the digital image can be preprocessed according to the preprocessing strategy. This preprocessing method that combines light intensity perception and adaptive preprocessing can significantly improve robustness, especially in scenes where transparent objects have large fluctuations in image quality due to changes in light intensity.

[0119] S300 , generating an image edge coordinate point set for the corrected digital image using a preset edge compensation model.

[0120] Since there may still be residual edge offset in the image after dynamic light intensity adjustment, such as edge offset caused by refraction of transparent objects, in order to obtain the true edge of the image, corresponding edge compensation must be performed on the image.

[0121] In an embodiment of the present application, a deep learning model is used to perform edge compensation, that is, a preset edge compensation model is used to learn the mapping relationship between optical interference and edge deviation, and then deviation compensation is performed. Finally, the compensated real edge is directly output and recorded as an edge coordinate point set, that is, the set of coordinates of all edge pixel points.

[0122] Among them, the preset edge compensation model is to generate digital images by using transparent objects with known true circular diameters to shoot under a variety of different light intensities and angles, and to mark the real edges and pseudo edges of the images as a data set. Then, a deep network model is constructed, such as using U-Net or ResNet, with minimizing the distance between the predicted edge and the real edge as the objective function, and the generated model is generated through iterative training and continuous optimization.

[0123] Through the edge compensation model, the predicted real edge can be directly output for the input digital image. In addition, in order to expand the data set, a variety of transparent objects with different refractive indices and thicknesses are used to participate in the collection of the data set, making the edge compensation model more generalizable and greatly reducing the edge deviation error caused by optical interference.

[0124] In addition, considering that the temperature in the measurement environment also has a certain influence on the circular diameter measurement, the embodiment of the present application also adds temperature compensation for the circular diameter measurement, specifically, including the following steps:

[0125] S310: Obtain material information of the object to be measured, and determine a temperature compensation threshold according to the material information.

[0126] S320: If the temperature of the current measurement environment triggers the temperature compensation threshold, determine the temperature impact coefficient through a preset temperature impact information library.

[0127] S330 , correcting the image edge coordinate point set based on the temperature influence coefficient.

[0128] Since the object to be measured has a reference measurement environment, including a reference temperature, when there is a large difference between the actual measured temperature and the reference temperature, it is considered that error compensation is required.

[0129] Furthermore, considering that objects made of different materials correspond to different reference environments, it is necessary to first obtain the object's material information and then determine the temperature compensation threshold based on this material information. The material information here refers to the type of transparent object being measured, such as ordinary glass, quartz glass, plastic, or metal. The temperature compensation threshold is the maximum allowable difference between the actual measurement temperature and the reference temperature without affecting the circular diameter measurement.

[0130] If the temperature of the current measurement environment triggers the temperature compensation threshold, the temperature influence coefficient is determined through the preset temperature influence information library. The preset temperature influence information library here stores information on the influence of temperature on different transparent object materials, including the temperature influence coefficient. The temperature influence coefficient is divided into two categories, one is the expansion coefficient, and the other is the temperature refractive index coefficient.

[0131] After determining the temperature influence coefficient, the edge offset can be determined based on the temperature influence coefficient and the image edge coordinate point set can be corrected.

[0132] The expansion coefficient is , the temperature refractive index coefficient is , the edge offset is ,but It can be expressed as:

[0133]

[0134] in, Indicates the current ambient temperature. Indicates the reference temperature.

[0135] In this embodiment of the present application, by monitoring the current ambient temperature and comparing it with the reference temperature of the object being measured, it is possible to determine whether the temperature's impact on the measurement result is significant, that is, whether the temperature compensation threshold has been triggered. If the temperature compensation threshold is triggered, the corresponding temperature influence coefficient is determined based on the material of the object being measured. Substituting this into the temperature influence coefficient, the offset of the image edge under the influence of temperature can be calculated. With this offset, the image edge coordinate point set can be corrected.

[0136] S400: Obtain candidate points based on an image edge coordinate point set.

[0137] S500 : Generate a fitting circle based on the candidate points by fitting circle parameters.

[0138] In an embodiment of the present application, after determining the image edge coordinate point set, a fitting circle can be generated by circle parameter fitting. The essence of circle parameter fitting is to calculate the center and radius of the circle through the edge point set. Its accuracy directly depends on the validity of the input point set, that is, the point set should contain enough real edge points and as few noise points and pseudo edge points as possible.

[0139] Therefore, after determining the image edge coordinate point set, it is necessary to filter the image edge coordinate point set to obtain candidate points.

[0140] Since transparent objects have complex edges due to their optical properties, the acquisition of candidate points also requires targeted optimization of pseudo edges caused by reflection and refraction.

[0141] Specifically, see Figure 4 , based on the image edge coordinate point set, obtaining candidate points includes the following steps:

[0142] S410 , based on the image edge coordinate point set, obtaining the grayscale value and neighborhood variance of the edge point.

[0143] S420 , based on the grayscale value and neighborhood variance of the edge point, the image edge coordinate point set is preliminarily screened by a preset grayscale threshold and a preset neighborhood variance threshold to obtain preliminary candidate points.

[0144] S430 , based on the preliminary candidate points, sequentially calculating the normal vector angle difference between two adjacent edge coordinate points, and screening them using a preset normal vector angle difference threshold to obtain candidate points.

[0145] Because reflections on transparent surfaces create points with high grayscale values, these points are often false edge points. Therefore, by calculating the grayscale values ​​of edge points and setting a grayscale threshold, edge points with grayscale values ​​above the preset threshold are removed. Furthermore, the grayscale changes around the reflective points are smooth, which can be further confirmed by calculating the neighborhood variance. If the neighborhood variance is less than the preset neighborhood variance threshold, the point is considered a false edge and is removed.

[0146] Furthermore, since transparent objects may produce false edges due to refraction, the normal vector directions of these false edge points may differ from those of the true edge points. By calculating the normal vectors of adjacent edge points, if the angular difference between the normal vectors reaches a preset angular difference threshold, the point is identified as a false edge point due to refraction and is removed.

[0147] It is worth noting that the preset angle difference threshold here is related to the circle size of the object to be measured. Because the smaller the radius of the circle, the greater the edge curvature, and the greater the angle difference between adjacent points. The angle difference threshold can be dynamically set according to actual conditions.

[0148] The edge coordinate point set can be preliminarily screened by the grayscale value and neighborhood variance of the edge point to obtain preliminary candidate points. Then, for the preliminary candidate points, further screening is performed by the normal vector angle difference of the adjacent points. Finally, the remaining edge coordinate points are the candidate points.

[0149] In an embodiment of the present application, after determining the candidate points, a fitting circle can be generated based on the candidate points by fitting the circle parameters. The so-called circle parameter fitting is to set the standard circle equation and take the minimization of the sum of the squares of the distances from all candidate points to the circle as the objective function to find the optimal circle parameters, that is, the coordinates of the center of the circle and the radius. The circle parameters can be calculated by solving the problem using the least squares method, thereby generating a fitting circle.

[0150] Considering that the generated fitting circle may have fitting errors, for example, the arc-shaped pseudo-edge formed by the reflection of a transparent object is mistakenly judged as a circle or the offset caused by the pseudo-edge point, the generated fitting circle needs to be verified.

[0151] Therefore, in the embodiment of the present application, after generating a fitted circle by fitting the circle parameters based on the candidate points, the following steps are further included:

[0152] S510: Verify the fitted circle and obtain a verification result.

[0153] S520: If the verification result is passed, the current candidate point, the fitted circle and the associated measurement information are recorded and stored.

[0154] S530: If the verification result is a verification failure, output a first prompt message to indicate that the fitted circle is incorrect.

[0155] First, the fitted circle is verified and the verification results are obtained, where the verification results are divided into verification pass and verification fail.

[0156] Specifically, see Figure 5 , verify the fitted circle and obtain the verification result, including the following steps:

[0157] S511 , based on the fitted circle, obtain valid edge points from the candidate points by setting a specific distance threshold.

[0158] S512: Calculate the effective edge point ratio, and determine whether the effective edge point ratio is lower than a preset ratio threshold.

[0159] S513: If the proportion of valid edge points is lower than the preset proportion threshold, the verification result is recorded as verification failure.

[0160] S514: Calculate the average distance from the valid edge points to the fitting circle, record it as the fitting residual, and determine whether the fitting residual exceeds a preset fitting residual threshold.

[0161] S515: If the fitting residual exceeds a preset fitting residual threshold, the verification result is recorded as verification failure.

[0162] S516: If the fitting residual does not exceed the preset fitting residual threshold, the verification result is recorded as passed.

[0163] Among them, the valid edge point represents the candidate point where the fitting circle matches the edge of the real object. If the distance from the candidate point to the fitting circle is lower than the preset distance threshold, the candidate point will be considered a valid edge point.

[0164] The effective edge point ratio indicates the proportion of effective edge points to all candidate points. The more effective edge points there are, the more accurate the generated fitting circle is. On the other hand, if the effective edge point ratio is small, it will be considered that the fitting circle has a large deviation. Therefore, a judgment is made by setting a ratio threshold. If the effective edge point ratio is lower than the preset ratio threshold, it means that the generated fitting circle has a large error, so the output verification result is verification failure.

[0165] In addition to determining the proportion of valid edge points, it is also necessary to calculate the deviation between the fitting circle and the true edge of the object to characterize the accuracy of the fitting circle. Therefore, the average distance from the valid edge point to the fitting circle is also calculated and recorded as the fitting residual. It is also judged whether the fitting residual exceeds the preset fitting residual threshold. If the fitting residual does not exceed the preset fitting residual threshold, it means that the fitting circle fits the true edge, and the output verification result is verification passed; if the fitting residual exceeds the preset fitting residual threshold, it means that the fitting circle has a large deviation from the true edge, and the output verification result is verification failed.

[0166] If the verification result is passed, it means that the current fitting circle meets the requirements and can be used directly to determine the diameter of the object to be measured. At the same time, the current candidate point, fitting circle and associated measurement information will be recorded and stored. The associated measurement information here is the relevant parameters and other data information used in the previous measurement link. This can be used to generate a corresponding measurement parameter template, which can be used as a reference for subsequent diameter measurements of transparent objects of the same type. This can also help to improve the measurement efficiency of the object's diameter.

[0167] If the verification result is verification failure, it means that the generated fitting circle has a large error, so the first prompt information will be output to indicate that the currently generated fitting circle fails to pass the verification and needs to be regenerated.

[0168] S600: Based on the fitted circle, calculate and obtain the actual circle radius by using a preset calibration scale coefficient.

[0169] In the embodiment of the present application, after the fitting circle is verified, the actual circle radius can be obtained through the fitting circle, because the generated fitting circle is a pixel circle generated based on the digital image, and the image size and the actual size of the object have a corresponding conversion ratio, and this ratio is related to the imaging parameters of the CCD image sensor, that is, the preset calibration ratio coefficient.

[0170] The preset calibration scale factor is calculated by taking an image of a circular object with known actual size under the same imaging conditions and calculating the ratio of the image size to the actual size.

[0171] By presetting the calibration scale factor, the radius of the actual circle can be calculated from the radius of the fitted circle.

[0172] The present application also provides a CCD image sensor-based circular diameter measurement error compensation system, see Figure 6 The system includes: a data acquisition module 101, a dynamic light intensity correction module 102, an image edge compensation module 103, a fitting circle generation module 104, and a circle diameter result acquisition module 105.

[0173] The data acquisition module 101 is used to acquire a digital image of the object to be measured.

[0174] The dynamic light intensity correction module 102 is used to perform dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image.

[0175] The image edge compensation module 103 is used to generate an image edge coordinate point set for the corrected digital image by using a preset edge compensation model.

[0176] The fitting circle generating module 104 is configured to obtain candidate points based on the image edge coordinate point set, and generate a fitting circle based on the candidate points by fitting circle parameters.

[0177] The circle diameter result acquisition module 105 is used to calculate and obtain the actual circle radius based on the fitted circle by using a preset calibration scale coefficient.

[0178] In the embodiment of the present application, the data acquisition module 101 is specifically used to acquire a digital image of the object to be measured.

[0179] The dynamic light intensity correction module 102 is specifically configured to perform dynamic light intensity evaluation and correction on the digital image acquired by the data acquisition module 101 to generate a corrected digital image.

[0180] The image edge compensation module 103 is specifically used to generate an image edge coordinate point set for the digital image corrected by the dynamic light intensity correction module 102 by using a preset edge compensation model.

[0181] The fitting circle generation module 104 is specifically configured to obtain candidate points based on the image edge coordinate point set generated by the image edge compensation module 103 , and generate a fitting circle based on the candidate points by fitting circle parameters.

[0182] The circle diameter result acquisition module 105 is specifically configured to calculate and acquire the actual circle radius based on the fitted circle generated by the fitted circle generation module 104 by using a preset calibration scale coefficient.

[0183] An embodiment of the present application further provides a computer-readable storage medium storing a computer program that can be loaded by a processor and execute any of the above-mentioned methods for compensating circular diameter measurement errors based on a CCD image sensor.

[0184] The embodiments of this specific implementation method are all preferred embodiments of the present application and are not intended to limit the scope of protection of the present application. Therefore, all equivalent changes made based on the principles of the present application should be included in the scope of protection of the present application.

Claims

1. A method for compensating circular diameter measurement errors based on a CCD image sensor, characterized in that: include: Acquire a digital image of the object to be measured; Performing dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image; The performing dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image includes: Perform edge extraction on the digital image to obtain an initial edge mask; Based on the initial edge mask, calculate and obtain the edge contrast mean; Based on the initial edge mask, the pseudo edge ratio is obtained by using preset screening rules; Determine whether the edge contrast mean is within a preset edge contrast mean threshold range and the pseudo edge ratio is less than a preset pseudo edge ratio threshold; If not, determining the deviation mode and the deviation amplitude, and generating a light intensity correction coefficient according to the deviation mode and the deviation amplitude; Based on the light intensity correction coefficient, a corrected digital image is generated; For the corrected digital image, a set of image edge coordinate points is generated by using a preset edge compensation model; Based on the image edge coordinate point set, obtain candidate points; Based on the candidate points, a fitting circle is generated by fitting the circle parameters; Based on the fitted circle, the actual circle radius is calculated and obtained by presetting the calibration scale coefficient.

2. The method for compensating circular diameter measurement error based on a CCD image sensor according to claim 1, characterized in that: The step of determining the deviation mode and the deviation amplitude, and generating a light intensity correction coefficient according to the deviation mode and the deviation amplitude, includes: Determining a first deviation direction and a first deviation amplitude based on an edge contrast mean and a preset edge contrast mean threshold; Determining a second deviation direction and a second deviation amplitude based on the pseudo edge ratio and a preset pseudo edge ratio threshold; determining a deviation pattern based on the first deviation direction and the second deviation direction; Based on the deviation mode, the corresponding deviation adjustment coefficient is matched through the preset edge correction library; Based on the first deviation amplitude and the second deviation amplitude, a light intensity correction coefficient is generated through the deviation adjustment coefficient.

3. The method for compensating circular diameter measurement error based on a CCD image sensor according to claim 1, characterized in that: After the dynamic light intensity evaluation and correction of the digital image is performed to generate a corrected digital image, the method further comprises: Based on the digital image, obtain the current light intensity parameters; Based on the light intensity parameters, the lighting characteristics of the image are determined through the preset parameter threshold; Based on the illumination characteristics of the image, the corresponding preprocessing strategy is matched through the preset image preprocessing information library; The digital image is preprocessed according to the preprocessing strategy.

4. The method for compensating circular diameter measurement error based on a CCD image sensor according to claim 1, characterized in that: After the corrected digital image is subjected to a preset edge compensation model to generate an image edge coordinate point set, the method includes: Obtain material information of the object to be measured and determine the temperature compensation threshold based on the material information; If the temperature of the current measurement environment triggers the temperature compensation threshold, the temperature influence coefficient is determined through the preset temperature influence information library; Based on the temperature influence coefficient, the image edge coordinate point set is corrected.

5. The method for compensating circular diameter measurement error based on a CCD image sensor according to claim 1, characterized in that: The step of obtaining candidate points based on the image edge coordinate point set includes: Based on the image edge coordinate point set, obtain the grayscale value and neighborhood variance of the edge point; Based on the gray value and neighborhood variance of the edge points, the image edge coordinate point set is preliminarily screened by a preset gray threshold and a preset neighborhood variance threshold to obtain preliminary candidate points; Based on the preliminary candidate points, the normal vector angle difference between two adjacent edge coordinate points is calculated in sequence, and the candidate points are obtained by screening using a preset normal vector angle difference threshold.

6. The method for compensating circular diameter measurement error based on a CCD image sensor according to claim 1, characterized in that: After generating a fitted circle based on the candidate points by fitting the circle parameters, the method includes: Verify the fitted circle and obtain the verification result; If the verification result is passed, the current candidate point, fitting circle and associated measurement information are recorded and stored; If the verification result is a verification failure, a first prompt message is output to indicate that the fitted circle is incorrect.

7. The method for compensating circular diameter measurement error based on a CCD image sensor according to claim 6, characterized in that: The verifying of the fitted circle and obtaining the verification result includes: Based on the fitted circle, valid edge points are obtained from the candidate points by presetting a specific distance threshold; Calculate the effective edge point ratio and determine whether the effective edge point ratio is lower than the preset ratio threshold; If the percentage of valid edge points is lower than the preset percentage threshold, the verification result is recorded as verification failure; Calculate the average distance from the effective edge points to the fitting circle, record it as the fitting residual, and determine whether the fitting residual exceeds the preset fitting residual threshold; If the fitting residual exceeds the preset fitting residual threshold, the verification result is recorded as verification failure; If the fitting residual does not exceed the preset fitting residual threshold, the validation result is recorded as passed.

8. A circular diameter measurement error compensation system based on a CCD image sensor, characterized in that: include: A data acquisition module (101) is used to acquire a digital image of the object to be measured; The dynamic light intensity correction module (102) is used to perform dynamic light intensity evaluation and correction on the digital image to generate a corrected digital image, wherein the dynamic light intensity evaluation and correction on the digital image to generate the corrected digital image comprises: Perform edge extraction on the digital image to obtain an initial edge mask; Based on the initial edge mask, calculate and obtain the edge contrast mean; Based on the initial edge mask, the pseudo edge ratio is obtained by using preset screening rules; Determine whether the edge contrast mean is within a preset edge contrast mean threshold range and the pseudo edge ratio is less than a preset pseudo edge ratio threshold; If not, determining the deviation mode and the deviation amplitude, and generating a light intensity correction coefficient according to the deviation mode and the deviation amplitude; Based on the light intensity correction coefficient, a corrected digital image is generated; An image edge compensation module (103) is used to generate an image edge coordinate point set for the corrected digital image using a preset edge compensation model; A fitting circle generation module (104) is used to obtain candidate points based on an image edge coordinate point set, and to generate a fitting circle based on the candidate points by fitting circle parameters; The circle diameter result acquisition module (105) is used to calculate and obtain the actual circle radius based on the fitted circle by using a preset calibration scale coefficient.

9. A computer-readable storage medium storing a computer program capable of being loaded by a processor and executing the method for compensating circular diameter measurement errors based on a CCD image sensor according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Aperture measurement method and device based on distortion compensation and adaptive mean value blur

    CN115689929A

  • Semiconductor detection equipment calibration system

    CN119624921A