Single-pixel distance calibration method

Iterative optimization of single-pixel distance calibration using standard gauges enhances precision, addressing measurement inaccuracies and improving industrial image processing accuracy.

CN116071430BActive Publication Date: 2025-07-15WEIHAI BEIYANG ELECTRIC VEHICLE GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111290890.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-02
Publication Date
2025-07-15
Estimated Expiration
2041-11-02

AI Technical Summary

Technical Problem

In the prior art, the measurement accuracy of single pixel distance is insufficient, which cannot meet the high-precision measurement requirements, affecting the measurement accuracy of industrial image processing.

Method used

By acquiring the standard device image, setting the single pixel distance retrieval interval, iteratively optimizing the single pixel distance using iteration and optimization functions, and updating the parameters in combination with the gradient descent method until the expected accuracy is achieved, and the optimal single pixel distance value is output.

Benefits of technology

It significantly improves the accuracy of single pixel distance and improves the measurement accuracy of industrial image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116071430B_ABST
    Figure CN116071430B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and specifically to a single-pixel distance calibration method that can significantly improve the single-pixel distance accuracy and thus increase the industrial image processing accuracy. It is characterized in that a standard device image is acquired, and the size information of the standard device is read; a single-pixel distance retrieval interval is set, the single-pixel distance values within the iteration interval are iterated, an optimization function is set, it is judged whether the optimization function is fully optimized, and it is judged whether the expected accuracy is achieved. After the optimal result of the previous iteration, the single-pixel distance value is replaced and iterated again. When the final result reaches the expectation after two-layer iteration, the two loops are stopped. Among them, if the single-pixel retrieval space is finite-dimensional and computable, no stop threshold is set until all values within the iteration interval are iterated, and the single-pixel distance with the smallest error is selected as the output of this node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field:

[0001] The present invention relates to the technical field of image processing, and specifically to a single-pixel distance calibration method that can significantly improve the single-pixel distance accuracy and thus increase the industrial image processing accuracy. Background Art:

[0002] With the rapid development of artificial intelligence, especially image processing algorithms, the measurement accuracy, content, speed, etc. of non-contact industrial measurement products based on machine vision have been greatly improved. Based on the advantages of fast detection of multiple parameters in image-based detection, such as length, arc, angle, spacing, different hole spacings, etc. can be quickly detected simultaneously, which cannot be achieved by traditional single measurement tools. Measuring objects using images has become the trend of current measurement technology development.

[0003] During the measurement process, particularly when measuring the diameter, the key is to find the pixel points (accurate to sub-pixels) contained in the image, and then multiply by the distance represented by a single pixel to obtain the optimal distance. Currently, popular algorithms for finding sub-pixel edges include the Zernike moment method, fitting method, interpolation method, etc. After obtaining the contour of the object to be detected, multiplying by the single-pixel distance can obtain the required size. However, due to various factors, the single-pixel distance does not meet the high-precision measurement requirements.

[0004] Since there will be a certain error in the theoretical value of the single-pixel distance obtained by pixel size / magnification ratio, the measurement accuracy cannot reach the expected accuracy requirements. For example, when accurately measuring the size through an image, it is necessary to find the number of pixel points covered by the image of the size to be measured, and multiply by the single-pixel distance to obtain its size. However, the theoretical accuracy of its single-pixel distance cannot meet the measurement requirements. Therefore, effectively improving the accuracy of the single-pixel distance can play a positive role in subsequent image measurement work. Summary of the Invention:

[0005] The present invention aims at the disadvantages and deficiencies existing in the prior art, and proposes a single-pixel distance calibration method that can significantly improve the single-pixel distance accuracy and thus increase the industrial image processing accuracy.

[0006] The present invention is achieved by the following measures:

[0007] A single-pixel distance calibration method, characterized by comprising the following steps:

[0008] Step 1: Obtain the standard device image and read the size information of the standard device;

