Workpiece circle fitting method and device, visual inspection system and electronic equipment

By acquiring workpiece data point sets in a vision inspection system, dividing them into inner and outer points, and introducing a fitting circle radius constraint for iterative updates, the problem of fitting multiple circles with different radii was solved, achieving high-precision and stable circle fitting.

CN117218100BActive Publication Date: 2025-12-30SHENZHEN LINGYUN VISION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311256864.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2025-12-30
Estimated Expiration
2043-09-25

AI Technical Summary

Technical Problem

Existing visual inspection methods have poor fitting results when faced with multiple circles of different radii in the same workpiece, and cannot meet the inspection requirements.

Method used

The data point set of the workpiece is obtained by a vision inspection system. Based on the data point set, a circle is fitted, dividing the inner and outer points. The radius constraint of the fitted circle is introduced, and the fitting process is iteratively updated to optimize the fitting process and obtain a target fitted circle with higher accuracy.

Benefits of technology

In scenarios with multiple circles of different radii, the fitting accuracy and stability are improved, enabling accurate differentiation of circles with different radii and meeting the needs of visual inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117218100B_ABST
    Figure CN117218100B_ABST
Patent Text Reader

Abstract

The application discloses a workpiece circle fitting method and device, a visual detection system and electronic equipment, and belongs to the technical field of data processing. The workpiece circle fitting method is applied to a visual detection system. The method comprises the following steps: acquiring a data point set of a workpiece to be processed by a data acquisition device of the visual detection system, wherein the workpiece to be processed comprises at least two circles; performing circle fitting based on data points of the data point set to obtain a first fitting circle; determining inliers and outliers in the data point set based on the first fitting circle; performing circle fitting based on the inliers in the data point set and a fitting circle radius constraint condition to obtain a second fitting circle, wherein the fitting circle radius constraint condition is used to represent a maximum value of a fitting circle radius and a minimum value of the fitting circle radius; iteratively updating the inliers and the outliers in the data point set based on the second fitting circle; and performing circle fitting based on the inliers in the data point set after iteration termination to obtain at least two target fitting circles of the workpiece to be processed. The method is suitable for a fitting scene in which multiple circles with different radii exist in the workpiece to be processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, and in particular relates to a workpiece circle fitting method, device, vision inspection system and electronic equipment. Background Technology

[0002] Circle fitting is one of the most frequently used techniques in vision application projects. Stable circle features are often used to measure the hole size, outline roundness, and center position of a workpiece to detect whether the workpiece meets the process design requirements, or to provide center information for line circle positioning, or to compare the actual circular outline of the workpiece with the nominal circle feature to detect defects such as protrusions, depressions or discontinuities on the workpiece edge.

[0003] In the process of visual inspection, there may be multiple circles with different radii for the same workpiece or target. Existing fitting methods such as combined traversal, random sampling consistency or robust regression do not take into account the scenario when multiple circles with different radii exist at the same time, resulting in poor fitting effect and failing to meet the requirements of visual inspection. Summary of the Invention

[0004] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a workpiece circle fitting method, apparatus, vision inspection system, and electronic equipment, applicable to scenarios where multiple circles of different radii exist simultaneously in the workpiece to be processed.

[0005] In a first aspect, this application provides a workpiece circle fitting method, which is applied to a vision inspection system, and the method includes:

[0006] The data point set of the workpiece to be processed is obtained by the data acquisition device of the vision inspection system, and the workpiece to be processed includes at least two circles.

[0007] Based on the data points in the data point set, a circle is fitted to obtain the first fitted circle;

[0008] Based on the first fitted circle, determine the inner and outer points in the data point set;

[0009] Based on the interior points in the data point set and the radius constraint of the fitted circle, a circle is fitted to obtain a second fitted circle. The radius constraint of the fitted circle is used to characterize the maximum and minimum radius of the fitted circle.

[0010] Based on the second fitted circle, the inner and outer points in the data point set are iteratively updated;

[0011] Based on the interior points in the data point set after the iteration terminates, circle fitting is performed to obtain at least two target fitted circles for the workpiece to be processed.

[0012] According to the workpiece circle fitting method of this application, an initial first fitting circle is obtained by directly fitting the data point set. Based on the first fitting circle, inner and outer points are divided, and a fitting circle radius constraint condition is introduced to fit a second fitting circle with higher accuracy and a radius within a certain range. The inner and outer points are iteratively updated based on the second fitting circle to find a more stable and accurate inner point. Finally, a target fitting circle with stable results and high fitting accuracy is obtained. For scenarios where there are multiple circles with different radii in the workpiece to be processed, fitting circle radius constraint conditions corresponding to different circles are introduced to ensure fitting accuracy and stability while also distinguishing circles with different radii.

[0013] According to one embodiment of this application, the step of performing circle fitting based on the interior points and the radius constraint of the fitted circle in the data point set to obtain a second fitted circle includes:

[0014] By optimizing the circle fitting function corresponding to the radius constraint condition of the fitted circle by the constraint factor, an unconstrained circle fitting function is obtained.

[0015] Using the minimum difference in the radii of the fitted circles as the objective function, the unconstrained circle fitting function is solved to obtain the fitting circle parameters corresponding to the radius constraint condition of the fitted circle.

[0016] The second fitted circle is obtained by fitting the data point set based on the interior points and the fitting circle parameters.

[0017] According to one embodiment of this application, the step of fitting the second fitted circle based on the interior points of the data point set and the fitted circle parameters includes:

[0018] The target number is determined based on the proportion of interior points in the data point set and the maximum number of iterations constraint.

[0019] The target number of times is iteratively updated for the interior points in the data point set;

[0020] Based on the fitting circle parameters, the updated interior points in the data point set are fitted with a circle to obtain a third fitting circle, and the fitting error of the third fitting circle in each iteration is calculated.

