Method for measuring intersection of circles in machine vision based on dynamic fitting and local optimization
By constructing an energy function that combines geometric consistency and image gradient flow matching terms, and dynamically fitting circle parameters, the error propagation and robustness problems of circle intersection measurement in machine vision are solved, achieving high-precision and stable intersection positioning, which is suitable for measuring arc segments and rings under non-ideal conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HUICUI INTELLIGENT TECH CO LTD
- Filing Date
- 2026-03-24
- Publication Date
- 2026-06-19
AI Technical Summary
In machine vision, existing technologies for measuring the intersection of circles suffer from problems such as error propagation and amplification, neglecting local information of the intersection, poor robustness to non-ideal conditions, and insufficient trade-off between computational efficiency and accuracy. In particular, it is difficult to stably and accurately locate the intersection under conditions of image noise and circumferential occlusion.
A method based on dynamic fitting and local optimization is adopted. By constructing an energy function and combining geometric consistency, image gradient flow matching and intersection local mode terms, the circle parameters are dynamically fitted. Local image evidence is used to optimize the intersection coordinates, avoid error propagation, and enhance robustness and accuracy.
It significantly suppresses error propagation, improves intersection point positioning accuracy and stability, enhances robustness to non-ideal conditions, achieves sub-pixel-level positioning accuracy, and improves repeatability and computational efficiency under the same image quality.
Smart Images