[0009] Step 2: Set the single-pixel distance retrieval range. Calculate the theoretical single-pixel distance by dividing the pixel size by the magnification factor, and set the retrieval range above and below the theoretical single-pixel distance value;

[0010] Step 3: Iterate the single-pixel distance values within the range. Extract a value from the single-pixel distance retrieval range as the starting value for iteration, set the iteration stop condition, and iterate the values within the range; Step 4: Set the optimization function. Using the known parameters of the standard device, set the fitting function to be optimized;

[0011] Step 5: Determine whether the optimization function is fully optimized. Using the single-pixel distance set in Step 3, iterate the optimization function to make its loss reach the local optimum at the single-pixel distance set in Step 3;

[0012] Step 6: Determine whether the expected accuracy is achieved. After the previous iteration reaches the optimum, change the single-pixel distance value and iterate again. Stop the two loops when the final result reaches the expectation after two layers of iteration. If the single-pixel retrieval space is finitely dimensional and computable, do not set a stop threshold until all values within the range are iterated. Select the single-pixel distance with the smallest error as the output of this node; Step 7: Output the optimized single-pixel distance value, and select the best single-pixel distance value according to the accuracy requirement.

[0013] In Step 2 of the present invention, if the single-pixel distance is Dum, then set the retrieval range as [Dum - dum, Dum + dum], where D is much larger than d, and um is the unit of micrometer. Here, the value of d is set according to the experience of the algorithm personnel.

[0014] In Step 3 of the present invention, extract a value from the single-pixel distance retrieval range as the starting value for iteration. The extraction method is to extract in ascending order according to the set step size. If the single-pixel distance value set here is Dum - dum, the method of iterating the single-pixel distance value is to iterate the single-pixel distance within the range according to the set step size. Let the step size be Δd, where Δd << d << D.

[0015] In Step 4 of the present invention, set the optimization function to obtain the diameter size l of the image. At this time, the iterated single-pixel distance is a constant value α (the first value is Dum - dum) in this optimization function, and the optimization target is l. Let the number of pixels be f(x), where the parameter set in f(x) is P, and x is the feature generated from the device sample obtained. Then the optimization function is l = f(x) * α.

[0016] In step 5 of the present invention, regression loss functions such as MSE / RMSE can be used. When the loss to be optimized is set as the mean square error MSE, a large number of sample data collected by devices (the number of collected sample data is n) are iteratively used, and the parameter set P is updated using the gradient descent method until the optimal situation of the optimization function at this single-pixel distance is reached. Let the fitting function obtain a diameter of l^, where the mean square error is MSE:

[0017] In step 6 of the present invention, after the optimal iteration in the previous step, the single-pixel distance value is replaced and iterated again. Steps 4 - 5 are repeated. The stop iteration condition can be selected as any one of the following:

[0018] (1) For all values within the iteration interval, no stop condition is set until all values within the iteration interval are reached. Select the single-pixel distance when the error of the optimization function is the smallest as the finally determined single-pixel distance, where all values within the iteration interval: when k satisfies Dum - dum + ((k + 1)*Δd)>Dum + dum, stop the iteration;

[0019] (2) Continuously iterate and optimize by setting the expected accuracy as the stop condition until the accuracy reaches the expectation and stop the iteration, where: the single-pixel distance for the second iteration is Dum - dum + Δd, the third is Dum - dum + 2*Δd, and the kth is Dum - dum + k*Δd. Set the expected accuracy θ: if MSE < θ, then stop the iteration.

[0020] Compared with the prior art, when measuring the size of a workpiece, the present invention can further improve the accuracy of the single-pixel distance through collecting a large number of standard devices for optimization, and further improve the accuracy of subsequent measurement and other work. Description of the Drawings:

[0021] Att Figure 1 is the flowchart of the present invention. Detailed Embodiments:

[0022] Embodiment 1:

[0023] S1. Obtain the image of the standard device:

[0024] Use the device to obtain the image of the standard device, record the size of the known device, and collect multiple images (n images) of the device