[0021] Based on the fitting error, the second fitting circle is determined from the target number of the third fitting circles.

[0022] According to one embodiment of this application, the iterative update of the interior points in the data point set for the target number of iterations includes:

[0023] Refit the first fitted circle;

[0024] Based on the new first fitted circle, the interior and exterior points in the data point set are redefined.

[0025] According to one embodiment of this application, the iterative update of the inner and outer points in the data point set based on the second fitted circle includes:

[0026] The weight of each data point in the data point set is determined based on the distance from each data point in the data point set to the second fitted circle;

[0027] Based on the weights of each data point in the data point set, the inner and outer points of the data point set are iteratively updated, and the weights corresponding to the inner points in the data point set are greater than the weights corresponding to the outer points.

[0028] According to one embodiment of this application, the iterative update of the inner and outer points in the data point set based on the second fitted circle includes:

[0029] Based on the distance from each data point in the data point set to the second fitted circle and the prior distance of the outer points, the inner and outer points in the data point set are iteratively updated. The prior distance of the outer points is used to characterize that the distance from any outer point in the data point set to the second fitted circle is greater than the distance from any inner point to the second fitted circle.

[0030] According to one embodiment of this application, the iterative update of the interior and exterior points in the data point set includes:

[0031] Each iteration determines M distant points in the data point set, where M is an integer greater than 1;

[0032] The iteration terminates if the M far points of the current iteration are the same as the M far points of the previous iteration.

[0033] According to one embodiment of this application, determining the interior and exterior points of the data point set based on the first fitted circle includes:

[0034] Based on the distance from each data point in the data point set to the first fitted circle and the inner point distance threshold, the inner and outer points in the data point set are determined.

[0035] Secondly, this application provides a workpiece circle fitting device, the device comprising:

[0036] The acquisition module is used to acquire a set of data points of the workpiece to be processed through the data acquisition device of the vision inspection system, wherein the workpiece to be processed includes at least two circles.

[0037] The first processing module is used to perform circle fitting based on the data points in the data point set to obtain a first fitted circle;

[0038] The second processing module is used to determine the inner and outer points of the data point set based on the first fitted circle.

[0039] The third processing module is used to perform circle fitting based on the interior points in the data point set and the fitting circle radius constraint to obtain a second fitting circle. The fitting circle radius constraint is used to characterize the maximum and minimum values ​​of the fitting circle radius.

[0040] The fourth processing module is used to iteratively update the inner and outer points of the data point set based on the second fitted circle.

[0041] The fifth processing module is used to perform circle fitting based on the interior points in the data point set after the iteration terminates, so as to obtain at least two target fitted circles for the workpiece to be processed.

[0042] According to the workpiece circle fitting device of this application, an initial first fitting circle is obtained by directly fitting a set of data points. Based on the first fitting circle, inner and outer points are divided, and a fitting circle radius constraint condition is introduced to fit a second fitting circle with higher accuracy and a radius within a certain range. The inner and outer points are iteratively updated based on the second fitting circle to find a more stable and accurate inner point. Finally, a target fitting circle with stable results and high fitting accuracy is obtained. For scenarios where there are multiple circles with different radii in the workpiece to be processed, fitting circle radius constraint conditions corresponding to different circles are introduced to ensure fitting accuracy and stability while also distinguishing circles with different radii.

[0043] Thirdly, this application provides a visual inspection system, including:

[0044] The data acquisition device is used to acquire a set of data points of the workpiece to be processed;

[0045] A controller, electrically connected to the data acquisition device, is used to execute the workpiece circle fitting method described in the first aspect above.

[0046] According to the visual inspection system of this application, an initial first fitting circle is obtained by directly fitting a set of data points. Based on the first fitting circle, inner and outer points are divided, and a fitting circle radius constraint is introduced to fit a second fitting circle with higher accuracy and a radius within a certain range. The inner and outer points are iteratively updated based on the second fitting circle to find a more stable and accurate inner point. Finally, a target fitting circle with stable results and high fitting accuracy is obtained. For scenarios where there are multiple circles with different radii in the workpiece to be processed, fitting circle radius constraints corresponding to different circles are introduced to ensure fitting accuracy and stability while also distinguishing circles with different radii.

[0047] Fourthly, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the workpiece circle fitting method as described in the first aspect above.

[0048] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0049] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0050] Figure 1 This is a schematic flowchart of the workpiece circle fitting method provided in the embodiments of this application;

[0051] Figure 2 This is one of the schematic diagrams of the second fitted circle provided in the embodiments of this application;

[0052] Figure 3 This is a second schematic diagram of the second fitted circle provided in the embodiments of this application;

[0053] Figure 4 This is a schematic diagram of the workpiece circle fitting device provided in the embodiments of this application;

[0054] Figure 5 This is a schematic diagram of the structure of the visual inspection system provided in the embodiments of this application;

[0055] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0056] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0057] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0058] The workpiece circle fitting method, workpiece circle fitting device, vision inspection system, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0059] The workpiece circle fitting method can be applied to the terminal, specifically executed by the hardware or software in the terminal.

[0060] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads).

[0061] The following embodiments describe a terminal including a display and a touch-sensitive surface. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.

[0062] The workpiece circle fitting method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the workpiece circle fitting method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The workpiece circle fitting method provided in this application embodiment is described below using an electronic device as the execution subject.

[0063] The visual inspection system of this application includes a data acquisition device and a controller, and the data acquisition device and the controller are connected.

[0064] The workpiece circle fitting method is used to fit a circle shape to match the set of data points extracted from the workpiece to be processed, so that the circle shape best represents the shape characteristics of the circle of the workpiece to be processed.

[0065] Workpiece circle fitting methods are applied to vision inspection systems, such as... Figure 1As shown, the workpiece circle fitting method includes steps 110 to 160.

[0066] Step 110: Obtain the data point set of the workpiece to be processed through the data acquisition device of the vision inspection system.