Figure CN121904172B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine vision technology and relates to a machine vision method for measuring the intersection of circles based on dynamic fitting and local optimization. Background Technology
[0002] In fields such as industrial automation, precision manufacturing, computer vision, and robot navigation, the accurate detection and measurement of geometric elements in two-dimensional images is a fundamental and crucial task. Among these, the detection technology for circles (i.e., Hough circle transform and its improved algorithms) is relatively mature, as one of the most common geometric elements. However, in practical applications, it is often necessary to handle not only individual, isolated geometric elements, but also the spatial relationships between elements, such as calculating the intersection of two circles. This need is widespread in various scenarios: in automated optical inspection (AOI) of printed circuit boards (PCBs), it is necessary to verify whether the connection relationships between vias or pads (usually modeled as circles) conform to the design; in the visual measurement of mechanical parts, it is necessary to evaluate the relative position and assembly accuracy of parts by detecting the intersection of mounting holes (circles); and in vision-based robot grasping, precise positioning and attitude estimation are achieved by identifying the intersection of specific circular patterns on the workpiece.
[0003] From a mathematical geometry perspective, finding the intersection point of two circles is a clearly defined analytical problem. In a two-dimensional plane, given the coordinates of the centers of two circles... , and radius , The intersection points can be obtained by solving a system of two quadratic equations. However, in the practice of machine vision, the problem becomes more complex. The "circles" in the image are estimated by detecting discrete, noisy sets of pixels, and their center and radius parameters themselves have measurement errors. Directly using these erroneous parameters for analytical calculation will amplify the errors in the input parameters when the resulting intersection point coordinates are used. Especially in ill-conditioned cases such as when the two circles are nearly tangent or partially overlapped, the stability of the analytical solution is very poor, and it may even lead to no solution due to numerical calculation (corresponding to the two circles not intersecting in the parameter space), which contradicts the obvious intersection points in the image.
[0004] Therefore, the core challenge of measuring the intersection of circles in machine vision lies in how to robustly, stably, and accurately estimate the coordinates of the intersection of two real circles from image data containing noise and uncertainty. This requires the technical solution to not only utilize geometric knowledge but also fully consider the characteristics of image processing and noise.
[0005] Currently, industry and academia mainly adopt a two-stage pipeline approach of "detect first, then calculate" for this type of problem, which is also the most intuitive and widely used implementation method.
[0006] Phase 1: Circle detection.
[0007] The goal of this stage is to analyze the input image. The algorithm identifies all circles of interest and extracts their geometric parameters. The most common method is to use a circle detection algorithm based on the Hough Transform or its variants. The basic steps are as follows:
[0008] 1. Image Preprocessing and Edge Extraction: First, the input image is filtered (e.g., Gaussian filtering) to suppress noise. Then, an edge detection operator (e.g., Canny operator) is used to obtain a binarized edge image. Edge points are candidate circumferential points.
[0009] 2. Parameter Space Accumulation: The equation of a circle can be expressed as... ,in With the center of the circle, The radius is used. The Hough circle transform transforms each edge point in the image space. Mapping to three-dimensional parameter space For each edge point, and a predefined radius search range. All parameter combinations that satisfy the condition that the point lies on its circumference Voting is performed on the accumulator array. Specifically, for a given... The locus of the center of the circle that satisfies the conditions is a locus with the center of the circle as follows: Center of the circle A circle with radius .
[0010] 3. Peak Detection and Parameter Extraction: After parameter space accumulation, local peaks are identified in the accumulator. Each significant peak is considered to correspond to a circle in image space, with its coordinates... That is, the detected first The parameters of a circle.
[0011] To improve efficiency and accuracy, many improvement schemes have been developed, such as the Randomized Hough Transform (RHT) and using gradient direction information to narrow the search range for the circle center. In addition, there are methods based on least squares fitting: first, candidate regions are roughly determined by edge point clustering, and then the least squares method is used to fit the point set to a circle equation to obtain the optimal solution. .
[0012] Second stage: Analytical calculation of intersection points.
[0013] Parameter estimates for the two target circles are obtained. Then, the process enters the stage of pure mathematical calculation. The process is as follows:
[0014] Calculate the distance between the centers: First, calculate the distance between the centers of the two circles. .
[0015] Determining positional relationships: Based on and and To determine the position of the two circles, consider their relationship: If the two circles are separate and have no intersection, then... If one circle contains the other circle, they have no intersection; if or If the two circles are tangent, they will have one point of intersection; if If the two circles intersect, they will have two intersection points. In practice, due to measurement errors, a threshold judgment is usually used, for example... and They were considered to intersect at that time.
[0016] Finding the coordinates of the intersection point: For the case of intersection, a geometric model is established for solution. Let the angle between the line connecting the centers of the two circles and the horizontal axis be θ. ,but , According to the Law of Cosines, starting from the center of the circle... Connect the line to the intersection point and the line to the center of the circle. The included angle satisfy: Then, the intersection Relative to the center of the circle The coordinate offset is: Finally, the coordinates of the two intersection points were obtained. The positive and negative signs correspond to two symmetrical intersection points.
[0017] This solution has clear logic, a high degree of modularity, and is easy to understand and implement, thus becoming the most common solution currently available.
[0018] Although the aforementioned two-stage approach of "detect first, then calculate" is widely adopted, it has revealed several inherent shortcomings in practical industrial applications, which are particularly prominent in scenarios requiring high precision and robustness.
[0019] Disadvantage 1: Error propagation and amplification. This is the most fundamental flaw of this scheme. The first-stage circle detection error (including the center positioning error) and radius measurement error Errors are unavoidable. These errors stem from image noise, incomplete edge extraction, pixel discretization effects, and quantization errors inherent in the Hough transform itself. In the second stage, these errors are used as input parameters in the analytical calculation formula. Error propagation analysis reveals that the error in the final intersection point coordinates... It is not linearly correlated with input error, but rather significantly amplified through geometric relationships. In particular, this is especially true when the input is nearly tangent ( Or one circle nearly contains another circle. In the "pathological" case of ), the denominator Or the value of the relevant expression is very small, resulting in the obtained... May exceed The effective range of the data (which needs to be truncated) is limited, and the intersection coordinates are extremely sensitive to minute changes in the input parameters, resulting in highly unstable calculation results. This instability reduces the repeatability and reliability of the measurement results.
[0020] Disadvantage 2: Ignoring local image information at the intersection point. This scheme relies entirely on "global" parameters extracted from the entire circumference to calculate the intersection point. However, the intersection point itself is a local feature point in the image, and the surrounding pixel grayscale and gradient information have unique patterns (e.g., the edges of two arcs meet here). Existing schemes completely fail to utilize this direct, local image evidence when calculating the intersection point, essentially calculating the geometric intersection point "blindly" on two theoretically perfect arcs with errors. This leads to a waste of information and misses the opportunity to use local information to correct or optimize the intersection point position.
[0021] Disadvantage 3: Poor robustness to partial occlusion or missing edges. In real-world industrial images, the target circle may have missing or unclear edges due to uneven lighting, dirt, or occlusion (such as overlapping parts or pasted labels). Global detection methods like the Hough transform are highly dependent on the integrity of the contour. When a large gap appears at the edge of the circle, the detected center and radius parameters may deviate significantly from the true values, or the circle may even fail to be detected. In this case, subsequent intersection calculations will be meaningless or produce significant errors.
[0022] Disadvantage 4: Insufficient ability to handle annular or arc segments. Sometimes, what needs to be processed is not a complete solid circle, but an annulus (with only inner and outer edges) or a clearly defined arc. Existing solutions usually require first "reconstructing" a complete circle through fitting or completion before performing calculations. This completion process introduces additional assumptions and errors.
[0023] Disadvantage 5: Trade-off between computational efficiency and accuracy. To improve the accuracy of circle detection, high-resolution accumulators (i.e., fine-grained parameter space quantization) are often required, but this drastically increases computational load and memory consumption (the Hough circle transform is a three-dimensional accumulation). Although some improved algorithms exist, real-time performance remains a challenge while ensuring accuracy. Summary of the Invention
[0024] To address the above shortcomings, the purpose of this invention is to provide a novel machine vision-based method for measuring the intersection of circles, aiming to:
[0025] 1. Suppress error propagation and amplification: Through innovative process design, reduce or avoid the direct propagation of measurement errors of circle parameters to intersection point calculation.
[0026] 2. Make full use of local information at intersection points: transform intersection point localization from a purely post-parameter processing method to a direct search or optimization process based on image evidence.
[0027] 3. Enhanced robustness to non-ideal conditions: It can still stably and accurately locate the intersection point even when the circumference is partially occluded, the edge is missing, or it is a segment of a circular arc.
[0028] 4. Improved measurement accuracy and stability: Under the same image quality conditions, more accurate and repeatable intersection coordinates are obtained than those of the traditional two-stage method.
[0029] 5. Maintain or improve computational efficiency: By designing more focused computational strategies, higher accuracy can be achieved without significantly increasing the overall computational burden.
[0030] The technical solution of this invention is a machine vision method for measuring the intersection of circles based on dynamic fitting and local optimization, comprising the following steps:
[0031] S10, Image Acquisition;
[0032] S20, preprocessing and edge detection;
[0033] S30, Initial circle parameters are obtained;
[0034] S40, Initial intersection point estimation and candidate region acquisition;
[0035] S50, Energy Function Construction and Optimization;
[0036] S60 outputs the precise coordinates of the intersection point of the circles.
[0037] Preferably, step S20 converts the input image acquired in step S10 into a digital image. Preprocessing and edge detection are performed to obtain the edge image. and the corresponding gradient direction pattern .
[0038] Preferably, step S30 employs a coarse-grained Hough transform or the centroid method to obtain the initial coarse parameters of the two target circles: the center of the circle... , and radius , .
[0039] Preferably, S40 specifically includes: the theoretical intersection point calculated using initial coarse parameters. Define a circle with side length as the center. square area This is called the intersection candidate region. pixels, of which and This represents the maximum error in the estimated center and radius of the circle.
[0040] Preferably, S50 specifically includes: constructing and solving an energy function or objective function. ,in Candidate region A point within; a function The point was measured As a measure of the probability or quality of a true intersection point between two circles, the smaller the value, the better. The greater the probability that it is a true intersection point;
[0041] Energy function It is composed of a weighted combination of three key items:
[0042] ;
[0043] in, These are the positive weighting coefficients for each item, used to balance the influence of different constraints; For geometric consistency terms, For image gradient flow matching terms, This refers to the local pattern item at the intersection point.
[0044] Preferably, the geometric consistency item is obtained. Based on, rather than based on, the current candidate intersection points And image edge evidence, dynamically estimate and The most compatible circle parameters; for each circle (k=1,2), select a set of intersection points with the candidate points on its circumference. Re-fit the circle using relevant edge points;
[0045] Specifically, this includes: for circles , with its initial center For reference, from the edge image Extract a set of circumferential support points Define two opposing sectors, taking circle 1 as an example, and connect the centers of the circles. and candidate points A ray is obtained. Using this ray as a boundary line, select a circle whose direction makes an angle with the ray's direction. and The edge points within the range, where ;
[0046] Use the collected support point set A new circle parameter is obtained by fitting using the least squares method. Geometric consistency term, then measures the point The sum of the distances to the two newly fitted circles:
[0047] ;
[0048] in, Represents the Euclidean distance, if If the intersection point is perfect and the set of points can fit a true circle, then this term should be zero.
[0049] Preferably, the image gradient flow matching term is obtained. Utilizing local image features at the intersection point: Ideally, near the intersection point of two intersecting circles, the edge gradient directions of the two arcs converge at that point and satisfy specific geometric relationships; specifically, this includes, at the intersection point... Place, circle The tangent direction is perpendicular to the direction from the center of the circle. arrive The radial direction; therefore, the circle At the intersection Ideal edge gradient direction nearby It should be perpendicular to the radial vector. ,Right now:
[0050] ;
[0051] At candidate point A small neighborhood The image gradient is examined within the neighborhood for each edge point. Its actual image gradient direction is determined by Given this, the energy is defined as a measure of the difference between the actual gradient direction and the expected gradient directions of the two circles at that point:
[0052] ;
[0053] in, It is a point The unit gradient vector at point (direction is) ), Indicates the inner product. It is based on the current geometric relationship, by The parameters of the fitted circle are determined; extrapolation to the point Time, circle The unit gradient direction that the edge should have; the absolute value of the inner product measures the consistency of the direction.
[0054] Preferably, the local pattern item at the intersection point is obtained. Specifically, this involves utilizing the property of an intersection point as a corner point or feature point. At the intersection of two circles, the edge direction changes abruptly. Within a small local window at the intersection point, the second-order moments or structure tensors of the image exhibit a specific pattern, which is then calculated... Centered on, size is Structure tensor matrix within the window :
[0055] ;
[0056] in, The image in local coordinates The gradient at a given point, for an ideal corner point, There are two significant eigenvalues: this energy encourages this corner point property while suppressing points located on a single smooth edge;
[0057] use Matrix response function, Harris corner response function :
[0058] ;
[0059] in, It is an empirical constant; at the corner points, The value is relatively large; therefore, we define:
[0060] ;
[0061] minimize This encourages searches to favor locations with high corner responses.
[0062] Preferably, the final energy function in S60 The coordinates of the candidate points The nonlinear function is used to perform an iterative optimization algorithm in the candidate region. Find the point that minimizes it. It employs iterative reweighting and local search.
[0063] Preferably, S60 includes the following steps:
[0064] S61, Initialization: Using the initial theoretical intersection point Starting point;
[0065] S62, Iteration steps: For the... The current point of the next iteration :
[0066] Dynamic circle fitting: based on the current Following the opposing sector strategy, two sets of support points for circles are extracted from the edge image. And perform least-squares circle fitting on each to obtain and ;
[0067] Energy assessment and gradient calculation: Calculate the energy function based on the newly fitted circular parameters. and its gradient ;
[0068] Parameter update: Update the intersection coordinates using gradient descent or quasi-Newton method. ;in It is the iteration step size;
[0069] S63, Convergence Criterion: When The iteration stops when the energy change is less than a certain threshold or when the maximum number of iterations is reached.
[0070] S64, Output: Final This is the precisely estimated coordinate of the intersection point.
[0071] The present invention has at least the following beneficial effects:
[0072] 1. Significantly suppresses error propagation, improving intersection point localization accuracy and stability. This is the most prominent advantage of this invention. In traditional methods, the measurement error of the circular parameters directly and without buffering enters the analytical solution formula. In this method, we do not directly use fixed circular parameters with initial errors to calculate intersection points. Instead, we dynamically select reliable circumferential support points for each candidate intersection point position to refit the circle, using these "instant-fit" circular parameters that are more compatible with the current candidate point to evaluate the quality of the point. This process is equivalent to fine-tuning and correcting the circular parameters based on local image evidence in each iteration. The final intersection point coordinates are the output of the optimization process, balancing geometric consistency, image gradient fit, and local corner characteristics. This dynamic coupling mechanism greatly weakens the direct impact of initial circular parameter errors on the final result. Experiments show that, under the same image noise level, the standard deviation (repetition accuracy) of the intersection point coordinates obtained by this method is 30%~50% lower than that of traditional methods, and the accuracy improvement is even more significant in ill-conditioned cases approaching tangency.
[0073] 2. This method fully utilizes local image information to enhance the algorithm's discriminative power. Traditional methods completely ignore pixel information at intersection points. This method uses gradient flow matching terms... and the local pattern item at the intersection This method actively utilizes image gradient directions and corner features within the neighborhood of intersection points. This allows the algorithm not only to "calculate" intersection points but also to "see" them. For example, in cases where spurious intersection points exist in the image (such as two unrelated arcs accidentally approaching each other), traditional analytical calculations might still output a mathematically correct but actually non-existent intersection point. However, this method, during optimization, addresses the lack of genuine gradient convergence patterns or corner responses at spurious intersection points, thus improving its energy function. The value will be very high, thus it will not be selected as the optimal solution. This greatly enhances the algorithm's ability to resist interference and identify the true intersection point.
[0074] 3. Stronger robustness to circumferential occlusion and missing edges. Traditional Hough transform-based methods heavily rely on complete or near-complete circular edges. This method, when dynamically fitting a circle, strategically avoids potentially disturbed areas near intersections, actively selecting "healthy" circular sectors far from intersections to collect support points. Even with partial circumference loss, as long as there are enough effective edge points in the opposing sector, the circle's parameters can be stably fitted. This "selective utilization" strategy allows the method to work reliably even with incomplete circles, expanding its application range.
[0075] 4. Applicable to arc segments and tori. The dynamic fitting step of this method does not require the support point set to cover the entire circumference. For obvious arc segments, as long as their span is sufficient (e.g., greater than 90 degrees) and they are correctly selected into the opposing sectors, least squares fitting can provide a reasonable estimate of the circle containing the arc. For tori (with inner and outer edges), the inner and outer edges can be distinguished through preprocessing, or edge points belonging to the same side (e.g., the outer side) can be selected as support points by the consistency of gradient directions. Therefore, this method does not require an explicit "circle completion" step and can handle the case of incomplete circles more naturally.
[0076] 5. Achieve sub-pixel level positioning accuracy. Energy function. The definition and optimization process are performed in a continuous (or sub-pixel) coordinate space. By using interpolation methods to obtain gradient information of sub-pixel positions, and by leveraging the fact that the optimization algorithm itself can output non-integer coordinate values, this method can naturally achieve sub-pixel precision intersection point localization. In contrast, in traditional methods, the parameter space quantization error in the circle detection stage directly limits the upper limit of the final intersection point's precision.
[0077] 6. Good computational efficiency potential. Although the single-iteration computation of this method involves circle fitting and energy evaluation, which seems more complex than a single analytical computation, its overall computational cost is manageable. First, the initial circle detection can be very coarse-grained, quickly obtaining coarse parameters; this step is fast. Second, the optimization process is strictly limited to a very small candidate region. Within this framework, the number of pixels to be processed is limited. When dynamically fitting a circle, the support point set only comes from two specific sectors, not the entire image edge. Finally, due to the well-designed energy function (which typically exhibits good convexity), the optimization process converges rapidly, usually requiring only 5-10 iterations to reach stability. Overall, while achieving the same or higher accuracy, the computation time of this method is comparable to, or even better than, the traditional approach of high-precision Hough transform plus analytical computation. Attached Figure Description
[0078] Figure 1 This is a flowchart illustrating the steps of the machine vision method for measuring the intersection of circles based on dynamic fitting and local optimization, according to an embodiment of the present invention.
[0079] Figure 2 This is a schematic diagram of the selection of support points for opposing sectors in the machine vision circular intersection measurement method based on dynamic fitting and local optimization according to an embodiment of the present invention.
[0080] Figure 3 This is a schematic diagram of the gradient flow matching term in the machine vision circular intersection measurement method based on dynamic fitting and local optimization according to an embodiment of the present invention. Detailed Implementation
[0081] 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.
[0082] 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.
[0083] See Figure 1 The flowchart of an embodiment of the method of the present invention includes the following steps:
[0084] S10, Image Acquisition;
[0085] S20, preprocessing and edge detection;
[0086] S30, Initial circle parameters are obtained;
[0087] S40, Initial intersection point estimation and candidate region acquisition;
[0088] S50, Energy Function Construction and Optimization;
[0089] S60 outputs the precise coordinates of the intersection point of the circles.
[0090] S20 will process the input image acquired by S10. Preprocessing and edge detection are performed to obtain the edge image. and the corresponding gradient direction pattern .
[0091] S30 assumes that we have obtained the initial coarse parameters of the two target circles through a preliminary, low-precision and robust fast detection method (e.g., coarse-grained Hough transform or centroid method): circle center , and radius , .
[0092] S40 specifically includes: the theoretical intersection point calculated using initial coarse parameters. Define a circle with side length as the center. square area This is called the intersection candidate region. The value of should be large enough to cover the maximum possible offset of the actual intersection point due to initial parameter errors, for example, pixels, of which and This represents the maximum error in the estimated center and radius of the circle.
[0093] S50 specifically includes: constructing and solving an energy function, or objective function. ,in Candidate region A point within; a function The point was measured As a measure of the probability or quality of a true intersection point between two circles, the smaller the value, the better. The greater the probability that it is a true intersection point;
[0094] Energy function It is composed of a weighted combination of three key items:
[0095] ;
[0096] in, These are the positive weighting coefficients for each item, used to balance the influence of different constraints; For geometric consistency terms, For image gradient flow matching terms, This refers to the local pattern item at the intersection point.
[0097] Obtaining geometric consistency terms Based on, rather than based on, the current candidate intersection points And image edge evidence, dynamically estimate and The most compatible circle parameters; for each circle (k=1,2), select a set of intersection points with the candidate points on its circumference. Re-fit the circle using relevant edge points;
[0098] Specifically, this includes: for circles , with its initial center For reference, from the edge image Extract a set of circumferential support points Define two opposing sectors, taking circle 1 as an example, and connect the centers of the circles. and candidate points A ray is obtained. Using this ray as a boundary line, select a circle whose direction makes an angle with the ray's direction. and Edge points within the range (see) Figure 2 As shown in the shaded area), For example, it is advisable to... , In this way, we avoided the intersection. The nearby local area (which may have complex or missing edges due to the intersection of the two circles) collects relatively "clean" and reliable edge points on the circumference.
[0099] Use the collected support point set A new circle parameter is obtained by fitting using the least squares method. Geometric consistency term, then measures the point The sum of the distances to the two newly fitted circles:
[0100] ;
[0101] in, Represents the Euclidean distance, if If the intersection point is perfect and the set of points can fit a true circle, then this term should be zero.
[0102] Obtaining image gradient flow matching terms Utilizing local image features at the intersection point: Ideally, near the intersection point of two intersecting circles, the edge gradient directions of the two arcs converge at that point and satisfy specific geometric relationships; specifically, this includes, at the intersection point... Place, circle The tangent direction is perpendicular to the direction from the center of the circle. arrive The radial direction; therefore, the circle At the intersection Ideal edge gradient direction nearby It should be perpendicular to the radial vector. , Right now:
[0103] ;
[0104] At candidate point A small neighborhood The image gradient is examined within the neighborhood for each edge point. Its actual image gradient direction is determined by Given this, the energy is defined as a measure of the difference between the actual gradient direction and the expected gradient directions of the two circles at that point:
[0105] ;
[0106] in, It is a point The unit gradient vector at point (direction is) ), Indicates the inner product. It is based on the current geometric relationship, by The parameters of the fitted circle are determined; extrapolation to the point Time, circle The unit gradient direction that the edge should have; the absolute value of the inner product measures the consistency of the direction. Since the gradient direction is bidirectional (from dark to light or from light to dark), we take the absolute value. The negative sign is added because we want to minimize... To maximize the consistency of gradient directions (i.e., the sum of the absolute values of the inner products).
[0107] See Figure 3 This is a schematic diagram of gradient flow matching terms. At the candidate intersection point... Within a small neighborhood, the actual detected edge gradient vectors are shown, along with the ideal gradient directions of the two circles predicted based on the current geometric relationships. This energy measure the consistency of their directions.
[0108] The core of this invention is to transform intersection point localization into an optimization problem subject to multiple constraints (geometry, image gradient, local pattern), and to incorporate the uncertainty of circle parameters into the optimization loop through dynamic circle fitting, thereby achieving the synergistic refinement of intersection point and circle parameters.
[0109] Obtain the local pattern item at the intersection point Specifically, this involves utilizing the property of an intersection point as a corner or feature point. At the intersection of two circles, the edge direction undergoes abrupt change (from the tangent direction belonging to one circle to the tangent direction belonging to the other circle). Within a small local window at the intersection point, the second-order moments or structure tensors of the image exhibit a specific pattern, which is then used to calculate... Centered on, size is Structure tensor matrix within the window :
[0110] ;
[0111] in, The image in local coordinates The gradient at a given point, for an ideal corner point, There are two significant eigenvalues: this energy encourages this corner point property while suppressing points located on a single smooth edge;
[0112] use Matrix response function, Harris corner response function :
[0113] ;
[0114] in, It is an empirical constant (typically 0.04~0.06); at corner points, The value is relatively large; therefore, we define:
[0115] ;
[0116] minimize This encourages searches to favor locations with high corner responses.
[0117] The final energy function in S60 The coordinates of the candidate points The nonlinear function is used to perform an iterative optimization algorithm in the candidate region. Find the point that minimizes it. It employs iterative reweighting and local search.
[0118] S60 includes the following steps:
[0119] S61, Initialization: Using the initial theoretical intersection point Starting point;
[0120] S62, Iteration steps: For the... The current point of the next iteration :
[0121] Dynamic circle fitting: based on the current Following the opposing sector strategy, two sets of support points for circles are extracted from the edge image. And perform least-squares circle fitting on each to obtain and ;
[0122] Energy assessment and gradient calculation: Calculate the energy function based on the newly fitted circular parameters. and its gradient It can be approximated by numerical difference or by the derived analytical form;
[0123] Parameter update: Update the intersection coordinates using gradient descent or a quasi-Newton method (such as L-BFGS). ;in It is the iteration step size;
[0124] S63, Convergence Criterion: When (For example, The iteration stops when the pixel change or energy change is less than a certain threshold, or when the maximum number of iterations is reached.
[0125] S64, Output: Final This refers to the precisely estimated coordinates of the intersection point. If two intersection points are needed, then find the first intersection point... Then, it can be temporarily "erased" from the edge image (suppressing the influence of its neighborhood), and then the above optimization process can be started from a symmetrical initial point in the region symmetrical about the line connecting the centers of the two circles to find the second intersection point. .
[0126] The core of this invention lies in its unique "cooperative guidance and local refinement" framework, and the specific technical constructions proposed to implement this framework. The key technical points claimed are listed below:
[0127] 1. Overall architecture of a circle intersection measurement method based on dynamic circle fitting and energy minimization. This method transforms the intersection measurement problem into an overall technical approach that optimizes an objective function composed of geometric consistency, image gradient flow fit, and local intersection patterns.
[0128] 2. A strategy for selecting support points in "opposing sectors" for dynamic circle fitting. To avoid local interference at intersection points, a set of edge points on the circumference far from the candidate intersection point region (i.e., sectors that form a large angle with the line connecting the "center and candidate point") is specifically selected for dynamic refitting of circle parameters.
[0129] 3. Geometric consistency term The specific construction method. The definition of protecting this energy term: that is, for candidate points... Each circle is dynamically selected based on its position, and new circle parameters are fitted. Then calculate The technical solution is to use the sum of the squared algebraic distances between these two dynamically fitted circles as the energy value.
[0130] 4. Image gradient flow matching term The specific construction method. The definition of protecting this energy term: that is, at the candidate point... Within the neighborhood of , calculate a measure of consistency between the actual image gradient direction and the predicted edge gradient directions that the two circles should have in that neighborhood, based on the current dynamically fitted circle geometry (e.g., the negative of the sum of the absolute values of the inner products).
[0131] 5. Combination and optimization solution process of energy functions. (The above is a partial translation of the original text.) , And encourage corner characteristics The terms are weighted and summed to form the total energy function. The complete process of finding the minimum point near the initial intersection prediction using iterative optimization algorithms (such as gradient descent and quasi-Newton method) includes steps such as reselecting the support point set, refitting the circle parameters, and recalculating the energy and gradient during iteration.
[0132] 6. For scenarios with two intersection points, a sequential optimization and suppression strategy is employed. The protection mechanism, after detecting one intersection point, temporarily suppresses image information (such as edges or gradients) in the neighborhood of that point, initializes at a symmetrical location, and then runs the optimization process again to find the second intersection point.
[0133] 7. Implementation of the above method in a computer program, embedded system, or dedicated vision measurement equipment.
[0134] Without departing from the basic idea of "cooperative guidance and local refinement" of this invention, certain specific implementation steps can be replaced or modified, and the purpose of this invention can still be achieved.
[0135] Alternative Solution 1: Alternative construction of the energy function term.
[0136] 1. Alternatives to the geometric consistency term: In addition to least squares fitting, robust fitting methods (such as RANSAC circle fitting) can be used to handle outliers in the support point set. The energy term can also be used instead of the sum of squared distances, employing robust loss functions such as Huber loss or Cauchy loss to further enhance tolerance for noisy points in the support point set. That is: in It is a robust loss function.
[0137] 2. Alternative for the gradient flow matching term: Instead of calculating the sum of the inner products of all edge points in the neighborhood with the two predicted directions, we can first cluster the edge points in the neighborhood according to their gradient directions, check whether there are two dominant gradient direction clusters, and whether the directions of these two clusters are respectively aligned with the two dynamically fitted circles at their center points. The predicted tangent direction is perpendicular. The energy term can be designed as a combined measure of cluster quality and directional fit.
[0138] 3. Alternatives to the Local Intersection Pattern Term: Besides the Harris corner response, the response values of the FAST corner detector can be used, or a small classifier (such as an SVM or simple neural network) can be trained to determine whether a local image patch has a "two-circle intersection" texture pattern, and the classifier's confidence score can be used as the basis for evaluation. Components of.
[0139] Alternative Solution 2: Optimization Strategy Replacement.
[0140] 1. Initialization and Search Strategy Alternative: It can operate independently of a single theoretical intersection point provided by the initial coarse circle parameters. As a starting point, it can be used in the candidate region. First, a fast corner detector (such as FAST) or edge intersection analysis is used to generate multiple possible initial hypothetical intersection points. Then, local optimization is performed in parallel or sequentially, starting from each point, and finally, the result with the smallest energy function value is selected as the final intersection point. This avoids the optimization getting trapped in local minima.
[0141] 2. Algorithm Alternatives: Besides gradient-based iterative optimization, for smaller candidate regions... Alternatively, a dense sampling method can be used for the search. That is, within the region... A large number of points are sampled at sub-pixel intervals. Calculate the energy value at each point directly. Then, the point with the lowest energy is selected. This method avoids the problem of potential convergence during iteration and is easily parallelized for acceleration, but the computational cost increases with increasing sampling density.
[0142] Alternative Solution 3: Replacement with dynamic fitting method.
[0143] 1. Support for point-selected sector substitution: The definition of "opposite sector" does not have to be based on a fixed angle range. Instead, it can be determined adaptively. For example, it can be determined along the circumference, from far away. Starting from a certain point, edge points are continuously collected until a point is encountered where the edge is discontinuous or the gradient direction changes drastically. This allows for more flexible adaptation to defects of different shapes.
[0144] 2. Substitution of Fitting Parameters: In dynamic fitting, it is not necessary to fit the complete center and radius parameters. This is because we already have an initial center. Furthermore, the intersection point is primarily sensitive to radius errors and the offset of the circle's center in the perpendicular direction of the connecting line; therefore, it can be modified to only fit the radius. Meanwhile, it is assumed that the center of the circle lies only between the initial center and the candidate point. There are slight corrections in the direction of the connection. This can reduce the fitting parameters and improve the stability and speed of the fitting.
[0145] Alternative Solution 4: Addressing multiple intersections and complex scenarios.
[0146] 1. When there are multiple pairs of circles in an image whose intersection points need to be measured, a global circle detection can be run first (with relaxed accuracy requirements) to determine the initial parameters and possible pairings of all circles. Then, for each pair of circles, the refinement process described in this invention is run independently. The optimization processes for different circle pairs can be executed in parallel to improve the overall throughput.
[0147] For more general problems such as measuring the intersection of circles and lines, and the intersection of ellipses, the core idea of this invention—constructing an energy function that combines geometric consistency, local image gradient matching, and feature point response, and directly solving for the intersection through dynamic curve fitting and iterative optimization—is equally applicable. Simply replace the circle model in the geometric consistency term with the corresponding curve model (line, ellipse) and adjust the gradient flow prediction formula. This demonstrates the universality and scalability of this invention.
[0148] 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 machine vision circle-circle intersection point measurement method based on dynamic fitting and local optimization, characterized in that, Includes the following steps: S10, Image Acquisition; S20, preprocessing and edge detection; S30, Initial circle parameters are obtained; S40, Initial intersection point estimation and candidate region acquisition; S50, Energy Function Construction and Optimization; S60 outputs the precise coordinates of the intersection points of the circles; The S20 will S10 collected input image Preprocessing and edge detection, edge image And the corresponding gradient direction map ; The S30 method employs a coarse-grained Hough transform or the centroid method to obtain the initial coarse parameters of the two target circles: circle center. , and radius , ; S40 specifically includes: the theoretical intersection point calculated using initial coarse parameters. Define a triangle with side length as the center. square area This is called the intersection candidate region. pixels, of which and This represents the maximum error in the estimated center and radius of the circle; S50 specifically includes: constructing and solving an energy function or objective function. ,in Candidate region A point within; a function The point was measured As a measure of the probability or quality of a true intersection of two circles, the smaller the value, the better. The greater the probability that it is a true intersection point; Energy function It is composed of a weighted combination of three key items: ; in, These are the positive weighting coefficients for each item, used to balance the influence of different constraints; For geometric consistency terms, For image gradient flow matching terms, For the local pattern item at the intersection point; Obtain the geometric consistency term Based on the current candidate intersection points And image edge evidence, dynamically estimate and The most compatible circle parameters; for each circle Given k=1,2, select a set of intersection points with the candidate points on its circumference. Re-fit the circle using relevant edge points; Specifically, this includes: for circles , with its initial center For reference, from the edge image Extract a set of circumferential support points Define two opposing sectors, taking circle 1 as an example, and connect the centers of the circles. and candidate points A ray is obtained. Using this ray as a boundary line, select a circle whose direction makes an angle with the ray's direction. and The edge points within the range, where ; Use the collected support point set A new circle parameter is obtained by fitting using the least squares method. Geometric consistency term, then the measurement point The sum of the distances to the two newly fitted circles: ; in, Represents the Euclidean distance, if If the points are perfect intersections and the set of points can fit a true circle, then this term should be zero. Obtain the image gradient flow matching term By utilizing local image features at the intersection point: ideally, near the intersection point of two intersecting circles, the edge gradient directions of the two arcs converge at that point and satisfy specific geometric relationships; specifically, this includes, at the intersection point... Place, circle The tangent direction is perpendicular to the direction from the center of the circle. arrive The radial direction; therefore, the circle At the intersection Ideal edge gradient direction nearby It should be perpendicular to the radial vector. ,Right now: ; At candidate point A small neighborhood The image gradient is examined within the neighborhood for each edge point. Its actual image gradient direction is determined by Given this, the energy is defined as a measure of the difference between the actual gradient direction and the expected gradient directions of the two circles at that point: ; in, It is a point The unit gradient vector at point , with direction . , Indicates the inner product. It is based on the current geometric relationship, by The parameters of the fitted circle are determined; extrapolation to the point Time, circle The unit gradient direction that the edge should have; the absolute value of the inner product measures the consistency of the direction. Obtain the local pattern item of the intersection point Specifically, this involves utilizing the property of an intersection point as a corner or feature point. At the intersection of two circles, the edge direction changes abruptly. Within a small local window at the intersection point, the second moment or structure tensor of the image exhibits a specific pattern, which is then calculated... Centered on, size is Structure tensor matrix within the window : ; in, The image in local coordinates The gradient at a given point, for an ideal corner point, There are two significant eigenvalues: this energy encourages this corner point property while suppressing points located on a single smooth edge; use Matrix response function, Harris corner response function : ; in, It is an empirical constant; at the corner points, The value is relatively large; therefore, we define: ; minimize This encourages searches to favor locations with high corner responses.
2. The machine vision method for measuring the intersection of circles based on dynamic fitting and local optimization according to claim 1, characterized in that, The final energy function in S60 The coordinates of the candidate points The nonlinear function is used to perform an iterative optimization algorithm in the candidate region. Find the point that minimizes it. It employs iterative reweighting and local search.
3. The machine vision method for measuring the intersection of circles based on dynamic fitting and local optimization according to claim 2, characterized in that, S60 includes the following steps: S61, Initialization: Using the initial theoretical intersection point Starting point; S62, Iteration steps: For the... The current point of the next iteration : Dynamic circle fitting: based on the current Following the opposing sector strategy, two sets of support points for circles are extracted from the edge image. And perform least-squares circle fitting on each to obtain and ; Energy assessment and gradient calculation: Calculate the energy function based on the newly fitted circular parameters. and its gradient ; Parameter update: Update the intersection coordinates using gradient descent or quasi-Newton method. ;in It is the iteration step size; S63, Convergence Criterion: When The iteration stops when the energy change is less than a certain threshold or when the maximum number of iterations is reached. S64, Output: Final This is the precisely estimated coordinate of the intersection point.
Citation Information
Patent Citations
CN121505048A