Point circle distance visual measurement method based on weighted circle fitting and uncertainty evaluation
By employing a method of adaptive weighted fitting of local circular arcs and uncertainty assessment, the problems of error propagation and accuracy limitations in point-circle distance measurement in existing technologies are solved, achieving high-precision and robust point-circle distance measurement and providing a quantitative assessment of reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HUICUI INTELLIGENT TECH CO LTD
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-05
AI Technical Summary
Existing machine vision methods for measuring the distance between points and circles have shortcomings in terms of high accuracy and robustness. In particular, under conditions of edge occlusion, noise, and non-ideal circle deformation, error propagation and pixel discretization effects limit the measurement accuracy, and there is a lack of assessment of measurement reliability.
A method based on local circular arc adaptive weighted fitting and uncertainty assessment is adopted. By defining the local region of interest (ROI) and designing a composite weight function, weighted least squares fitting is performed on the local edge points to calculate the point-circle distance and assess its uncertainty.
It improves measurement accuracy and robustness, provides a quantitative assessment of reliability, and enables efficient and high-precision point-to-circle distance measurement, making it suitable for online inspection.
Smart Images

Figure CN122149349A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine vision positioning technology, and relates to a visual measurement method for point-circle distance based on weighted circle fitting and uncertainty assessment. Background Technology
[0002] In the field of industrial machine vision inspection, measuring the relative positional relationships between geometric elements is a crucial step. Among these, measuring the distance from a "point" to a "circle" is a fundamental and frequently occurring requirement, widely used in scenarios such as checking the assembly gaps of precision parts, assessing the concentricity of gears and shafts, analyzing the alignment of pads and vias on printed circuit boards (PCBs), and controlling the dimensions of precision structures in medical devices. The core objective of this measurement is to accurately calculate the nearest geometric distance from a given point (such as a corner point, the centroid of a blob, or a marker point) to a given circle (such as a mounting hole, a bearing housing, or a ring mark).
[0003] Existing machine vision-based point-to-circle distance measurement methods typically follow a paradigm of "independent extraction first, followed by geometric calculation." The most similar implementations include methods based on standard least-squares circle fitting, methods based on nearest-edge search, and methods based on Hough transform circle detection.
[0004] Existing technical solution 1: A method based on least squares circle fitting and Euclidean distance calculation. This is currently the most common and classic solution. Its process is as follows: First, through image preprocessing (such as filtering and denoising, contrast enhancement) and edge detection algorithms (such as the Canny operator), a set of candidate edge pixels for the target circle is extracted from the image, denoted as... Next, the least squares method is used to fit a circle to the point set. The goal of the least squares method is to find a circle. Its parameters are (in With the center of the circle, Let the radius be a circle, such that the sum of the squares of the algebraic distances from all edge points to the circle is minimized. That is, minimize the objective function: ; The center of the fitted circle is obtained by solving this nonlinear optimization problem (usually using the Gauss-Newton iterative method or directly based on a system of equations with zero partial derivatives). and radius For the target point Distance between points and circles Then, it can be calculated using basic Euclidean geometry formulas: ; The advantage of this method lies in its intuitive principle and solid mathematical foundation. When the edge points are complete and the noise is low, it can obtain relatively stable circle parameters. However, its performance is heavily dependent on the completeness and accuracy of the edge extraction. For workpieces with partially occluded edges, severe noise, or that are not ideal circles (such as slightly elliptical ones), the least squares fitting results will produce significant deviations, which will then "transfer" to the final distance measurement results.
[0005] Existing technical solution two: a method based on direct edge point search and distance transformation. This solution attempts to avoid the errors of circle fitting. Its core idea is: first, to extract the edge point set of the circle. Then, for a given point Calculate the Euclidean distance from the point to every point in the edge point set, and take the minimum value as an approximation of the point-circle distance: ; To improve efficiency, distance transformation algorithms are sometimes used. A distance map is pre-calculated, showing the distance from each pixel in the image to its nearest edge. Then, the distance is calculated by finding points... To quickly obtain the pixel values in this distance map This method has lower requirements for the integrity of the circle and is suitable for scenarios with local arcs. However, its fundamental drawback is that it measures the distance from a point to a set of edge points, rather than the distance from a point to the geometric circle. Due to the pixel-level error inherent in edge extraction and the discrete nature of the edge point set, the distance value obtained by this method is naturally limited by the pixel discretization effect, making it difficult to exceed the accuracy of one pixel, and it cannot reflect the true geometric distance from the point to the circle (especially when the point is located inside the circle, this method cannot distinguish between them).
[0006] Existing technical solution three: A circle detection method based on Hough transform. The Hough transform is robust to noise and missing edges. It detects circles in a three-dimensional parameter space. Circles are detected by accumulating votes. Each edge point corresponds to a conical surface in the parameter space, and the conical surfaces of all edge points intersect at a single point in the parameter space, which corresponds to the circle in the image space. The circle's parameters are obtained by finding the accumulator peak in the parameter space. Subsequently, the point-circle distance is calculated in the same way as in Scheme 1. The advantage of Hough transform is that it is insensitive to noise and can detect partially occluded circles. However, its disadvantages are huge computational cost and high memory consumption, especially when the radius of the circle is large. In addition, the quantization interval of the parameter space directly affects the detection accuracy; to obtain high accuracy, a huge computational burden must be paid. At the same time, it cannot avoid circle parameter estimation errors caused by image quality issues.
[0007] Through in-depth analysis of the above-mentioned existing technical solutions, several key common shortcomings in achieving high-precision and high-robust point-circle distance measurement can be summarized: 1. Error propagation and model dependency risks: Both Schemes 1 and 3 heavily rely on a "global" circle model fitting. The fitting process smoothly "absorbs" all edge point errors (including noise, occlusion, and non-ideal circle deformation) into the final circle parameters. In the middle. Even a tiny deviation in any parameter will be amplified when calculating the distance between points and circles, especially when the measured point... The relative error increases significantly when the distance from the circle is greater. This is an indirect transmission and amplification effect of error.
[0008] 2. Limitations of pixel discretization effect: Although Scheme 2 avoids model fitting, its accuracy is directly limited by the pixel-level accuracy of edge extraction. Even with sub-pixel edge detection, the essence of its nearest point search is still based on discrete sampling points, which cannot obtain continuous, truly geometric point-to-circle distances, thus limiting its accuracy to a theoretical ceiling.
[0009] 3. Insufficient utilization of local information and measurement context: Most existing methods adopt a "one-size-fits-all" strategy. They fail to consider the fact that the distance between a point and a circle is essentially a local geometric property. For a given point... Its circle The nearest point (i.e., the foot of the perpendicular) is only closely related to the geometric properties of that local region on the circle, while the distance from the perpendicular on the circle is much greater. The edge regions of points contribute very little to this specific distance measurement, and their errors may even negatively affect the overall circle fitting.
[0010] 4. Lack of assessment of measurement uncertainty: Existing methods typically only provide a distance value. However, it cannot provide a quantitative indicator of the reliability of this measurement. In practical industrial applications, knowing "to what extent this measurement is reliable" is just as important as knowing the measurement itself. For example, when the edge of a circle is severely obscured, the uncertainty of the measurement result should be large, but existing methods cannot provide this information.
[0011] 5. The trade-off between computational efficiency and accuracy: High-precision Hough transform (Scheme 3) is computationally time-consuming, while the efficient direct search method (Scheme 2) has limited accuracy. For the least squares method (Scheme 1), iterative solutions may also become a speed bottleneck when there are many edge points. Summary of the Invention
[0012] The purpose of this invention is to provide a high-precision visual measurement method for point-circle distance based on local circular arc adaptive weighted fitting and uncertainty propagation. This invention aims to fundamentally change the approach of relying on global model fitting by dynamically constructing an optimal circular model focused on locally relevant regions for a given measurement point P, and providing an uncertainty assessment for distance measurement based on this model. Specific objectives include: achieving higher accuracy and robustness in point-circle distance measurement than traditional methods; significantly reducing measurement errors caused by edge occlusion, noise, and non-ideal circular deformation; providing a quantitative assessment (uncertainty) of the reliability of each distance measurement result; and maintaining or improving computational efficiency while ensuring high accuracy, making it suitable for online detection.
[0013] To address the above problems, the technical solution of this invention is a visual measurement method for point-circle distance based on weighted circle fitting and uncertainty assessment, comprising the following steps: S10, Initial circle estimation and definition of the local region of interest (ROI); S20, based on measurement point-guided adaptive weighted circle fitting; S30, Calculation and uncertainty assessment of the distance between points and circles.
[0014] Preferably, step S10 includes the following steps: S11, for all points on the edge of the circle Perform initial fitting to obtain an initial circle. ; S12, based on the initial circle and target point Define the local ROI for this distance measurement and calculate the points. to the initial center The line connecting the initial circle to the circle. Intersect at one point ,say As the closest point in theory; with Centered on a circle, a sector-shaped region is defined as a local Region of Interest (ROI), and this sector-shaped region is defined by an angle range. Defining, among which , , yes Relative to the center of the circle polar angle, The angle half-width is a preset value, and the edge points falling within this sector area constitute the candidate point set for this fitting. .
[0015] Preferably, S20 specifically includes: based on each edge point For this specific distance measurement, i.e., point To the circle The importance of distance is assigned to different weights. .
[0016] Preferably, the weight Based on spatial proximity and directional consistency.
[0017] Preferably, the spatial proximity specifically refers to the distance from the theoretical nearest point. The closer the edge point, the more likely it is to determine the true nearest point. The greater the influence of a location, the higher its weight.
[0018] Preferably, the directional consistency specifically refers to the normal direction of the edge points. with vector The smaller the included angle, the more the point is within the effective tangential range of the arc, and the stronger the constraint of its position information on the local shape of the circle, and the higher its weight.
[0019] Preferably, a composite weighting function is designed in step S20. : ; in, The spatial weights are calculated using a Gaussian kernel function. ; in, It is an edge point to the theoretical closest point Euclidean distance, Control the rate of weight decay relative to the radius of the initial circle. Proportional settings; It is the direction weight: ; in, It is the normalized direction vector, when the edge normal... and When they are completely identical, When the two are perpendicular, When the two are reversed, ; Then, weighted least squares is used on the local point set. By performing circle fitting, the objective function becomes: ; in, With the center of the circle, Given the radius, the optimized circle parameters, focused on the local region, are obtained by iterative reweighted least squares or by directly solving the weighted normal equation. .
[0020] Preferably, step S30 includes: obtaining an optimized circle. Then, calculate the points. Geometric distance to the circle: .
[0021] Preferably, S30 specifically includes: S31, Estimating and optimizing circle parameters covariance matrix The calculation is approximated by the residuals of the weighted least squares fitting and the design matrix; S32, Distance between dots and circles It is a circle parameter and point coordinates Functions: Assumption point The coordinate uncertainty is very small and can be ignored (or independently estimated as...). ), then distance variance It can be approximated as: ; in, It is a function For circle parameters gradient vector: .
[0022] Preferably, the Calculation of partial derivatives: make ,but ; This formula is used to calculate the distance for each measurement. Standard uncertainty .
[0023] The present invention has at least the following beneficial effects: 1. Significantly improved measurement accuracy: By employing a "local weighted fitting" strategy, this invention effectively focuses on the arc region most relevant to the current distance measurement, minimizing the interference of distant edge points, noise points, and non-ideal deformation regions on the estimation of circle parameters. This results in a circle model that better reflects the true local geometry, ultimately making the calculation of the point-circle distance d more accurate.
[0024] 2. Extremely robust to edge occlusion and noise: Because the weighting function automatically reduces the influence of poor-quality or irrelevant edge points, even if the target circle is partially occluded or has severe noise, as long as there are enough high-quality edge points within the local ROI, this invention can still obtain stable and reliable measurement results. Traditional global fitting methods, on the other hand, will produce huge deviations in such cases.
[0025] 3. Provides a quantifiable measurement reliability metric: output uncertainty. This is a unique advantage of the present invention. It provides users with a direct basis for judging the reliability of measurement results, enabling automated testing systems to make more intelligent decisions (e.g., when...). (If the value is too large, a re-inspection or alarm will be triggered), which improves the intelligence level and reliability of the entire detection system.
[0026] 4. Optimization of computational efficiency: Although weighted fitting is introduced, the computation is limited to a small local ROI point set. Its computational cost is typically far less than that of performing a fine-grained global fit on all edge points. Compared to the high-precision Hough transform, its efficiency advantage is more significant. It achieves a good balance between accuracy and efficiency.
[0027] 5. Strong universality and adaptability: This method does not depend on a specific circle detector and can be combined with various initial circle estimation methods. The design of the weight function enables it to adapt to different image qualities and workpiece characteristics, exhibiting strong generalization ability. Attached Figure Description
[0028] Figure 1 This is a flowchart illustrating the steps of the visual measurement method for point-circle distance based on weighted circle fitting and uncertainty assessment according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the local ROI and weighted fitting of the point-circle distance visual measurement method based on weighted circle fitting and uncertainty assessment according to an embodiment of the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0030] Conversely, this invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of the invention as defined in the claims. Furthermore, to provide a better understanding of the invention, certain specific details are described in detail below. However, those skilled in the art will fully understand the invention even without these detailed descriptions.
[0031] The input to this method is a grayscale image containing the target circle and target points. The system performs a standard preprocessing workflow, including image denoising (e.g., using Gaussian filtering or median filtering) and contrast adjustment (e.g., histogram equalization). Subsequently, a sub-pixel-level edge detection algorithm (e.g., methods based on Zernike moments or spatial moments) is used to extract the edge points of the target circle. Unlike existing techniques, we obtain not only the coordinates of the edge points... It also records the sub-pixel coordinates of each edge point. And its edge direction (normal vector). Simultaneously, target points are obtained through feature extraction (such as template matching, blob analysis, or corner detection). sub-pixel coordinates All subsequent calculations are performed based on sub-pixel coordinates.
[0032] See Figure 1 The flowchart of an embodiment of the method of the present invention includes the following steps: S10, Initial circle estimation and definition of the region of interest (ROI); including the following steps: S11, To provide a coarse reference frame for the local weighting, we use a fast and robust circle detection method (e.g., RANSAC-based circle fitting or an efficient variant of the Hough transform) for all circle edge points. Perform initial fitting to obtain an initial circle. The initial circle does not need to be extremely precise; its purpose is to quickly determine the approximate position and size of the circle.
[0033] S12, based on the initial circle and target point Define the local ROI for this distance measurement and calculate the points. to the initial center The line connecting the initial circle to the circle. Intersect at one point ,say As the closest point in theory; with Centered on a circle, a sector-shaped region is defined as a local Region of Interest (ROI), and this sector-shaped region is defined by an angle range. Defining, among which , , yes Relative to the center of the circle polar angle, The angle half-width is a preset value, and the edge points falling within this sector area constitute the candidate point set for this fitting. .
[0034] S20, based on measurement point-guided adaptive weighted circle fitting; this is the core innovation of this invention. Instead of performing equal fitting on all edge points, we fit each edge point... For this specific distance measurement (i.e., point) To the circle The importance of (distance) is assigned to it with different weights. The design of the weighting function is based on the following two key insights: Spatial proximity: the closest point to the theory The closer the edge point, the more likely it is to determine the true nearest point. The greater the influence of a location, the higher its weight.
[0035] Directional consistency: the normal direction of edge points with vector The smaller the included angle, the more the point is within the effective tangential range of the arc, and the stronger the constraint of its position information on the local shape of the circle, and the higher its weight.
[0036] Based on this, a composite weight function is designed. : ; in, The spatial weights are calculated using a Gaussian kernel function. ; in, It is an edge point to the theoretical closest point Euclidean distance, Control the rate of weight decay relative to the radius of the initial circle. Proportional settings; It is the direction weight: ; in, It is the normalized direction vector, when the edge normal... and When they are completely identical, When the two are perpendicular, When the two are reversed, This effectively reduces the impact of edge points that may originate from noise or non-tangential structures.
[0037] Then, weighted least squares is used on the local point set. By performing circle fitting, the objective function becomes: ; in, With the center of the circle, Given the radius, the optimized circle parameters, focused on the local region, are obtained by iterative reweighted least squares or by directly solving the weighted normal equation. .
[0038] See Figure 2 A schematic diagram of local ROI and weighted fitting (showing the initial circle, target point P, and theoretical closest point). Q 0 (Sector-shaped ROI and weight distribution at edge points).
[0039] S30, Point-to-circle distance calculation and uncertainty assessment, obtaining the optimized circle. Then, calculate the points. Geometric distance to the circle: .
[0040] More importantly, the present invention provides this distance measurement value. uncertainty We estimate based on the law of uncertainty propagation, specifically including: S31, Estimating and optimizing circle parameters covariance matrix The calculation is approximated by the residuals of the weighted least squares fitting and the design matrix; S32, Distance between dots and circles It is a circle parameter and point coordinates Functions: Assumption point The coordinate uncertainty is very small and can be ignored (or independently estimated as...). ), then distance variance It can be approximated as: ; in, It is a function For circle parameters gradient vector: .
[0041] Calculation of partial derivatives: make ,but ; This formula is used to calculate the distance for each measurement. Standard uncertainty .this The value is a valuable output, quantifying the reliability of the measurement results. For example, when the edge points within a local ROI are of high quality and numerous, It will be very small; when the edges are occluded or there is a lot of noise, The value will increase significantly, prompting users to be cautious in accepting this measurement.
[0042] The scope of protection of this invention is defined by the appended claims, and its core innovation and key protection points are as follows: 1. The idea of circle fitting based on the local ROI defined by the measurement point location: preserving the target point The closest theoretical point is determined by the initial circle. and around The overall technical concept is to define a sector-shaped local area of interest (ROI) and use only the edge points within that area for subsequent fitting.
[0043] 2. Design of composite weighting functions for local circle fitting: Special protection is provided for incorporating spatial proximity (e.g., based on...) Gaussian weights ) and directional consistency (e.g., based on weight Composite weights The specific calculation methods and formulas.
[0044] 3. Weighted Least Squares Circle Fitting Method for Point-to-Circle Distance Measurement: Preserving the use of the above composite weights For the set of edge points within a local ROI Weighted least squares circle fitting is performed to obtain the optimized circle parameters. The specific algorithm flow.
[0045] 4. Evaluation method for measurement uncertainty of point-circle distance: Preservation of the covariance matrix based on optimized circle parameters Sum Distance Function gradient Calculate the distance between a point and a circle using the uncertainty propagation law. Standard uncertainty The complete mathematical framework and calculation formulas.
[0046] 5. A complete point-circle distance measurement system integrating local ROI definition, weighted fitting, and uncertainty assessment: from image input, preprocessing, and initial estimation, to local weighted fitting, distance calculation, and finally outputting the distance value. and its uncertainty The entire automated process.
[0047] In specific embodiments, the following alternative solutions can be implemented without departing from the core concept of the present invention: Alternatives to local ROI definition: In addition to using a sector region, a region can also be defined using a... A circular region with a fixed center and a fixed radius is designated as a local region of interest (ROI). Alternatively, the ROI can be dynamically adjusted based on the curvature of the initial circle. Size.
[0048] Alternative to weight function design: Spatial weights Besides the Gaussian function, linear decay functions or exponential decay functions can also be used. Direction weights. It can be designed as a more complex function, for example, considering only the angle between the normal and the radial directions. Points within the range.
[0049] Alternatives to the initial circle estimation method: Initial circle Besides using RANSAC or Hough transform, it can also be obtained quickly using standard least squares method, or directly provided using prior knowledge (such as CAD models).
[0050] Alternatives to the uncertainty propagation model: For uncertainty assessment, if the covariance matrix cannot be analytically calculated... Monte Carlo simulation can be used. That is, multiple sampling and fitting are performed within the uncertainty range of the edge point coordinates, and the standard deviation of the multiple distance results is calculated as the mean. The estimate.
[0051] Expanding the scope of application: The core concept of this method—"local adaptive weighted fitting based on the measurement target"—can be extended to distance measurements of other geometric elements, such as the distance from a point to an ellipse, the distance between lines, and the distance between circles. Only the definition of the local ROI and the design of the weighting function need to be modified accordingly.
[0052] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A visual measurement method for the distance between points and circles based on weighted circle fitting and uncertainty assessment, characterized in that, Includes the following steps: S10, Initial circle estimation and definition of the local region of interest (ROI); S20, based on measurement point-guided adaptive weighted circle fitting; S30, Calculation and uncertainty assessment of the distance between points and circles.
2. The method according to claim 1, characterized in that, S10 includes the following steps: S11, for all points on the edge of the circle An initial circle is obtained by performing an initial fitting. ; S12, based on the initial circle and target point Define the local ROI for this distance measurement and calculate the points. to the initial center The line connecting the initial circle to the circle. Intersect at one point ,say As the closest point in theory; with Centered on a circle, a sector-shaped region is defined as a local Region of Interest (ROI), and this sector-shaped region is defined by an angle range. Defining, among which , , yes Relative to the center of the circle polar angle, The angle half-width is a preset value, and the edge points falling within this sector area constitute the candidate point set for this fitting. .
3. The method according to claim 2, characterized in that, S20 specifically includes: based on each edge point For this specific distance measurement, i.e., point To the circle The importance of distance is assigned to different weights. .
4. The method according to claim 3, characterized in that, The weight Based on spatial proximity and directional consistency.
5. The method according to claim 4, characterized in that, The spatial proximity specifically refers to the distance from the theoretical nearest point. The closer the edge point, the more likely it is to determine the true nearest point. The greater the influence of a location, the higher its weight.
6. The method according to claim 5, characterized in that, The directional consistency specifically refers to the normal direction of the edge points. with vector The smaller the included angle, the more the point is within the effective tangential range of the arc, and the stronger the constraint of its position information on the local shape of the circle, and the higher its weight.
7. The method according to claim 3, characterized in that, A composite weighting function is designed in S20. : ; in, The spatial weights are calculated using a Gaussian kernel function. ; in, It is an edge point to the theoretical closest point Euclidean distance, Control the rate of weight decay relative to the radius of the initial circle. Proportional settings; It is the direction weight: ; in, It is the normalized direction vector, when the edge normal... and When they are completely identical, When the two are perpendicular, When the two are reversed, ; Then, weighted least squares is used on the local point set. By performing circle fitting, the objective function becomes: ; in, With the center of the circle, Given the radius, the optimized circle parameters, focused on the local region, are obtained by iterative reweighted least squares or by directly solving the weighted normal equation. .
8. The method according to claim 7, characterized in that, S30 includes: obtaining an optimized circle. Then, calculate the points. Geometric distance to the circle: 。 9. The method according to claim 8, characterized in that, S30 specifically includes: S31, Estimating and optimizing circle parameters covariance matrix The calculation is approximated by the residuals of the weighted least squares fitting and the design matrix; S32, Distance between dots and circles It is a circle parameter and point coordinates Functions: Assumption point The coordinate uncertainty is very small and can be ignored (or independently estimated as...). ), then distance variance It can be approximated as: ; in, It is a function For circle parameters gradient vector: 。 10. The method according to claim 9, characterized in that, The Calculation of partial derivatives: make ,but ; This formula is used to calculate the distance for each measurement. Standard uncertainty .