[0067] The workpiece to be processed includes at least two circles, and the data point set is a collection of data points to be fitted within the workpiece. This data point set characterizes the circular shape features of the workpiece. In actual execution, positional coordinates related to the workpiece's features can be extracted as data points within the data point set.

[0068] For example, data points can be extracted from the edges of the workpiece to be processed as data points in the data point set, or data points can be extracted from the contour of the workpiece to be processed as data points in the data point set.

[0069] It is understandable that all data points in the data point set lie in a plane, and the data point set is a finite set.

[0070] For example, the workpiece to be processed can be a bearing, which contains three circular structures with different radii (inner ring, outer ring, and rolling elements). The data acquisition device of the vision inspection system acquires the contour data points of the bearing to obtain the corresponding data point set. This data point set can characterize the contour features of the bearing containing three circular structures with different radii.

[0071] For example, the workpiece to be processed can be a flywheel, which contains concentric circular structures with different radii. The edge data points of the flywheel are obtained through the data acquisition device of the vision inspection system, and the corresponding data point set is obtained. This data point set can characterize the edge features of the concentric circular structures with different radii in the flywheel.

[0072] Step 120: Based on the data points in the data point set, perform circle fitting to obtain the first fitted circle.

[0073] In this step, a circle is fitted based on the data points in the data point set. Data points are randomly selected from the data point set, and an initial circle, namely the first fitted circle, is obtained based on the selected data points. At the same time, the mathematical expression corresponding to the first fitted circle is obtained.

[0074] In practice, at least three data points need to be selected for circle fitting.

[0075] It should be noted that determining the circle based on the selected data points involves substituting the selected data points into the circle equation and performing a least-squares solution to obtain the coefficients of the circle equation, and then fitting the first fitted circle and its corresponding mathematical expression.

[0076] For example, by randomly selecting three data points from the data point set, substituting these three points into the circle equation, and performing a least-squares solution, the first fitted circle and its corresponding mathematical expression can be determined.

[0077] Step 130: Based on the first fitted circle, determine the inner and outer points in the data point set.

[0078] In this data set, the interior points are the data points that can be used for circle fitting, while the exterior points are the data points that do not participate in circle fitting. The circle obtained by fitting the exterior points in the data set may not be able to represent the circular shape characteristics of the workpiece to be processed, thus affecting subsequent detection steps.

[0079] It is understandable that all the internal points in the data point set plus all the external points in the data point set constitute all the points in the data point set.

[0080] Step 140: Based on the interior points in the data point set and the radius constraint of the fitted circle, perform circle fitting to obtain the second fitted circle.

[0081] Among them, the fitting circle radius constraint condition is used to characterize the maximum and minimum radius of the fitting circle, and to constrain the range of the fitting circle radius.

[0082] In practice, the fitting circle radius constraint can be set based on the preset circle radius of the workpiece to be processed, and the radius of the fitting circle satisfies the circle radius of the workpiece to be processed.

[0083] For example, if a workpiece to be processed contains three circles with different radii, namely 3cm, 4cm, and 5cm, then the radius constraint of the fitted circle can be set to be no greater than 5cm and no less than 3cm, so that the radius of the fitted circle meets the radius of the circle of the workpiece to be processed.

[0084] In practice, the range of the fitted circle radius can be constrained by adding a fitted circle radius constraint to the circle equation.

[0085] For example, the constraint condition for the radius of the fitted circle is that the radius of the fitted circle is no greater than the maximum radius r. max And not less than the minimum radius r min The radius constraint of the fitted circle is added to the circle equation (xa). 2 +(yb) 2 =r 2 Then the equation of the circle with the fitted circle radius constraint is (xa). 2 +(yb) 2 =r 2 str∈[r min ,r max ].

[0086] The second fitted circle is the fitted circle obtained by fitting the interior points of the data point set to a circle. The radius of the second fitted circle is within the range of the radius constrained by the fitted circle radius constraint.

[0087] In this step, three data points can be randomly selected from the interior points, and these three data points can be substituted into the equation of the circle with the radius constraint of the fitted circle to perform the least squares solution, thereby determining the second fitted circle and its corresponding mathematical expression.

[0088] In this embodiment, outer points that may affect the fitted circular shape of the workpiece to be processed are removed, and the inner points are fitted with a circle, which can provide a second fitted circle with higher accuracy.

[0089] In this embodiment, a constraint condition for the radius of the fitted circle is added during the circle fitting process to limit the radius of the fitted circle to a certain range, so as to avoid the fitted circle radius not matching the circle radius of the workpiece to be processed, and to avoid the situation where multiple radii of circles exist at the same time when the fitted circle radius is determined to be a fixed value.

[0090] Step 150: Based on the second fitted circle, iteratively update the inner and outer points in the data point set.

[0091] It should be noted that the second fitted circle is the candidate circle basis for the final fitted circle. Based on the second fitted circle, the interior and exterior points of the dataset are optimized iteratively to make the interior and exterior points in the dataset more stable and accurate.

[0092] Specifically, the internal and external points in the data point set are iteratively updated. This means that a data point that is currently an internal point may become an internal point or an external point after iteration; and a data point that is currently an external point may become an external point or an internal point after iteration.

[0093] In this step, during the iterative update process, more accurate interior points can be continuously searched in the data point set, and the interior points obtained through iterative updates are more accurate.

[0094] It should be noted that an updated second fitted circle is generated in each iteration. In the next iteration, the interior and exterior points in the data point set are updated based on the updated second fitted circle.

[0095] Step 160: Based on the interior points in the data point set after the iteration terminates, perform circle fitting to obtain the target fitted circle.

[0096] The target fitting circle is the fitting circle obtained by fitting the inner points determined in step 150. That is, the target fitting circle is the fitting circle finally determined by the workpiece circle fitting method, and it is the fitting circle that best represents the circular shape characteristics of the workpiece to be processed.

