Hub contour extraction method in wheel visual pose recognition
The data points of the wheel hub are extracted by Graham and the ellipse is fitted using RANSAC's improved least squares method, which solves the problem of insufficient extraction accuracy and robustness of the wheel hub ellipse in the prior art, achieving higher extraction accuracy and ability to resist noise interference.
Patent Information
- Application Number
- CN202510022604.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-05-09
AI Technical Summary
In the prior art, when extracting wheel hub ellipses, it is difficult to accurately identify and extract the true ellipses of the wheel hub when extracting wheel hub ellipses, and when being susceptible to image noise, interference or incomplete profile.
The data points of the wheel hub profile were extracted by Graham scanning method, and the target ellipse was fitted by the least squares method based on RANSAC to improve the extraction accuracy and robustness.
It improves the accuracy and robustness of elliptical extraction of wheel hubs, and can effectively deal with interference factors in low-quality images or sensor data to ensure the accuracy of the extracted elliptical.
Smart Images

Figure CN119963632A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image data processing, and specifically relates to a method for extracting a hub profile in wheel visual posture recognition. Background Art
[0002] Wheels are an important part of a vehicle, directly affecting driving stability, safety and driving experience. Correct alignment and adjustment of wheels can help improve handling, reduce tire wear, extend tire life, improve fuel economy and reduce maintenance costs. Four-wheel alignment technology optimizes vehicle performance by precisely adjusting the angle and position of the wheels. Key adjustments include toe-in, wheel inclination (camber) and caster. These adjustments can effectively reduce abnormal tire wear, improve driving stability, and avoid fuel waste and discomfort caused by wheel deviation. With the development of technology, four-wheel alignment methods are constantly improving. Modern alignment systems combine optical technology, laser sensors and computer image processing. They use cameras to collect wheel images, use image processing algorithms to extract the wheel hub contour ellipse, and then reverse the spatial parameters of the ellipse based on the two-dimensional ellipse parameters to obtain the three-dimensional position of the wheel to provide a basis for four-wheel alignment.
[0003] Accurate extraction of the wheel hub contour ellipse can effectively improve the accuracy of the wheel's three-dimensional pose. At present, the extraction of the wheel hub ellipse mainly relies on traditional methods such as Hough transform and direct least squares method. However, these methods are often restricted by image quality in practical applications, resulting in unsatisfactory extraction results. Specifically, when there is a lot of image noise or the wheel hub contour is incomplete, traditional methods are easily disturbed, resulting in mis-extraction or missed extraction. In addition, the shape of the wheel hub may be deformed due to changes in viewing angle, uneven lighting or other external factors, further increasing the difficulty of the extraction process. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a hub contour extraction method in wheel visual pose recognition, which can improve the accuracy and robustness of wheel hub ellipse extraction, and solve the problem that existing ellipse extraction methods are often difficult to accurately identify and extract the true elliptical shape of the hub when faced with wheel image noise, interference or incomplete contours.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] A method for extracting wheel hub contour in wheel visual posture recognition comprises the following steps:
[0007] Step 1: Initial image preprocessing
[0008] Grayscale the initial image and perform median filtering to remove noise, and perform linear point operations on the image to enhance the contrast;
[0009] Step 2: Extract target contour
[0010] For the preprocessed image, after obtaining the edge map using Canny edge detection, all contours are found in the edge map, and finally the target contour is extracted by clustering;
[0011] Step 3: Extract the external point set of the target contour
[0012] Graham scanning method or Andrew algorithm is used to extract data points from the target contour to obtain the external point set of the target contour;
[0013] Step 4: Randomly select a subset of data points in proportion;
[0014] Randomly select some data points from the external point set of the target contour according to the set ratio to obtain a subset;
[0015] Step 5: Fitting the target ellipse
[0016] Using the data points in the subset, the target ellipse is fitted by using the least square method based on RANSAC or the fitting method based on geometric distance;
[0017] Step 6: Data point division
[0018] Calculate the distance from all data points in the target contour external point set to the fitted target ellipse; determine whether the corresponding data point is an inner point or an outer point based on the distance, and obtain the inner point ratio;
[0019] Step 7: Determine whether the interior point ratio corresponding to the target ellipse obtained by the current iterative fitting is greater than the optimal interior point ratio: if so, the current interior point ratio is used as the optimal interior point ratio; if not, the optimal interior point ratio is kept unchanged;
[0020] Step 8: Determine whether the number of iterations k reaches the set maximum number of iterations K: If so, the target ellipse obtained by fitting the optimal inner point ratio is used as the elliptical contour of the hub; if not, loop through step 4, k=k+1.
[0021] Furthermore, in step 1, the method of performing linear point operation on the image to enhance the contrast is:
[0022] g(x,y)=a·f(x,y)+b
[0023] Where: f(x,y) and g(x,y) represent the grayscale values of the image at position (x,y) before and after processing; a is the scaling factor, which affects the contrast; b is the offset, which adjusts the brightness.
[0024] Furthermore, the mean gray value of f(x,y) is obtained, denoted as meanGray, and:
[0025] b=meanGray
[0026] Then the image after performing linear point operation to enhance the contrast is expressed as:
[0027] g(x,y)=a·[f(x,y)-meanGray]+meanGray
[0028] Wherein: a is the scaling factor, and a>1.
[0029] Furthermore, in step 2, the method of extracting the target contour by clustering is: given a distance threshold D1, traversing all contours, and clustering the contours with a minimum distance between contours less than D1 into one category; among the clustered contours, filtering out the target contour according to the conditions that the contour area is the largest and the contour center coordinates are closest to the image center.
[0030] Further, in step 3, the method steps of extracting data points from the target contour using the Graham scanning method are as follows:
[0031] 31) Find the point with the lowest y coordinate in P. If the y coordinates are the same, select the point with the smallest x coordinate and record it as anchor point P0; where P is the set of all data points to be processed in the target contour;
[0032] 32) Calculate each point P i (x i ,y i ) and P0(x0,y0):
[0033] θ n =atan2(y i -y0,x i -x0)
[0034] 33) Sort the points from small to large polar angles. If the polar angles are the same, only keep the point farthest from the anchor point.
[0035] 34) Initialize an empty stack S, push P0 and the first point P1 after polar angle sorting into the stack;
[0036] 35) Starting from the second point P2, process each point P in turn i ; The first and second points on the top of the stack are called P top1 and P top2 , check P top1 and P top2 With the current point P i The relative position of , calculate the cross product:
[0037] (P top1 ―P top2 )×(Pi ―P top2 )
[0038] =(P top1 .x―P top2 .x)×(P i .y―P top2 .y)―(P top1 .y―P top2 .y)×(P i .x―P top2 .x)
[0039] 36) Determine whether the cross product is greater than 0: If so, it means that from P top2 To P top1 To P i The order is counterclockwise, data point P i Directly into the stack; if not, it means from P top2 To P top1 To P i If the order is clockwise or the three points are collinear, then P is popped out first. top1 , continue checking until the counterclockwise condition that the cross product is greater than 0 is met, and then P i Push to stack;
[0040] 37) Rotate and execute step 35) to step 36) until all points are processed, and the remaining data points in the stack are the external point set of the extracted target contour.
[0041] Furthermore, in step 5, the method of fitting the target ellipse using the least squares method improved based on RANSAC is:
[0042] The general equation of an ellipse is:
[0043] x 2 +Axy+By 2 +Cx+Dy+E=0
[0044] Among them: A, B, C, D and E are coefficients to be solved; and:
[0045]
[0046] in:
[0047]
[0048] Where: N is the number of data points in the subset.
[0049] Furthermore, in step 6, the distance between the data point and the fitted target ellipse is calculated as follows:
[0050]
[0051] Where: d i is the data point P i (x i ,y i ) to the target ellipse.
[0052] Further, in step eight, the maximum number of iterations K is:
[0053]
[0054] Where: z represents the expected success probability; N is the number of sample points for fitting the ellipse model.
[0055] The beneficial effects of the present invention are:
[0056] The wheel hub contour extraction method in the wheel visual posture recognition of the present invention uses Graham scanning to extract wheel hub contour data points and fits the wheel hub ellipse based on the RANSAC improved least squares method, which improves the accuracy and robustness of wheel hub ellipse extraction and solves the problem that the traditional ellipse extraction method is often difficult to accurately identify and extract the true elliptical shape of the wheel hub in the face of wheel image noise, interference or incomplete contour. The present invention can improve the accuracy of wheel hub ellipse extraction and provide a basis for the visual measurement of wheel alignment parameters. The method of the present invention can deal with interference factors in low-quality images or sensor data, such as low-contrast images, blurred or damaged contour data; even in the case of poor data quality, the wheel hub ellipse can still be effectively extracted. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to make the purpose, technical solution and beneficial effects of the present invention clearer, the present invention provides the following drawings for illustration:
[0058] Figure 1 It is a flow chart of the hub contour extraction method in wheel visual posture recognition of the present invention;
[0059] Figure 2 A schematic diagram of sorting data points according to polar angles;
[0060] Figure 3 This is the cross product result analysis diagram. DETAILED DESCRIPTION
[0061] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0062] like Figure 1 As shown, the hub contour extraction method in wheel visual posture recognition in this embodiment includes the following steps.
[0063] Step 1: Initial image preprocessing
[0064] Specifically, during the image acquisition process, due to factors such as the performance limitations of the hardware device, the sensitivity of the sensor, and changes in ambient lighting conditions, the actual image obtained is often affected to a certain extent. These effects may manifest as noise interference, insufficient contrast, color distortion, or even incomplete or blurred image contours. Therefore, in practical applications, effective measures need to be taken to minimize these effects to ensure the accuracy and reliability of image data.
[0065] In this embodiment, the initial image is grayed and subjected to median filtering to remove noise, and a linear point operation is performed on the image to enhance the contrast. Specifically, the method of performing a linear point operation on the image to enhance the contrast is:
[0066] g(x,y)=a·f(x,y)+b
[0067] Where: f(x,y) and g(x,y) represent the grayscale values of the image at position (x,y) before and after processing; a is the scaling factor, which affects the contrast; b is the offset, which adjusts the brightness.
[0068] In order to better reflect the local information of the image, the mean gray value of f(x,y) is calculated, denoted as meanGray, and let:
[0069] b=meanGray
[0070] Then the image after performing linear point operation to enhance the contrast is expressed as:
[0071] g(x,y)=a·[f(x,y)―meanGray]+meanGray
[0072] Wherein: a is the scaling factor, and a>1.
[0073] In this way, the image contrast can be enhanced and the main structural features of the image can be preserved.
[0074] Step 2: Extract target contour
[0075] For the preprocessed image, Canny edge detection is used to obtain the edge map, and then all contours are found in the edge map. Since the obtained contours are scattered, the target contours are finally extracted by clustering.
[0076] Specifically, in this embodiment, the method of extracting the target contour by clustering is: given a distance threshold D1, traverse all contours, and cluster the contours with the minimum distance between contours less than D1 into one category. Since the wheel hub occupies a considerable proportion in the wheel image and is generally located in the center of the image, among the clustered contours, the target contour is filtered out according to the conditions that the contour area is the largest and the contour center coordinates are closest to the image center.
[0077] Step 3: Extract the external point set of the target contour
[0078] Graham scanning method or Andrew algorithm is used to extract data points from the target contour to obtain the external point set of the target contour.
[0079] Specifically, the target contour can be regarded as a set of points. The points inside the point set are located inside the wheel hub, which has no effect on the fitting of the wheel hub ellipse boundary and will also occupy resources during calculation. Therefore, only the point set outside the contour is retained for boundary ellipse extraction. Collect all the points to be processed in the wheel hub contour, denoted as P = {P1, P2, ..., P n}. And perform Graham scanning on the hub contour point set to extract boundary fitting data points.
[0080] Specifically, in this embodiment, the method steps of extracting data points from the target contour using the Graham scanning method are as follows.
[0081] 31) Find the point with the lowest y coordinate in P. If the y coordinates are the same, select the point with the smallest x coordinate and record it as anchor point P0; where P is the set of all data points to be processed in the target contour.
[0082] 32) Calculate each point P i (x i ,y i ) and P0(x0,y0):
[0083] θ n =atan2(y i ―y0,x i ―x0)
[0084] 33) Sort the points from small to large polar angles. If the polar angles are the same, only keep the point farthest from the anchor point, such as Figure 2 shown.
[0085] 34) Initialize an empty stack S and push P0 and the first point P1 after polar angle sorting into the stack.
[0086] 35) Starting from the second point P2, process each point P in turn i ; The first and second points on the top of the stack are called P top1 and P top2, check P top1 and P top2 With the current point P i The relative position of , calculate the cross product:
[0087] (P top1 ―P top2 )×(P i ―P top2 )
[0088] =(P top1 .x―P top2 .x)×(P i .y―P top2 .y)―(P top1 .y―P top2 .y)×(P i .x―P top2 .x)
[0089] 36) Determine whether the cross product is greater than 0: If so, it means that from P top2 To P top1 To P i The order is counterclockwise, data point P i Directly into the stack; if not, it means from P top2 To P top1 To P i If the order is clockwise or the three points are collinear, then P is popped out first. to x1 (i.e. remove the top of the stack), continue checking until the counterclockwise condition that the cross product is greater than 0 is satisfied, and then P i Push into stack; Figure 3 shown.
[0090] 37) Rotate and execute step 35) to step 36) until all points are processed, and the remaining data points in the stack are the external point set of the extracted target contour.
[0091] Step 4: Randomly select a subset of data points in proportion
[0092] Some data points are randomly selected from the external point set of the target contour according to the set ratio to obtain a subset.
[0093] Specifically, considering the problem of incomplete wheel hub contour and strong light influence in the collected image, the data points obtained in the previous step are not necessarily all points on the wheel hub boundary contour, so not all points are used for wheel hub ellipse fitting. Specifically, a part of the data points are randomly selected in proportion. In this embodiment, 10% of the original data points are selected for ellipse fitting, and the number of fitting data points must be greater than 5.
[0094] Step 5: Fitting the target ellipse
[0095] The target ellipse is fitted by using the data points in the subset and adopting the least square method based on RANSAC or the fitting method based on geometric distance.
[0096] Specifically, the method of fitting the target ellipse using the least squares method improved based on RANSAC is:
[0097] The general equation of an ellipse is:
[0098] x 2 +Axy+By 2 +Cx+Dy+E=0
[0099] Among them: A, B, C, D and E are coefficients to be solved.
[0100] For several data points P i (x i ,y i ), according to the least squares principle, the fitted objective function is:
[0101]
[0102] In order to minimize F, it is necessary to make the partial derivatives of F equal to 0, that is:
[0103]
[0104] So we can get:
[0105]
[0106] Where: N is the number of data points in the subset.
[0107] Simplify the above formula to:
[0108]
[0109] in:
[0110]
[0111] get:
[0112]
[0113] By solving the five parameters A, B, C, D, and E, we can get the equation of the ellipse and then the parameters of the ellipse.
[0114] The traditional least square method uses all data points for one-time fitting, including noise points, so the fitting result is quite different from the actual result. Therefore, this embodiment performs improved least square fitting based on the RANSAC method.
[0115] Step 6: Data point division
[0116] Calculate the distance from all data points in the target contour external point set to the fitted target ellipse; determine whether the corresponding data point is an inner point or an outer point based on the distance, and obtain the inner point ratio.
[0117] Specifically, the distance from the data point to the fitted target ellipse is calculated as follows:
[0118]
[0119] Where: d i is the data point P i (x i ,y i ) to the target ellipse.
[0120] Given a distance threshold D2, when d i When d < D2, the point is considered to be an inner point in the fitted target ellipse; when d i > D2, the point is considered to be an external point that does not fit within the fitting target ellipse. Calculate the proportion of internal points to all data points and record it as p k .
[0121] Step 7: Determine the proportion of inner points p corresponding to the target ellipse obtained by the current iteration fitting k Is it greater than the optimal interior point ratio p? max :If so, then take the current interior point ratio p k As the optimal interior point ratio p max ; If not, keep the optimal interior point ratio p max constant.
[0122] Step 8: Determine whether the number of iterations k reaches the set maximum number of iterations K: If so, the target ellipse obtained by fitting the optimal inner point ratio is used as the elliptical contour of the hub; if not, loop through step 4, k=k+1.
[0123] For the RANSAC method, the more iterations, the higher the accuracy. However, the actual process cannot be infinitely iterated, so the maximum number of iterations K is calculated according to the following formula. In this embodiment, the maximum number of iterations K is:
[0124]
[0125] Wherein: Z represents the expected success probability, which is 99% in this embodiment; N is the number of sample points of the fitting ellipse model, which is 10% of the data points in this embodiment.
[0126] It can be seen from the above formula that the higher the proportion of inliers, the fewer the number of iterations required. Inliers are actually points on the elliptical contour of the hub. From the data point extraction process in step three, it can be seen that this embodiment greatly improves the proportion of inliers in the fitting data points, thereby greatly reducing the number of iterations required by the RANSAC method.
[0127] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for extracting wheel hub profile in wheel visual posture recognition, characterized in that: The steps include: Step 1: Initial image preprocessing Grayscale the initial image and perform median filtering to remove noise, and perform linear point operations on the image to enhance the contrast; Step 2: Extract target contour For the preprocessed image, after obtaining the edge map using Canny edge detection, all contours are found in the edge map, and finally the target contour is extracted by clustering; Step 3: Extract the external point set of the target contour Graham scanning method or Andrew algorithm is used to extract data points from the target contour to obtain the external point set of the target contour; Step 4: Randomly select a subset of data points in proportion; Randomly select some data points from the external point set of the target contour according to the set ratio to obtain a subset; Step 5: Fitting the target ellipse Using the data points in the subset, the target ellipse is fitted by using the least square method based on RANSAC or the fitting method based on geometric distance; Step 6: Data point division Calculate the distance from all data points in the target contour external point set to the fitted target ellipse; determine whether the corresponding data point is an inner point or an outer point based on the distance, and obtain the inner point ratio; Step 7: Determine whether the interior point ratio corresponding to the target ellipse obtained by the current iterative fitting is greater than the optimal interior point ratio: if so, the current interior point ratio is used as the optimal interior point ratio; if not, the optimal interior point ratio remains unchanged; Step 8: Determine whether the number of iterations k reaches the set maximum number of iterations K: If so, the target ellipse obtained by fitting the optimal inner point ratio is used as the elliptical contour of the hub; if not, loop through step 4, k=k+1.
2. The method for extracting wheel hub profile in wheel visual posture recognition according to claim 1, characterized in that: In step 1, the method of performing linear point operation on the image to enhance the contrast is: g(x,y)=a·f(x,y)+b Where: f(x,y) and g(x,y) represent the grayscale values of the image at position (x,y) before and after processing; a is the scaling factor, which affects the contrast; b is the offset, which adjusts the brightness.
3. The method for extracting wheel hub profile in wheel visual posture recognition according to claim 2, characterized in that: Find the mean gray value of f(x,y), denoted as meanGray, and let: b=meanGray Then the image after performing linear point operation to enhance the contrast is expressed as: g(x,y)=a·[f(x,y)-meanGray]+meanGray Where: a is the scaling factor, and a>1.
4. The method for extracting wheel hub profile in wheel visual posture recognition according to claim 1, characterized in that: In the step 2, the method of extracting the target contour by clustering is: given a distance threshold D1, traversing all contours, and clustering the contours with a minimum distance between contours less than D1 into one category; among the clustered contours, filtering out the target contour according to the conditions that the contour area is the largest and the contour center coordinates are closest to the image center.
5. The method for extracting wheel hub profile in wheel visual posture recognition according to claim 1, characterized in that: In step 3, the method steps of extracting data points from the target contour using the Graham scanning method are as follows: 31) Find the point with the lowest y coordinate in P. If the y coordinates are the same, select the point with the smallest x coordinate and record it as anchor point P0; where P is the set of all data points to be processed in the target contour; 32) Calculate each point P i (x i ,y i ) and P0(x0,y0): θ n =here2(y i -y0,x i −x0) 33) Sort the points from small to large polar angles. If the polar angles are the same, only keep the point farthest from the anchor point. 34) Initialize an empty stack S, push P0 and the first point P1 after polar angle sorting into the stack; 35) Starting from the second point P2, process each point P in turn i ; The first and second points on the top of the stack are called P top1 and P top2 , check P top1 and P top2 With the current point P i The relative position of , calculate the cross product: (P top1 -P top2 )×(P i -P top2 )=(P top1 .x-P top2 .x)×(P i .y-P top2 .y)-(P top1 .y-P top2 .y)×(P i .x-P top2 .x) 36) Determine whether the cross product is greater than 0: If so, it means that from P top2 To P top1 To P i The order is counterclockwise, data point P i Directly into the stack; if not, it means from P top2 To P top1 To P i If the order is clockwise or the three points are collinear, then P is popped out first. top1 , continue checking until the counterclockwise condition that the cross product is greater than 0 is met, and then P i Push to stack; 37) Rotate and execute step 35) to step 36) until all points are processed, and the remaining data points in the stack are the external point set of the extracted target contour.
6. The wheel hub contour extraction method in wheel visual posture recognition according to claim 1 is characterized by: In step 5, the method of fitting the target ellipse using the least squares method improved based on RANSAC is: The general equation of an ellipse is: x 2 +Axy+By 2 +Cx+Dy+E=0 Among them: A, B, C, D and E are coefficients to be solved; and: in: Where: N is the number of data points in the subset.
7. The method for extracting wheel hub profile in wheel visual posture recognition according to claim 1, characterized in that: In step 6, the distance from the data point to the fitted target ellipse is calculated as follows: Where: d i is the data point P i (x i ,y i ) to the target ellipse.
8. The wheel hub contour extraction method in wheel visual posture recognition according to claim 1, characterized in that: In step eight, the maximum number of iterations K is: Where: z represents the expected success probability; N is the number of sample points for fitting the ellipse model.
Citation Information
Patent Citations
Video multi-vehicle outline detection method
CN102799857A
Optimal external ellipse extraction method for irregular small body navigation centroid
CN109238268A
Vehicle-mounted wheel steering angle measuring method based on image processing
CN116793262A
Mushroom cluster contour segmentation and reconstruction method based on improved solov2
WO2024077979A1
Cited By
Appearance contour extraction method for automobile part machining
CN120219771A