[0025] S2. Set the single-pixel distance retrieval interval:

[0026] Calculate the theoretical single-pixel distance using the pixel size / magnification. Using this value, set the retrieval range for the single-pixel distance. For example, if the single-pixel distance is Dum, the retrieval range can be set as [Dum - dum, Dum + dum], where D is much larger than d, and um is the unit of micrometer. Here, the value of d can be set according to the experience of the algorithm personnel.

[0027] S3. Single-pixel distance values within the iteration range:

[0028] Extract a value from the single-pixel distance retrieval range as the starting value for iteration. The extraction method can be in ascending order according to the set step size. For example, the single-pixel distance value set here is Dum - dum. The method for iterating the single-pixel distance value is to iterate the single-pixel distance within the range at a certain step size in this embodiment. Let the step size be Δd, where Δd << d << D.

[0029] S4. Set the optimization function:

[0030] Set the optimization function to obtain the diameter size l of the image. At this time, the iterated single-pixel distance is a constant value α (the first value is Dum - dum) in this optimization function. The optimization goal is l. Let the number of pixels be f(x), where the parameter set in f(x) is P, and x is the feature generated from the acquired device samples. Then the optimization function is l = f(x) * α.

[0031] S5. Whether the optimization function is fully optimized:

[0032] Set the optimization loss such as the mean squared error MSE. Iteratively use the sample data collected from a large number of devices (the number of collected sample data is n). Use the gradient descent method to update the parameter set P until the optimal situation of the optimization function under this single-pixel distance is reached. Let the diameter obtained by the fitting function be where the mean squared error is MSE.

[0033] S6. Whether the expected accuracy is achieved:

[0034] After the optimal iteration in the previous step, change the single-pixel distance value and iterate again. Repeat S4 - S5. The stopping condition for iteration can be selected from the following according to the conditions:

[0035] (1). All values within the iteration range, without setting a stopping condition until all values within the iteration range are reached. Select the single-pixel distance when the error of the optimization function is the smallest as the finally determined single-pixel distance.

[0036] (2). Continuously iterate and optimize by setting the expected accuracy as the stopping condition until the accuracy reaches the expectation and stop the iteration.

[0037] Among them: the single-pixel distance of the second iteration is Dum-dum+Δd, the third is Dum-dum+2*Δd, and the kth is Dum-dum+k*Δd. For all values within the iteration interval of Scheme (1): when k satisfies Dum-dum+((k+1)*Δd)>Dum+dum, stop the iteration. For Scheme (2), set the expected accuracy θ: then stop the iteration when MSE<θ.

[0038] S7. The single-pixel distance value can output the optimal single-pixel distance value in this optimization process when the iteration is completed or the optimal interval is reached.

[0039] This patent uses the theoretical value as a condition when determining the exact single-pixel distance and determines the subsequent retrieval interval; during the optimization process, it uses the obtained pictures of standard devices for retrieval within the interval, and conducts the retrieval according to the set retrieval conditions. The setting of the retrieval conditions is based on certain specific dimensions of known devices, such as the diameter of known devices. Set the objective function for optimization to finally obtain a single-pixel distance with higher accuracy; when obtaining the image of the standard device in parameter optimization, when obtaining the image of the standard device, it is not limited to obtaining devices of different sizes, and when collecting pictures, place the device in different camera areas. By combining multi-scale and multi-position images, the generalization degree of the single-pixel distance can be improved.

Claims