[0097] In this step, three data points can be randomly selected from the interior points of the data point set after the iteration terminates. These three data points are then substituted into the circle equation to perform a least-squares solution, thereby determining the target fitted circle and its corresponding mathematical expression.

[0098] In this embodiment, a second fitted circle with high fitting accuracy and distinguishable radii is obtained based on two fittings and the constraint condition of the fitted circle radius. The inner and outer points in the data point set are iteratively updated, and the determined inner and outer points are more accurate and stable. The target fitted circle with high accuracy, stability and radius that meets the actual requirements is obtained by fitting the inner points obtained after the iteration terminates.

[0099] For example, the workpiece to be processed can be a bearing, which has four circular shapes with radii of 3cm, 3cm, 4cm and 5cm respectively. The constraint condition for the radius of the fitted circle is set as follows: the radius of the fitted circle is not greater than 5cm and not less than 3cm. The workpiece circle fitting method is used to perform circle fitting, and four target fitted circles are obtained with radii of 3cm, 3cm, 4cm and 5cm respectively.

[0100] For example, the workpiece to be processed can be a flywheel, which has two circular shapes with radii of 5cm and 8cm respectively. The constraint condition for the radius of the fitted circle is set to be that the radius of the fitted circle is not greater than 8cm and not less than 5cm. The workpiece circle fitting method is used to perform circle fitting, and two target fitted circles are obtained with radii of 5cm and 8cm respectively.

[0101] According to the workpiece circle fitting method provided in this application, an initial first fitting circle is obtained by directly fitting the data point set. Based on the first fitting circle, inner and outer points are divided, and a fitting circle radius constraint condition is introduced to fit a second fitting circle with higher accuracy and a radius within a certain range. The inner and outer points are iteratively updated based on the second fitting circle to find a more stable and accurate inner point. Finally, a target fitting circle with stable results and high fitting accuracy is obtained. For scenarios where there are multiple circles with different radii in the workpiece to be processed, fitting circle radius constraint conditions corresponding to different circles are introduced to ensure fitting accuracy and stability while also distinguishing circles with different radii.

[0102] In some embodiments, a circle fitting is performed based on the interior points in the data point set and the radius constraint of the fitted circle to obtain a second fitted circle, including:

[0103] By optimizing the fitting function corresponding to the radius constraint condition of the fitted circle by the constraint factor, an unconstrained fitting function of the circle is obtained.

[0104] Using the minimum difference in the radii of the fitted circles as the objective function, the unconstrained circle fitting function is solved to obtain the fitting circle parameters corresponding to the radius constraint condition.

[0105] Based on the interior points of the data point set and the parameters of the fitted circle, a second fitted circle is obtained.

[0106] Among them, the constraint factor is a parameter factor that can transform a constrained circle fitting function into an unconstrained circle fitting function. The constraint factor can be a preset unknown value. In the process of solving the unconstrained circle fitting function, in addition to solving for the fitting circle parameters, the constraint factor can also be solved.

[0107] It is understandable that the constraint factor transforms the constrained circle fitting function into an unconstrained circle fitting function, but only changes the form of the constrained circle fitting function, without changing the constrained nature of the constrained circle fitting function.

[0108] The circle fitting function corresponding to the radius constraint condition is a circle fitting function whose radius is limited to the range specified by the radius constraint condition. The circle fitting function without constraint condition is a circle fitting function whose radius is not restricted by any constraint condition.

[0109] In practice, the constraint factor can be substituted into the hyperbolic tangent function to transform the constrained circle fitting function into an unconstrained circle fitting function.

