A target circle center extraction method based on K-means clustering
By optimizing the target center coordinates through K-means clustering, the problem of high computational complexity in existing technologies is solved, and real-time and accurate positioning of the target center is achieved, thereby improving the accuracy and efficiency of camera calibration and vehicle maintenance.
Patent Information
- Application Number
- CN202411820988.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-12-11
AI Technical Summary
The existing target center extraction method has high computational complexity and is difficult to achieve real-time accurate positioning, especially in camera calibration and vehicle maintenance.
The K-means clustering method is used to optimize the target circle center coordinates. The ellipse equation is fitted by the least squares method to construct a circle on the ellipse circumference. The K-means clustering algorithm is used to iteratively optimize the circle center coordinates. Combined with the special shape of the target design, the number of data points and outliers is reduced to improve the positioning accuracy.
The computational complexity is reduced, the extraction accuracy of the target center point and the real-time monitoring capability are improved, and the high precision and practicality of the calibration process are ensured.
Smart Images

Figure CN119785043B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of camera calibration and vehicle repair and maintenance, and in particular to a target center extraction method based on K-means clustering. Background Art
[0002] In today's digital world, image acquisition and processing technologies have become core components of computer vision, image analysis, and many other fields. For camera-calibrated four-wheel alignment, accurately extracting the coordinates of camera-captured image points is a challenging and crucial task. During this process, the coordinates of feature points in the image must be obtained from the target image and optimized using certain techniques to achieve a relatively accurate result.
[0003] At present, the commonly used planar targets for image acquisition are disk mode and chessboard mode. However, because the chessboard mode target is easily affected by the lighting environment, the disk mode planar target is more commonly used. For the disk mode planar target, the center of the target circle on the target is the feature point that needs to be extracted. The conventional method is to use elliptical Hough transform or least squares fitting to directly obtain the center coordinates of the target circle, but these two methods are not very accurate in positioning. Therefore, some researchers have developed further optimization methods, such as extracting the center coordinates through sliding clustering and caliper clustering methods. However, these methods often rely on a large amount of labeled image data for training, and the high computational complexity will affect the real-time detection of the target, making these methods unapplicable in camera calibration and vehicle maintenance and inspection.
[0004] Therefore, there is an urgent need for a target center extraction method that requires little computation, can be monitored in real time, and has accurate positioning. Summary of the Invention
[0005] To solve the above technical problems, the present invention provides a target center extraction method based on K-means clustering. This method first fits the elliptical equation of the target circle by the least squares method, and constructs a circle on the circumference of the ellipse on this basis. Then, according to the distance between the intersection points between the circles on the circumference of the ellipse and the center of the target circle, the K-means clustering method is used to optimize the center coordinates of the target circle, thereby improving the accuracy of extracting the coordinates of the center point of the target circle.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] A target center extraction method based on K-means clustering includes the following steps:
[0008] Step 1: Mark the center of each target circle on the target suitable for K-means clustering optimization;
[0009] Step two, determining the initial target circle center coordinates: image acquisition is performed on the target, and after pre-processing, the center coordinates of each target circle on the target in the pixel coordinate system are extracted by an ellipse fitting method and the long semi-axis b;
[0010] Step three, constructing a circle on the circumference of the fitted ellipse: starting from 0°, a circle is constructed on the circumference of the fitted ellipse of each target circle, with every 10° interval as the center and b as the radius, and a total of 36 circles are constructed on the circumference of the ellipse;
[0011] Step four, constructing a data point set A: all intersection points of the 36 circles in step three are taken as data points to construct a data point set A, and the distance between each point in set A and the center of the target circle is calculated;
[0012] Step five, screening data points: if the distance in step four is greater than a preset threshold , the data point is screened out, and the data points after screening are taken as a new data point set B;
[0013] Step six, determining the optimized center coordinates: the data points in set B are iteratively calculated by the K-means clustering algorithm, and the coordinates of the new clustering center are obtained each time, if the distance between the new clustering center and the previous clustering center is greater than a threshold , the next iteration is performed; otherwise, the updated clustering center is taken as the center coordinates of the optimized target circle ;
[0014] Further technical solutions, the target in step one includes a rectangular calibration plate and eight target circles arranged on the calibration plate, four target circles of the same size are arranged on the left and right sides of the calibration plate symmetrically along the center of the calibration plate, and every four target circles are arranged in a square shape.
[0015] Further technical solutions, the distance between adjacent target circles of the eight target circles is greater than the diameter of the target circle.
[0016] Further technical solutions, in step two, after image acquisition, the least square method is used to fit an ellipse for the edge of the detected target circle, an ellipse equation is obtained, and it is judged whether the fitted ellipse meets the preset area range, if yes, the initial target circle center coordinates and the long semi-axis b are determined.
[0017] Further technical solutions, in step four, the calculation formula of the distance between each point in set A and the center is:
[0018] (Formula 1)
[0019] Wherein, i = 1, 2 …… n, is the coordinate of the center of the fitted ellipse, represents the column, represents the row; is the coordinate of the intersection data point, represents the column coordinate of the first intersection point, represents the column coordinate of the first intersection point.
[0020] Further technical solutions, the specific method of step six is:
[0021] (1) determine the number of clusters, and take the coordinate of the center of the fitted ellipse As the initial cluster center point coordinate;
[0022] (2) first randomly allocate the data points in set B to the clusters, calculate the distance between the data points and the cluster center, and in the next iteration calculation, according to the distance value, allocate the data points to the nearest cluster;
[0023] (3) update the cluster center: calculate the average value coordinate of all data points in each cluster, and take the average value coordinate as the coordinate of the updated cluster center;
[0024] (4) calculate the center moving distance of the cluster: calculate the distance between the updated cluster center point and the cluster center point of the last time, which is the center moving distance of the cluster;
[0025] (5) repeat the above steps (2) to (4) for iteration calculation, until the center moving distance of the cluster is less than the threshold , take the updated cluster center point coordinate as the optimized center coordinate .
[0026] Further technical solutions, in step (2), the calculation formula of the distance between the data point and the cluster center is:
[0027] (Formula 2)
[0028] Wherein, i = 1, 2 …… n; is the coordinate of the cluster center point; is the coordinate of the data point.
[0029] Further technical solutions, in step (3), the specific calculation method of the coordinate of the updated cluster center is as follows:
[0030] Assume that any cluster contains n data points whose coordinates are (P1 x ,P1 y), (P2 x ,P2 y ), …, (Pn x ,Pn y ), then the updated cluster center point coordinates are:
[0031] (Formula 3)
[0032] Further technical solutions, the formula for calculating the center moving distance of the cluster in step (4) is:
[0033] (Formula 4)
[0034] wherein, indicates the center moving distance of the cluster, is the updated cluster center point coordinates, is the last cluster center point coordinates.
[0035] Advantages
[0036] The technical solutions provided by the application have the following significant effects compared with the prior art:
[0037] (1) The application designs a target suitable for K-means clustering optimization. Compared with the existing conventional disc target, the total amount of data points generated by clustering on the improved target is significantly reduced compared with the traditional target when generating the data point set of K-means clustering. The computational complexity caused by the large amount of data in the optimization process is greatly reduced, the extraction accuracy of the target center point coordinates is improved, and real-time accurate monitoring is ensured. In addition, the target structure is simpler and more practical, and the special shape design can effectively reduce the generation of abnormal data points, further improving the extraction accuracy.
[0038] (2) The target center extraction method based on K-means clustering of the application generates a data point set by constructing a circle on the circumference of the target circle, and then establishes a connection between the edge geometric information and the center coordinates, realizing geometric constraint of the center coordinate positioning. At the same time, by introducing the K-means clustering optimization method, the purpose of adaptive iterative optimization of the center coordinate is realized, so that the finally extracted center point coordinates of the target circle are more accurate. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 is a flowchart of the target center extraction method based on K-means clustering of the application;
[0040] Figure 2 is a comparison diagram of the intersection points of the circles obtained by using the existing target and the target in the application, a is the existing target, and b is the target in the application;
[0041] Figure 3 Schematic diagram of the structure of the target of the present invention.
[0042] Markings in the figure: 1. Calibration plate, 2. Target circle. DETAILED DESCRIPTION
[0043] In order to further understand the content of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.
[0044] Example
[0045] like Figure 1 As shown, a target center extraction method based on K-means clustering is firstly performed on a target suitable for K-means clustering optimization using an ellipse fitting method to preliminarily extract the center coordinates and major semi-axis of each target circle in the pixel coordinate system. Next, 36 circles are constructed on the circumference of the fitted ellipse of each target circle. Then, based on the distance relationship between the intersection points of these circles and the center of the target circle, K-means clustering is used to optimize the center coordinates of the target circle, thereby improving the accuracy of the extracted target circle center coordinates. Through the optimization method of K-means clustering, the present invention can ultimately determine the target circle center coordinates with higher accuracy.
[0046] Specifically, the method comprises the following steps:
[0047] Step 1: Mark the center of each target circle on the target suitable for K-means clustering optimization;
[0048] Step 2: Determine the initial center coordinates of the target circle: Capture the target image, and after preprocessing, use the ellipse fitting method to preliminarily extract the center coordinates of each target circle on the target in the pixel coordinate system. and semi-major axis b;
[0049] Step 3: Construct circles on the circumference of the fitted ellipse: On the circumference of each target circle's fitted ellipse, starting from 0°, with points at intervals of 10° as the center and b as the radius, construct a total of 36 circles on the circumference of the ellipse;
[0050] Step 4. Construct data point set A: Use all the intersection points of the 36 circles in step 3 as data points to construct data point set A, and calculate the distance between each point in set A and the center of the target circle;
[0051] Step 5: Filter data points: If the distance in step 4 is greater than the preset threshold , then filter out the data point and use the eliminated data point as the new data point set B;
[0052] Step 6. Determine the optimized center coordinates: Use the K-means clustering algorithm to iteratively calculate the data points in set B. Each time, the coordinates of the new cluster center are obtained. If the distance between the new cluster center and the previous cluster center is greater than the threshold , then the next iterative calculation is performed; otherwise, the updated cluster center is used as the center coordinate of the optimized target circle ;
[0053] (1) Determine the number of clusters and set the coordinates of the center point of the fitted ellipse As the initial cluster center coordinates;
[0054] In K-means clustering, the number of clusters is an important hyperparameter, which is usually determined in advance. This hyperparameter indicates how many clusters you want the algorithm to divide the data into. After determining the number of clusters, you need to determine the initial cluster center points, that is, the cluster center point coordinates. There are as many clusters as there are clusters, where K is the number of cluster centers. Since we want to get the coordinates of the circle center, we use the coordinates of the center point of the fitted ellipse obtained above as As the initial cluster center coordinates.
[0055] (2) First, randomly assign the data points in set B to clusters, calculate the distance between the data points and the cluster center, and in the next iterative calculation, assign the data points to the cluster with the closest distance based on the distance value; the calculation formula for the distance between the data point and the cluster center is as follows:
[0056] (Formula 2)
[0057] Where i=1,2...n; are the coordinates of the cluster center; are the data point coordinates.
[0058] Because it is impossible to determine the cluster with the closest distance to the data points in set B at the beginning, a random allocation method is adopted. In subsequent iterative calculations, the nearest allocation is performed based on the calculated distance.
[0059] (3) Update the cluster center: Calculate the average coordinates of all data points in each cluster and use the average coordinates as the updated cluster center coordinates. The specific method is as follows:
[0060] For any cluster, assume that the coordinates of the n data points it contains are (P1 x ,P1 y )、(P2 x ,P2 y ),……、(Pn x ,Pn y ), then the updated cluster center coordinates are:
[0061] (Formula 3)
[0062] (4) Calculate the center moving distance of the cluster: calculate the distance between the updated clustering center point and the last clustering center point, that is, the center moving distance of the cluster, and the specific calculation formula is as follows:
[0063] (Formula 4)
[0064] wherein, the center moving distance of the cluster, the updated clustering center point coordinate, the last clustering center point coordinate.
[0065] (5) Repeat steps (2) to (4) to perform iterative calculation until the center moving distance of the cluster is less than the threshold , the updated clustering center point coordinate is taken as the optimized center coordinate .
[0066] The target in the step one includes a rectangular calibration plate 1 and eight target circles 2 arranged on the calibration plate, four target circles 2 of the same size are arranged on the left and right sides of the calibration plate 1 symmetrically along the center of the calibration plate, and every four target circles 2 are arranged in a square shape; the distance between adjacent target circles is greater than the diameter of the target circle.
[0067] The target of the application and the conventional circular target in the prior art are respectively used to collect data and image processing, 36 circles are constructed on the circumference of each target circle of the two targets, and the intersection points of the circles are compared, and the results are shown in Figure 2 It can be seen from the figure that the number of intersection points of the circles in the existing target is larger, and it can be seen that the target of the application can effectively reduce the number of data points, greatly reduce the calculation complexity caused by large data volume in the optimization process, improve the extraction accuracy of the target center point coordinate, and ensure real-time accurate monitoring. Moreover, the arrangement of the target circles of the conventional target is very dense, and when the circles are constructed, the constructed circles of adjacent target circles intersect, and intersection points are generated. However, these intersection points are invalid and belong to abnormal data points, and the special design of the target of the application greatly reduces the generation of abnormal data points, further improving the extraction accuracy. At the same time, the existing calibration method needs to randomly select four point pairs (image coordinates and actual plane coordinates of the target circle) for homography matrix calculation after extracting all the center coordinates of the target circles, and the four points need to be collinear in the calculation to ensure linear independence. Because of the special arrangement of the target circles of the application, the collinearity problem in the linear calculation process can be effectively avoided, and the accuracy of the subsequent calibration calculation is improved.
[0068] In the second step, after image acquisition, the edge of the detected target circle is fitted with an ellipse using the least square method to obtain an ellipse equation, and it is determined whether the fitted ellipse meets the preset area range, and if so, the initial target circle center coordinates are determined and the long semi-axis b.
[0069] The average root mean square error and the re-projection error of the circle center coordinates collected by the above method and the conventional least square method in the camera and radar joint calibration process are calculated respectively, and the accuracy of the target circle center extraction method based on K-means clustering is determined by comparing the error size. The specific results are shown in Table 1 and Table 2 as follows:
[0070] Table 1 Calibration results of target left deflection
[0071]
[0072] Table 2 Calibration results of target right deflection
[0073]
[0074] From the above table, for the average root mean square error, the method based on K-means clustering of the present application is lower than the conventional least square method, the average root mean square error of the present application can be reduced by about 17.01%~20.54%, which indicates that the deviation between the measured value and the true value is reduced, and is closer to the actual model. For the average re-projection error, the method based on K-means clustering of the present application is also lower than the conventional least square method, the average re-projection error of the present application can be reduced by about 17.22%~17.89%, which indicates that the method of the present application has high calibration precision and high calibration quality, and proves the feasibility and advantages of the present application.
[0075] The above describes the present application and its embodiments in a schematic manner, which is not restrictive, and the embodiments shown in the drawings are only one of the embodiments of the present application, and the actual structure is not limited thereto. Therefore, if a person skilled in the art is inspired thereby, without departing from the spirit of the present application, similar structural modes and embodiments can be designed without creative design, which shall belong to the protection scope of the present application.
Claims
1. A target center extraction method based on K-means clustering, characterized in that: The steps include: Step 1: Mark the center of each target circle on the target suitable for K-means clustering optimization; Step 2: Determine the initial center coordinates of the target circle: Capture the target image, and after preprocessing, use the ellipse fitting method to preliminarily extract the center coordinates of each target circle on the target in the pixel coordinate system. and semi-major axis b; Step 3: Construct circles on the circumference of the fitted ellipse: On the circumference of each target circle's fitted ellipse, starting from 0°, with points at intervals of 10° as the center and b as the radius, construct a total of 36 circles on the circumference of the ellipse; Step 4. Construct data point set A: Use all the intersection points of the 36 circles in step 3 as data points to construct data point set A, and calculate the distance between each point in set A and the center of the target circle; Step 5: Filter data points: If the distance in step 4 is greater than the preset threshold , then filter out the data point and use the eliminated data point as the new data point set B; Step 6. Determine the optimized center coordinates: Use the K-means clustering algorithm to iteratively calculate the data points in set B. Each time, the coordinates of the new cluster center are obtained. If the distance between the new cluster center and the previous cluster center is greater than the threshold , then the next iterative calculation is carried out; Otherwise, the updated cluster center is used as the center coordinate of the optimized target circle. ; The target in step 1 includes a rectangular calibration plate and 8 target circles arranged on the calibration plate. Four target circles of the same size are arranged symmetrically along the center of the calibration plate on each side of the calibration plate, and each four target circles are arranged in a regular rhombus shape.
2. The target center extraction method based on K-means clustering according to claim 1, characterized in that: The distances between adjacent target circles of the eight target circles are greater than the diameters of the target circles.
3. The target center extraction method based on K-means clustering according to claim 1, characterized in that: In the second step, after the image is collected, the edge of the detected target circle is fitted with an ellipse using the least squares method to obtain an ellipse equation, and it is determined whether the fitted ellipse meets the preset area range. If it does, the initial coordinates of the center of the target circle are determined. and the semi-major axis b.
4. The target center extraction method based on K-means clustering according to claim 1, characterized in that: In step 4, the distance between each point in set A and the center of the circle is calculated as follows: (Formula 1) Where i=1,2……n, are the center coordinates of the fitted ellipse, Represents a column, Indicates the line; are the coordinates of the intersecting data points, Indicates the The column coordinates of the intersection points, Indicates the The row coordinates of the intersection points.
5. The target center extraction method based on K-means clustering according to claim 1, characterized in that: The specific method of step six is: (1) Determine the number of clusters and set the coordinates of the center point of the fitted ellipse As the initial cluster center coordinates; (2) First, randomly assign the data points in set B to clusters, calculate the distance between the data points and the cluster center, and in the next iterative calculation, assign the data points to the cluster with the closest distance based on the distance value; (3) Update the cluster center: Calculate the average coordinates of all data points in each cluster and use the average coordinates as the coordinates of the updated cluster center; (4) Calculate the center moving distance of the cluster: Calculate the distance between the updated cluster center point and the previous cluster center point, which is the center moving distance of the cluster; (5) Repeat the above steps (2) to (4) for iterative calculation until the center movement distance of the cluster is less than the threshold , use the updated cluster center coordinates as the optimized circle center coordinates .
6. The target center extraction method based on K-means clustering according to claim 5, characterized in that: In step (2), the distance between the data point and the cluster center is calculated as follows: (Formula 2) Where, i=1,2……n; are the coordinates of the cluster center; are the data point coordinates.
7. The target center extraction method based on K-means clustering according to claim 5, characterized in that: The specific calculation method of the coordinates of the updated cluster center in step (3) is as follows: For any cluster, suppose the coordinates of the n data points it contains are (P1 x ,P1 y )、(P2 x ,P2 y ),……、(Pn x ,Pn y ), then the updated cluster center coordinates are: (Formula 3).
8. The target center extraction method based on K-means clustering according to claim 5, characterized in that: The calculation formula of the center movement distance of the cluster in step (4) is: (Formula 4) in, represents the moving distance of the cluster center, is the updated cluster center coordinate, is the coordinate of the last cluster center point.