1. A single-pixel distance calibration method, characterized in that, It includes the following steps: Step 1: Obtain the standard device image and read the dimension information of the standard device; Step 2: Set the single-pixel distance retrieval interval, calculate the theoretical single-pixel distance using the pixel size / magnification ratio, and set the retrieval interval above and below the theoretical single-pixel distance value; Step 3: Iterate the single-pixel distance values within the interval, extract a value from the single-pixel distance retrieval interval as the starting value for iteration, set the iteration stop condition, and iterate the values within the iteration interval; Step 4: Set the optimization function and use the known parameters of the standard device to set the fitting function to be optimized; Step 5: Determine whether the optimization function is fully optimized. Use the single-pixel distance set in Step 3 to iterate the optimization function to minimize its loss to the local optimum at the single-pixel distance set in Step 3; Step 6: Determine whether the expected accuracy is achieved. After the previous iteration is optimal, change the single-pixel distance value and iterate again. Stop the two loops when the final result reaches the expected value after two layers of iteration. If the single-pixel retrieval space is finitely dimensional and computable, do not set a stop threshold until all values within the iteration interval are iterated. Select the single-pixel distance with the smallest error as the output of this node; Step 7: Output the optimized single-pixel distance value and select the best single-pixel distance value according to the accuracy requirements.

2. The single-pixel distance calibration method according to claim 1, wherein If the single-pixel distance in Step 2 is Dum, then set the retrieval interval as [Dum - dum, Dum + dum], where D is much larger than d, and um is the unit of micrometer. Here, the value of d is set according to the experience of the algorithm personnel.

3. The single-pixel distance calibration method according to claim 1, wherein In Step 3, extract a value from the single-pixel distance retrieval interval as the starting value for iteration. The extraction method is carried out in ascending order according to the set step size. If the single-pixel distance value set here is Dum - dum, the method of iterating the single-pixel distance value is to iterate the single-pixel distance within the interval according to the set step size. Let the step size be Δd, where Δd << d << D.

4. A single-pixel distance calibration method according to claim 1, characterized in that In Step 4, set the optimization function to obtain the diameter size l of the image. At this time, the single-pixel distance for iteration in this optimization function is a constant value α, and the first value is Dum - dum. The optimization target is l. Let the number of pixels be f(x), where the parameter set in f(x) is P and x is the feature generated from the obtained device sample. Then the optimization function is l = f(x) * α.

5. A single-pixel distance calibration method according to claim 4, characterized in that In step 5, the optimized loss is set as the mean square error MSE, and the sample data collected by a large number of devices are iteratively used. The number of collected sample data is n. The parameter set P is updated using the gradient descent method until the optimal situation of the optimization function at this single-pixel distance is reached. Let the fitting function obtain a diameter of where the mean square error is MSE:

6. A single-pixel distance calibration method according to claim 1, characterized in that In Step 6, when the iteration is optimal, change the single-pixel distance value and iterate again. Repeat Steps 4 - 5. Select any one of the following as the iteration stop condition: (1) Iterate all values within the interval without setting a stop condition until all values within the iteration interval are iterated. Select the single-pixel distance when the error of the optimization function is the smallest as the finally determined single-pixel distance. For all values within the iteration interval: stop the iteration when k satisfies Dum - dum + ((k + 1) * Δd) > Dum + dum; (2) Continuously iterate and optimize by setting the expected accuracy as the stopping condition until the accuracy reaches the expectation and the iteration stops, where: the single-pixel distance in the second iteration is Dum-dum+Δd, the third is Dum-dum+2*Δd, and the kth is Dum-dum+k*Δd. Set the expected accuracy θ: then stop the iteration if MSE<θ.

7. A single-pixel distance calibration method according to claim 1, characterized in that In step 1, obtain the standard device image and read the size information of the standard device: when there is an uneven distribution phenomenon in the lens, the single-pixel distance within the imaging range is inconsistent. When using the single-pixel distance solved by a standard device, it cannot be generalized to the DUTs of different scales. Therefore, when obtaining the standard device image, obtain devices of different sizes, and when collecting pictures, place the devices in different camera areas. By combining multi-scale and multi-position images, obtain multiple groups of single-pixel distances, and then through methods such as weighted average, obtain a more general single-pixel distance value, which solves the problem of poor generalization of the single-pixel distance caused by uneven lens distribution.

Citation Information

Patent Citations

  • Non-contact object size and distance image measuring instrument

    CN104501720A

  • Visual inspection system based on biaxial mems micromirror

    CN112858292A