[0110] For example, the radius constraint of the circle fitting function is r∈[r min ,r max With a constraint factor of c, the radius r is transformed into an unconstrained form, i.e. When tanh(c) = -1, r = r min When tanh(c) = 1, r = r max When tanh(c)∈(-1,1), r∈(r min ,r max ).

[0111] In this embodiment, the difference in the radius of the fitted circle is the difference between the radius of the fitted circle and the radius constrained by the radius constraint condition. The smaller the difference in the radius of the fitted circle, the more the radius of the fitted circle conforms to the radius constraint condition.

[0112] By taking the minimum difference in the fitted circle radii as the objective function, the unconstrained circle fitting function is solved, which yields the fitted circle radius that best meets the fitted circle radius constraint condition, and thus the fitted circle parameters corresponding to the fitted circle radius constraint condition.

[0113] In practice, the objective function can be solved using methods such as gradient descent, Gauss-Newton's method, and ant colony optimization.

[0114] For example, the radius r of the circle fitting function is transformed into its unconstrained form as follows: The objective function at this point is mind. i , where di Let d be the difference in the radii of the i-th fitted circle. i =r i -r, r i Let x be the radius of the i-th fitted circle, (x) i ,y i Let be the center of the i-th fitted circle. Solve the objective function using the Gauss-Newton method, taking the partial derivatives of the objective function with respect to a, b, and c respectively.

[0115]

[0116]

[0117]

[0118] The Jacobian matrix J can be constructed using the partial derivatives:

[0119]

[0120] Where, D = -(r max -r min (1-tanh) 2 (c)) / 2 is the result of taking the partial derivative of the objective function with respect to c.

[0121] At this point, a system of linear equations can be constructed:

[0122] J·Δp=-d

[0123] Using the least squares method, the current parameter increment Δp = (p a ,p b ,p c Solve the problem and update the circle parameters:

[0124] a = a + p a

[0125] b = b + p b

[0126] c = c + p c

[0127] In this embodiment, a circle can be fitted based on the interior points of the data point set, and the parameters of the fitted circle can be repeatedly updated until the root mean square (RMS) errors of the two iterations are very close, and the process converges or exits when the maximum number of iterations is reached, thus obtaining a second fitted circle within a set radius range. The maximum number of iterations can be 100.

[0128] In this embodiment, using constraint factors to transform a constrained circle fitting function into an unconstrained circle fitting function simplifies the circle fitting function, so that constraints do not need to be considered when optimizing the circle fitting function, thereby reducing the complexity of the circle fitting optimization process.

[0129] In some embodiments, a second fitted circle is obtained by fitting based on the interior points of the data point set and the parameters of the fitted circle, including:

[0130] The target number is determined based on the proportion of interior points in the data point set and the maximum number of iterations.

[0131] Iteratively update the target number of times for the interior points in the data point set;

[0132] Based on the fitting circle parameters, the inner points updated in the data point set are fitted with a circle to obtain the third fitting circle, and the fitting error of the third fitting circle in each iteration is calculated.

[0133] Based on the fitting error, a second fitting circle is determined from the target number of third fitting circles.

[0134] The target number is a preset value used to determine the number of times the interior points in the data point set need to be iterated and updated before obtaining the second fitted circle.

[0135] The in-point ratio is the proportion of in-points in the data point set to all data points. The maximum iteration count constraint is used to constrain the number of iterations to prevent the number of iterations from becoming too large.

[0136] For example, if the confidence level is p, the proportion of interior points to all data points in the data set is w, the minimum number of data points the fitting model needs to select from the data set is n, and the number of unique combinations selected from the data set is k (i.e., the theoretical maximum number of iterations required for curve fitting), then the following formula holds:

[0137] 1-p=(1-w n ) k

[0138] Taking the logarithm of both sides, we have:

[0139]

[0140] For circle fitting, there are 3 parameters, and a minimum of 3 points are required for fitting, that is:

[0141]

[0142] The confidence level p is taken as an empirical value of 0.99. The proportion of inliers w can be calculated by setting the initial number of outliers m and the total number of data points N in the data set: w = 1 - m / N. Considering that when the proportion of outliers (m / N) is close to 1 and the confidence level is also close to 1, the value of k may be very large, resulting in an excessively long fitting time, a maximum iteration constraint L is introduced (usually taken as 1000 or 2000). The final maximum number of iterations (target number) is: Nmax = min(k,L).

[0143] The third fitted circle is the fitted circle obtained by fitting the updated interior points in each iteration to a circle. A third fitted circle will be obtained in each iteration.

[0144] In this embodiment, the fitting error is used to measure the fitting accuracy of the fitted circle, that is, the degree of similarity between the fitted circle and the circle shape of the workpiece to be processed. The smaller the fitting error, the greater the similarity between the fitted circle and the circle shape of the workpiece to be processed. The larger the fitting error, the smaller the similarity between the fitted circle and the circle shape of the workpiece to be processed.

[0145] In this embodiment, the fitting error can be the RMS error.

[0146] In practice, the fitting error of the fitted circle can be determined based on the average distance from the interior point to the fitted circle. The larger the average distance, the larger the fitting error, and the smaller the average distance, the smaller the fitting error.

[0147] For example, in the first iteration, the third fitted circle a is determined. The average distance from each inner point to the third fitted circle a is 4cm, so the fitting error of the third fitted circle a can be determined to be 1. In the second iteration, the third fitted circle b is determined. The average distance from each inner point to the third fitted circle b is 5cm, so the fitting error of the third fitted circle b can be determined to be 2. The fitting error 1 of the third fitted circle a is less than the fitting error 2 of the third fitted circle b. The third fitted circle a is more similar to the circle shape of the workpiece to be processed than the third fitted circle b.

[0148] In this embodiment, the third fitting circle with the smallest fitting error is determined as the second fitting circle.

[0149] For example, if the target number is set to 3, the interior points in the data point set are updated 3 times. The fitting error of the third fitted circle a determined by the first iteration update is a1, the fitting error of the third fitted circle b determined by the second iteration update is a2, and the fitting error of the third fitted circle c determined by the third iteration update is a3. The fitting error of the third fitted circle a is the smallest, so the third fitted circle a is determined as the second fitted circle.

[0150] In this embodiment, selecting the third fitting circle with the highest accuracy as the second fitting circle can improve the accuracy of the second fitting circle and provide a more accurate candidate circle for further iterative optimization.

[0151] In some embodiments, iteratively updating the interior points of the data point set for a target number of iterations includes:

[0152] Refit the first fitted circle;

[0153] Based on the new first fitted circle, the interior and exterior points in the data point set are redefined.

[0154] In this embodiment, refitting the first fitted circle and redetermining the inner and outer points in the data point set based on the new first fitted circle can avoid the influence of the randomness of performing the fitting only once and reduce the error caused by the process of randomly selecting data points to determine the circle.

[0155] In some embodiments, based on a second fitted circle, iterative updates are performed on the interior and exterior points in the data point set, including:

[0156] The weights of each data point in the data point set are determined based on the distance from each data point in the data point set to the second fitted circle.

[0157] Based on the weights of each data point in the data point set, the inner and outer points of the data point set are iteratively updated, with the weights of the inner points being greater than the weights of the outer points.

[0158] In this process, assigning corresponding weights to each data point in the data point set allows for a more refined representation of the differences between the data points, enabling a more accurate division of these data points into in-situ and out-situ points.

[0159] In this embodiment, the weight of a data point can be the reciprocal of the distance from that data point to the second fitted circle.

[0160] For example, if the distance from a data point to the second fitted circle is 3cm, the weight of that data point can be 1 / 3; if the distance from a data point to the second fitted circle is 5cm, the weight of that data point can be 1 / 5.

[0161] In practice, when the weight of a data point is greater than a certain threshold, the data point is identified as an inside point; when the weight of a data point is less than the threshold, the data point is identified as an outside point.

[0162] For example, if the threshold is set to 5 and the weight of data point a is 4, then a can be determined as an outlier. If the weight of data point b is 6, then b can be determined as an inlier.

[0163] Understandably, during the iteration process, the second fitted circle is updated as the interior points are updated, and the distance from each data point in the data point set to the second fitted circle is also updated. Accordingly, the weight of each data point is updated based on the distance from each data point to the second fitted circle.

[0164] In this embodiment, the weight of a data point currently identified as an interior point may decrease after iteration, and if it decreases to less than a set threshold, it may be updated to an exterior point. Conversely, the weight of a data point currently identified as an exterior point may increase after iteration, and if it increases to more than a set threshold, it may be updated to an interior point.

[0165] For example, if the threshold is set to 5, in this iteration, the weight of data point a is 6 and it is determined to be an interior point, and the weight of point b is 4 and it is determined to be an exterior point. In the next iteration, the weight of point a can be 4 and it is determined to be an exterior point, and the weight of point b can be 6 and it is determined to be an interior point.

[0166] In some embodiments, based on a second fitted circle, iterative updates are performed on the interior and exterior points in the data point set, including:

[0167] Based on the distance from each data point in the data point set to the second fitted circle and the prior distance of the outer point, the inner and outer points in the data point set are iteratively updated.

[0168] Among them, the prior distance of the outer points is used to characterize that the distance from any outer point of the data point set to the second fitted circle is greater than the distance from any inner point to the second fitted circle.

[0169] In this embodiment, based on the prior distance of the outer points, data points that are far from the second fitting circle are determined as outer points, which can prevent data points that are far from the second fitting circle from participating in the fitting process of the second fitting circle and affecting the fitting result.

[0170] Understandably, by introducing prior knowledge of the outgoing point distance, the speed of iterative updates of in-points and outgoing points in the dataset can be effectively improved, resulting in a faster circle fitting speed.

[0171] In some embodiments, iteratively updating the interior and exterior points in the data point set includes:

[0172] Each iteration determines M distant points in the data point set, where M is an integer greater than 1;

[0173] The iteration terminates if the M far points of the current iteration are the same as the M far points of the previous iteration.

[0174] Among them, the M far points in the data point set are the first M points selected by arranging the data points in the data point set from farthest to closest according to their distance from the second fitting circle, where M is a preset value.

[0175] In this embodiment, the M far points in the data point set are determined as outside points, and the remaining points after removing the M far points from the data point set are determined as inside points.

[0176] In this embodiment, when the M far points of the current iteration are the same as the M far points of the previous iteration, it is considered that the circle that best represents the circular shape characteristics of the workpiece to be processed has been obtained.

[0177] It should be noted that the determination of iteration termination is based on the premise that "the outlier points removed by the optimal fitting result must be the data points farthest from the circle".

[0178] The following proof by contradiction will demonstrate that "the outlier points removed by the optimal fitting result must be the data points farthest from the circle".

[0179] Assuming the globally optimal fitted circle is not a stable fit, the removed outliers are not necessarily the data points closest to the circle. Therefore, among the outliers removed from the circle, there must exist points closer to the circle than some of the farthest data points. For example... Figure 2 As shown in the figure, the circle is the globally optimal fitted circle, P1 and P2 are the data points farthest from the circle, and P2 and P3 are the discarded outliers. Data point P3 is closer to the circle than data point P1. Figure 3 As shown, if data point P1 is taken as the outer point and data point P3 as the inner point, the RMS error of the new circle will obviously be smaller. If the outer point is removed and a new circle is refitted, Figure 3 The RMS error of the middle circle will be greater than Figure 2 The RMS error of the middle circle is small. Therefore, we can obtain a value that is smaller than... Figure 1 The circle with the smaller RMS error among the globally optimal fitted circles, i.e. Figure 2 The circle in the middle. Then " Figure 1 "The RMS error of the middle circle is not the minimum," which is related to... Figure 1 The circle in the equation represents a globally optimal contradiction. Therefore, the original conclusion holds.

[0180] In some embodiments, determining the interior and exterior points in the data point set based on a first fitted circle includes:

[0181] Based on the distance from each data point in the data point set to the first fitted circle and the threshold for the distance to the inner point, the inner and outer points in the data point set are determined.

[0182] The interior point distance threshold is a preset distance threshold. If the first fitted distance from a data point to the circle is less than the interior point distance threshold, the data point is determined to be an interior point. If the distance from a data point to the first fitted circle is greater than the interior point distance threshold, the data point is determined to be an exterior point.

[0183] For example, if the threshold for the distance between interior points is 5cm, the distance from point a to the first fitted circle is 4cm, and the distance from point b to the first fitted circle is 6cm, then a is an interior point and b is an exterior point.

[0184] The following is a specific embodiment of a workpiece circle fitting method.

[0185] Step 1: Initialize the iteration count Iter to 0, set the initial number of outliers to m, and calculate the final maximum iteration count Nmax based on the confidence level and the maximum iteration count constraint.

[0186] Step 2: Randomly select 5 points from the data point set (total number N) of the workpiece to be processed, and perform circle fitting (i.e., substitute into the circle equation and perform least squares solution) to obtain the initial circle (first fitted circle) Circle_Iter.

[0187] Step 3: Calculate the distance from all fitted data points to the initial circle Circle_Iter, obtain the inner points based on the inner point distance threshold, perform circle fitting on the inner points to obtain the current circle (the third fitted circle) Circle_cur, and calculate the RMS error.

[0188] Step 4: Based on the fitted circle radius constraint, optimize the radius constraint of the current circle Circle_cur.

[0189] Step 5: Iteration count Iter = Iter + 1.

[0190] Step 6: Repeat steps 2 to 5 above until the number of iterations Iter reaches the final maximum number of iterations Nmax, and take the result with the smallest RMS error in the current circle fitting as the final candidate circle result (second fitted circle).

[0191] It should be noted that, in order to address the issue that randomness may cause variations in the fitting results, a fixed random seed must be used in the above randomization process.

[0192] Step 7: Combining the idea of ​​rapid iterative optimization, iteratively correct the outliers in the candidate circle fitting results to make the candidate circle fitting results more stable and further reduce the RMS error.

[0193] In practice, candidate circles can be obtained based on Ransac. Based on the Ransac framework, five points are randomly selected from the fitted points to fit an initial circle. Then, the distance from all fitted points to the initial circle is calculated. Based on whether the distance exceeds a threshold, it is determined which points are outliers and inliers. Then, the inliers are used to fit the circle, and the RMS error is calculated. Finally, the above process is repeated within the maximum number of iterations to obtain the circle fitting result with the smallest RMS error as the candidate circle.

[0194] Stable circle fitting utilizes the weighted iteration concept in the Robust method. It calculates the weight based on the distance from each point to the circle, excludes points with low weights, and updates the circle result. This process is repeated multiple times until the result remains stable.

[0195] The workpiece circle fitting method provided in this application can be executed by a workpiece circle fitting device. This application uses a workpiece circle fitting device to execute the workpiece circle fitting method as an example to illustrate the workpiece circle fitting device provided in this application.

[0196] This application also provides a workpiece circle fitting device.

[0197] like Figure 4 As shown, the workpiece circle fitting device includes:

[0198] The acquisition module 410 acquires a set of data points of the workpiece to be processed through the data acquisition device of the vision inspection system. The workpiece to be processed includes at least two circles.

[0199] The first processing module 420 performs circle fitting based on the data points in the data point set to obtain a first fitted circle;

[0200] The second processing module 430 determines the inner and outer points in the data point set based on the first fitted circle.

[0201] The third processing module 440 performs circle fitting based on the interior points in the data point set and the radius constraint of the fitted circle to obtain the second fitted circle. The radius constraint of the fitted circle is used to characterize the maximum and minimum radius of the fitted circle.

[0202] The fourth processing module 450 iteratively updates the inner and outer points of the data point set based on the second fitted circle.

[0203] The fifth processing module 460 performs circle fitting based on the interior points in the data point set after the iteration terminates, to obtain at least two target fitted circles for the workpiece to be processed.

[0204] According to the workpiece circle fitting device provided in the embodiments of this application, an initial first fitting circle is obtained by directly fitting a set of data points. Based on the first fitting circle, inner and outer points are divided, and a fitting circle radius constraint condition is introduced to fit a second fitting circle with higher accuracy and a radius within a certain range. The inner and outer points are iteratively updated based on the second fitting circle to find a more stable and accurate inner point. Finally, a target fitting circle with stable results and high fitting accuracy is obtained. For scenarios where there are multiple circles with different radii in the workpiece to be processed, fitting circle radius constraint conditions corresponding to different circles are introduced to ensure fitting accuracy and stability while also distinguishing circles with different radii.

[0205] In some embodiments, the third processing module 440 is used to optimize the circle fitting function corresponding to the circle radius constraint condition by means of the constraint factor to obtain an unconstrained circle fitting function.

[0206] Using the minimum difference in the radii of the fitted circles as the objective function, the unconstrained circle fitting function is solved to obtain the fitting circle parameters corresponding to the radius constraint condition.

[0207] Based on the interior points of the data point set and the parameters of the fitted circle, a second fitted circle is obtained.

[0208] In some embodiments, the third processing module 440 is used to determine the target number based on the proportion of interior points in the data point set and the maximum number of iterations constraint;

[0209] Iteratively update the target number of times for the interior points in the data point set;

[0210] Based on the fitting circle parameters, the inner points updated in the data point set are fitted with a circle to obtain the third fitting circle, and the fitting error of the third fitting circle in each iteration is calculated.

[0211] Based on the fitting error, a second fitting circle is determined from the target number of third fitting circles.

[0212] In some embodiments, the third processing module 440 is used to refit the first fitted circle;

[0213] Based on the new first fitted circle, the interior and exterior points in the data point set are redefined.

[0214] In some embodiments, the fourth processing module 450 is used to determine the weight of each data point in the data point set based on the distance from each data point in the data point set to the second fitted circle.

[0215] Based on the weights of each data point in the data point set, the inner and outer points of the data point set are iteratively updated, with the weights of the inner points being greater than the weights of the outer points.

[0216] In some embodiments, the fourth processing module 450 is used to iteratively update the interior points and exterior points in the data point set based on the distance from each data point in the data point set to the second fitted circle and the prior distance of the exterior points. The prior distance of the exterior points is used to characterize that the distance from any exterior point in the data point set to the second fitted circle is greater than the distance from any interior point to the second fitted circle.

[0217] In some embodiments, the fourth processing module 450 is used to determine M far points in the data point set in each iteration, where M is an integer greater than 1;

[0218] The iteration terminates if the M far points of the current iteration are the same as the M far points of the previous iteration.

[0219] In some embodiments, the second processing module 430 is used to determine the inner and outer points in the data point set based on the distance from each data point in the data point set to the first fitted circle and the inner point distance threshold.

[0220] The workpiece circular fitting device in this application embodiment can be an electronic device or a component of an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific devices.

[0221] The workpiece circular fitting device in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit its use.

[0222] The workpiece circle fitting device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0223] This application also provides a visual inspection system.

[0224] like Figure 5 As shown, the visual inspection system includes:

[0225] Data acquisition device 510, the data acquisition device is used to acquire the data point set of the workpiece to be processed;

[0226] The controller 520 is electrically connected to the data acquisition device and is used to execute the workpiece circle fitting method described above.

[0227] According to the visual inspection system provided in this application embodiment, an initial first fitting circle is obtained by directly fitting a set of data points. Based on the first fitting circle, inner and outer points are divided, and a fitting circle radius constraint condition is introduced to fit a second fitting circle with higher accuracy and a radius within a certain range. The inner and outer points are iteratively updated based on the second fitting circle to find a more stable and accurate inner point. Finally, a target fitting circle with stable results and high fitting accuracy is obtained. For scenarios where there are multiple circles with different radii in the workpiece to be processed, fitting circle radius constraint conditions corresponding to different circles are introduced to ensure fitting accuracy and stability while also distinguishing circles with different radii.

[0228] In some embodiments, such as Figure 6 As shown, this application embodiment also provides an electronic device 600, including a processor 601, a memory 602, and a computer program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, it implements the various processes of the above-described workpiece circle fitting method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0229] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0230] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described workpiece circle fitting method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0231] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0232] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described workpiece circle fitting method.

[0233] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0234] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0235] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0236] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0237] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0238] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A method of circle fitting of a workpiece, characterized by, The method is applied to a visual inspection system, and the method comprises: obtaining a data point set of a workpiece to be processed by a data acquisition device of a visual inspection system, the workpiece to be processed comprising at least two circles; performing circle fitting based on data points of the data point set to obtain a first fitted circle; determining inliers and outliers in the data point set based on the first fitted circle; performing circle fitting based on the inliers in the data point set and a fitted circle radius constraint condition to obtain a second fitted circle, the fitted circle radius constraint condition being used to represent a maximum value of a fitted circle radius and a minimum value of the fitted circle radius; iteratively updating the inliers and the outliers in the data point set based on the second fitted circle; performing circle fitting based on the inliers in the data point set after iteration termination to obtain at least two target fitted circles of the workpiece to be processed; the performing circle fitting based on the inliers in the data point set and the fitted circle radius constraint condition to obtain the second fitted circle comprises: optimizing a circle fitting function corresponding to the fitted circle radius constraint condition by a constraint factor to obtain an unconstrained circle fitting function; solving the unconstrained circle fitting function to obtain fitted circle parameters corresponding to the fitted circle radius constraint condition, with a minimum fitted circle radius difference as an objective function; fitting the second fitted circle based on the inliers in the data point set and the fitted circle parameters; comprising: determining a target number based on a proportion of the inliers in the data point set and a maximum iteration number constraint; iteratively updating the inliers in the data point set for the target number of times; performing circle fitting on the updated inliers in the data point set based on the fitted circle parameters to obtain a third fitted circle, and calculating a fitting error of the third fitted circle in each iteration; determining the second fitted circle from the target number of third fitted circles based on the fitting error.

2. The workpiece circle fitting method of claim 1, wherein, the iteratively updating the inliers in the data point set for the target number of iterations comprises: re-fitting the first fitted circle; re-determining the inliers and the outliers in the data point set based on the new first fitted circle.

3. The workpiece circle fitting method of claim 1, wherein, the iteratively updating the inliers and the outliers in the data point set based on the second fitted circle comprises: iteratively updating the inliers and the outliers in the data point set based on distances of each data point in the data point set to the second fitted circle and an outlier prior distance, the outlier prior distance being used to represent that a distance of any outlier in the data point set to the second fitted circle is greater than a distance of any inlier in the data point set to the second fitted circle.

4. The workpiece circle fitting method of claim 3 wherein, the iteratively updating the inliers and the outliers in the data point set comprises: determining M far points in the data point set in each iteration, M being an integer greater than 1; in a case where the M far points in the current iteration are the same as the M far points in the last iteration, iteration is terminated.

5. The workpiece circle fitting method of any of claims 1-4, wherein, the determining the inliers and the outliers in the data point set based on the first fitted circle comprises: determining the inliers and the outliers in the data point set based on distances of each data point in the data point set to the first fitted circle and an inlier distance threshold.

6. A workpiece circle fitting apparatus characterized by comprising: comprising: An acquisition module is configured to acquire a data point set of a workpiece to be processed by a data acquisition device of a visual inspection system, the workpiece to be processed including at least two circles. A first processing module is configured to perform circle fitting based on data points of the data point set to obtain a first fitting circle. A second processing module is configured to determine inliers and outliers in the data point set based on the first fitting circle. A third processing module is configured to perform circle fitting based on the inliers in the data point set and a fitting circle radius constraint condition to obtain a second fitting circle, the fitting circle radius constraint condition being used to represent a maximum value and a minimum value of a fitting circle radius. A fourth processing module is configured to iteratively update the inliers and the outliers in the data point set based on the second fitting circle. A fifth processing module is configured to perform circle fitting based on the inliers in the data point set after iteration termination to obtain at least two target fitting circles of the workpiece to be processed. The circle fitting based on the inliers in the data point set and the fitting circle radius constraint condition to obtain the second fitting circle includes: optimizing a circle fitting function corresponding to the fitting circle radius constraint condition by a constraint factor to obtain an unconstrained circle fitting function; taking a minimum fitting circle radius difference as an objective function to solve the unconstrained circle fitting function to obtain fitting circle parameters corresponding to the fitting circle radius constraint condition; and fitting the second fitting circle based on the inliers in the data point set and the fitting circle parameters. The fitting circle radius constraint condition includes: determining a target number based on a proportion of the inliers in the data point set and a maximum iteration number constraint; performing iteration update on the inliers in the data point set for the target number of times; performing circle fitting on the updated inliers in the data point set based on the fitting circle parameters to obtain a third fitting circle and calculating a fitting error of the third fitting circle in each iteration; 7. A vision inspection system characterized by, determining the second fitting circle from the target number of third fitting circles based on the fitting error. The method includes: a data acquisition device configured to acquire a data point set of a workpiece to be processed; 8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, a controller electrically connected with the data acquisition device, the controller being configured to execute the workpiece circle fitting method according to any one of claims 1-5. The processor executes the program to implement the workpiece circle fitting method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Circle fitting algorithm based on multistage optimization

    CN114612550A