Harmonic reducer elliptical cam image detection method, system, device and medium
By using the adaptive threshold Canny operator and arc segment geometric constraints to filter arc segments, and combining this with a multi-parameter optimization algorithm for accurate fitting, the high-precision problem of elliptical cam detection in harmonic reducers was solved, achieving efficient and accurate ellipse detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WENZHOU UNIV
- Filing Date
- 2026-04-22
- Publication Date
- 2026-07-24
AI Technical Summary
Existing ellipse detection methods are insufficient to meet the high-precision requirements of elliptical cam detection in harmonic reducers, especially in cases of missing local contours and noise interference, where detection accuracy and efficiency are inadequate.
Edge features are extracted using the adaptive threshold Canny operator. A new method for calculating the positive and negative values of arc endpoints and geometric constraints are used to filter arc segments. A multi-parameter optimization algorithm is combined for accurate fitting. Ellipse fraction and reliability analysis are used to remove pseudo-ellipses and duplicate ellipses, resulting in high-precision ellipse detection.
This improves the accuracy and efficiency of ellipse detection, meeting the high-precision requirements of elliptical cam detection in harmonic reducers, and providing assurance for subsequent operational stability and service life prediction.
Smart Images

Figure CN122066710B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition, specifically relating to a method, system, device, and medium for detecting images of elliptical cams in harmonic reducers. Background Technology
[0002] Elliptical objects are very common in both daily life and industrial inspection. Therefore, ellipse detection has wide applications in image processing. In high-precision transmission devices such as harmonic reducers, using image detection technology to perform high-precision automated detection and feedback on the contour accuracy, surface defects, and installation posture of the core component—the elliptical cam—is a crucial step in ensuring its transmission accuracy, operational stability, and overall service life. However, many external factors can affect the detection results of the elliptical cam in harmonic reducers, and currently, there is no efficient, stable, and accurate detection algorithm to universally solve the aforementioned ellipse detection problem.
[0003] The mainstream ellipse detection methods, including the least squares fitting method, are based on the idea of defining a minimum problem using the algebraic equation of a quadratic curve, and then adding appropriate numerical analysis to ensure that the value obtained through numerical constraints conforms to the characteristics of the elliptic curve. However, in practical applications, the least squares fitting method is susceptible to outlier interference, and when there are local contour gaps, the results may produce significant deviations.
[0004] To address the issue of missing local contours in elliptical images, existing technologies employ edge-tracking-based methods to identify and fit elliptical edges. Specifically, edge detection yields a binary edge map of the image, which is then used to filter and group edges based on the geometric properties of the ellipse, leading to ellipse fitting. Alternatively, based on the geometric relationship between the ellipse chord and its center, a method is proposed to estimate the ellipse by decomposing the parameter space, further refining the edge grouping strategy to improve detection accuracy. Line pruning strategies are introduced to remove invalid candidates, further enhancing detection reliability. Distance constraints are added to the arc grouping step to improve candidate group results. However, these methods are primarily concerned with the number of detected ellipses, making it difficult to meet the high-precision requirements of elliptical cam detection in harmonic reducers. Summary of the Invention
[0005] To address the problem that existing elliptical image recognition methods cannot meet the high-precision requirements for elliptical cam detection in harmonic reducers, this invention provides a method, system, device, and medium for elliptical cam image detection in harmonic reducers.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A method for detecting elliptical cam images in harmonic reducers, including: Acquire an image of the harmonic reducer to be identified; Edge extraction is performed on the image of the harmonic reducer to be identified to obtain multiple arc segments; Determine the minimum bounding rectangle of multiple arc segments and calculate the aspect ratio of the minimum bounding rectangle. When the aspect ratio of the minimum bounding rectangle is greater than the preset aspect ratio threshold, the arc segment corresponding to the minimum bounding rectangle is taken as the arc segment to be classified. The arc segments to be classified are classified according to their positive or negative polarity to obtain positive or negative polarity classification results, and according to their concavity or convexity to obtain concavity or convexity classification results. Through pre-set geometric constraints, the quadruplet arc segments are filtered based on pre-set elliptical geometric constraints to obtain candidate elliptical quadruplet arc segments. The quadruplet arc segments are obtained by combining arc segments with different four types of arc segment classification results. The four types of arc segment classification results are determined based on the positive or negative polarity classification results and the concavity or convexity classification results. The parameters of the candidate ellipse quadruples arc segments are fitted to obtain the elliptical cam fitted image of the image of the harmonic reducer to be identified.
[0007] This invention also provides an elliptical cam image detection system for harmonic reducers, comprising: The image acquisition module is used to acquire images of the harmonic reducer to be identified. The edge extraction module is used to extract the edges of the image of the harmonic reducer to be identified, and obtain multiple arc segments; The arc segment filtering module is used to determine the minimum bounding rectangle of multiple arc segments and calculate the aspect ratio of the minimum bounding rectangle. When the aspect ratio of the minimum bounding rectangle is greater than the preset aspect ratio threshold, the arc segment corresponding to the minimum bounding rectangle is regarded as the arc segment to be classified. The classification and combination module is used to classify arc segments according to their positive or negative polarity, obtaining positive or negative polarity classification results, and to classify arc segments according to their concavity or convexity, obtaining concavity or convexity classification results. Through pre-set geometric constraints, the module filters quadruple arc segments based on pre-set elliptical geometric constraints, obtaining candidate elliptical quadruple arc segments. Each quadruple arc segment is obtained by combining arc segments with four different classification results, and these four classification results are determined based on both the positive / negative polarity classification results and the concavity / convexity classification results. The parameter fitting module is used to perform parameter fitting on the arc segments of the candidate ellipse quadruples to obtain the elliptical cam fitting image of the image of the harmonic reducer to be identified.
[0008] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any of the steps in the harmonic reducer elliptical cam image detection method.
[0009] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can execute any of the steps in the harmonic reducer elliptical cam image detection method.
[0010] The method for detecting elliptical cam images of harmonic reducers provided by this invention has the following beneficial effects: Because the elliptical cam image detection method for harmonic reducers provided by this invention filters arc segments by calculating the circumscribed rectangle of the arc segments and imposes geometric constraints on the results of the arc segment combinations, it reduces the number of fitted ellipses, lowers the computational load, and ensures the accuracy of ellipse detection. Compared with the existing method of counting the number of ellipses, it focuses more on the high-precision identification and detection of a small number of ellipses in the image, and can fully identify elliptical cams in the image of harmonic reducers, meeting the high-precision requirements of elliptical cam detection. This provides a basic guarantee for subsequent prediction of the smooth operation of harmonic reducers and the service life of the entire machine based on the cam detection results. Attached Figure Description
[0011] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is one of the schematic diagrams of the elliptical cam image detection method for harmonic reducers provided in an embodiment of the present invention; Figure 2 This is one of the schematic diagrams of the arc aspect ratio provided in the embodiments of the present invention; Figure 3 This is a second schematic diagram of the arc aspect ratio provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the arc segment quadrant distribution provided in an embodiment of the present invention; Figure 5 One of the schematic diagrams of the curvature of the endpoints of an arc segment provided in an embodiment of the present invention; Figure 6 A second schematic diagram of the curvature of the endpoints of an arc segment provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the arc concavity and convexity provided in an embodiment of the present invention; Figure 8 The curve showing the influence of the edge point count threshold on the F value provided in this embodiment of the invention; Figure 9 This is a graph showing the impact of the edge point threshold on runtime in an embodiment of the present invention. Figure 10 A graph showing the effect of the aspect ratio threshold on the F value provided in an embodiment of the present invention; Figure 11 A graph showing the effect of aspect ratio threshold on runtime provided in an embodiment of the present invention; Figure 12 This is a graph showing the influence of the tangent angle threshold on the F value provided in an embodiment of the present invention. Figure 13 This is a graph showing the effect of the tangent angle threshold on runtime provided in an embodiment of the present invention. Figure 14 This is a graph showing the effect of the elliptic fraction threshold on the F value, provided in an embodiment of the present invention. Figure 15 The curve showing the effect of the elliptic fraction threshold on running time provided in this embodiment of the invention; Figure 16 A graph showing the influence of the reliability threshold on the F-value provided in this embodiment of the invention; Figure 17 A graph showing the impact of reliability thresholds on runtime provided in this embodiment of the invention; Figure 18 A visual comparison diagram of representative scenarios provided for embodiments of the present invention. Detailed Implementation
[0013] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0014] The elliptical cam image detection method for harmonic reducers provided by this invention uses an adaptive threshold Canny operator to extract multi-scale edge features, employs a new method for calculating the positive and negative values of arc endpoints to perform preliminary screening of arc segments, classifies arc segments using their geometric characteristics, filters out non-elliptical contours, and enhances the selection specificity by combining three constraints on arc segments for verification. Then, a multi-parameter optimization algorithm is used to achieve accurate fitting, and finally, clustering and ellipse fraction methods are used to verify candidate ellipses, removing fitted false ellipses and duplicate ellipses to obtain the final ellipse. This method can balance the accuracy and efficiency of ellipse detection.
[0015] To better group ellipse edges, this invention proposes a novel method for calculating arc segment endpoints. By adding pixel neighborhoods to the arc segment endpoints and calculating the average gradient vector of all pixels within the neighborhood, the accuracy of endpoint calculation is significantly improved, increasing the speed of ellipse edge screening and shortening the detection time. Furthermore, considering the need for rapid detection of candidate arc segments belonging to the same ellipse, the multi-level screening strategy based on ellipse geometric characteristics effectively identifies candidate arc segments from the ellipse edges, removing irrelevant arc segments that do not meet the criteria, greatly reducing the number of ellipse arc segments to be fitted subsequently and lowering the computational load. In addition, to remove pseudo-ellipses and duplicate ellipses, the candidate ellipse evaluation method used in this invention combines ellipse score and ellipse reliability analysis to remove low-quality ellipses. Clustering of candidate ellipses, combined with whether the ellipse centers coincide, the difference in semi-axis, and the difference in rotation angle, removes duplicate ellipses, thereby achieving a redundancy removal process.
[0016] Example 1 This invention provides a method for detecting elliptical cam images of harmonic reducers, specifically as follows: Figure 1 As shown, it includes the following steps: Step 11: Obtain the image of the harmonic reducer to be identified; Step 12: Extract the edges of the image of the harmonic reducer to be identified to obtain multiple arc segments; Step 13: Determine the minimum bounding rectangle of multiple arc segments and calculate the aspect ratio of the minimum bounding rectangle. When the aspect ratio of the minimum bounding rectangle is greater than the preset aspect ratio threshold, the arc segment corresponding to the minimum bounding rectangle is taken as the arc segment to be classified. Step 14: Classify the arc segments to be classified according to their positive or negative polarity to obtain the positive or negative polarity classification result; classify the arc segments to be classified according to their concavity or convexity to obtain the concavity or convexity classification result; filter the quadruple arc segments based on the pre-set geometric constraints of the ellipse to obtain candidate elliptical quadruple arc segments. The quadruple arc segments are obtained by combining arc segments with different four types of arc segment classification results. The four types of arc segment classification results are determined based on the positive or negative polarity classification result and the concavity or convexity classification result. Step 15: Perform parameter fitting on the candidate ellipse quadruples arc segments to obtain the elliptical cam fitting image of the harmonic reducer image to be identified.
[0017] Specifically, the harmonic reducer elliptical cam image detection method provided by this invention, after acquiring the image of the harmonic reducer to be identified, first uses the Canny edge detection algorithm with adaptive thresholding to extract edges from the image of the harmonic reducer to be identified. For example, edge pixels are obtained through the Canny edge detector. In the 8-neighborhood of the edge pixel, the edge points in the image are traversed clockwise from top to bottom and from left to right, and these edge points are connected to form multiple arc segments.
[0018] After generating a large number of arc segments using the Canny edge detector, a boundary rectangle filtering method is used to remove straight lines and short arc segments caused by noise and invalid information. This involves calculating the minimum bounding rectangle (MBR) for each edge and, utilizing the geometric features of the rectangle, introducing an invalid arc segment removal method based on the rectangle's aspect ratio. Figure 2 and Figure 3 As shown in the schematic diagram of the arc aspect ratio, in Figure 2 Multiple arc segments were intercepted, according to Figure 3 The rectangle in the image selects each arc segment. The midpoints A, B, C, and D of the rectangle are the four vertices of the arc boundary rectangle, where A and B are the two endpoints of the arc segment. The distance between the long side AB and the short side BC is shown in formulas (1) and (2). (1) (2) in It is the first The coordinates of the edge points, and the length and width of the rectangle are shown in formula (3): (3) Where R is the ratio of the longer side AB to the shorter side BC of the arc segment rectangle. When the aspect ratio R of the arc segment rectangle is less than a threshold value... When this happens, the arc segment is removed and identified as an invalid edge, and it will not participate in the subsequent fitting process. By using this screening method to remove edge segments that do not conform to the geometric characteristics of an ellipse, the remaining arc segments are regarded as arc segments to be classified that can be fitted into an ellipse.
[0019] Subsequently, the arc segments to be classified are classified according to their positive or negative sign and their concavity or convexity, into four categories: I, II, III, and IV, as shown in formula (4): (4) in, For any arc segment detected in the image, The function describing the sign of the arc segment. For describing the concavity and convexity of an arc segment, such as Figure 4 As shown, For arc segments located in the first quadrant to , For the arc segment located in the second quadrant to , For the arc segment located in the third quadrant to , For the arc segment located in the fourth quadrant to .
[0020] Based on this, if an ellipse is complete, it should contain arc segments of four categories: I, II, III, and IV, with only one arc segment of each category. Combining arc segments from the four categories yields candidate ellipse quadruples. Parameter calculation and ellipse fitting are then performed to obtain the detection results of the elliptical cam in the harmonic reducer image.
[0021] Because the elliptical cam image detection method for harmonic reducers provided by this invention filters arc segments by calculating the circumscribed rectangle of the arc segments and applies geometric constraints to the results after combining the arc segments, it reduces the number of fitted ellipses, lowers the computational load, and ensures the accuracy of ellipse detection. Compared with the existing method of counting the number of ellipses, it focuses more on the high-precision identification and detection of a small number of ellipses in the image, and can fully identify elliptical cams in the image of harmonic reducers, meeting the high-precision requirements of elliptical cam detection. This provides a basic guarantee for subsequent prediction of the smooth operation of harmonic reducers and the service life of the entire machine based on the cam detection results.
[0022] Furthermore, the elliptical cam image detection method for harmonic reducers provided by this invention can remove the influence of a large amount of noise and invalid information by calculating the minimum bounding rectangle of each edge, thereby generating straight lines and short arcs. This avoids these invalid edges from participating in the fitting, which would waste time and severely reduce the accuracy of the elliptical detection algorithm, thus ensuring the efficiency and accuracy of elliptical cam image detection.
[0023] Based on the above embodiments, in the harmonic reducer elliptical cam image detection method provided by the present invention, step 14 includes: Step 141: Set pixel neighborhoods at the left and right endpoints of the arc segment to be classified, respectively; Step 142: Calculate the average gradient vector based on the edge pixels in the pixel neighborhood of the left endpoint and the pixel neighborhood of the right endpoint to obtain the direction of the left endpoint and the direction of the right endpoint of the arc. Step 143: Determine the positive / negative classification result of the arc segment based on the product of the left endpoint direction and the right endpoint direction of the arc segment, wherein the positive / negative nature of the arc segment is consistent with the positive / negative nature of the product.
[0024] Specifically, in the elliptical cam image detection method for harmonic reducers provided by this invention, after filtering the arc segments to be classified based on the minimum bounding rectangle of each edge, the positive and negative properties and the concavity and convexity of the arc segments can be classified in the following way: When edge points are obtained through Canny edge detection coordinates Then, calculate the slope at that point, as shown in formula (5): (5) in, These are the gradients in the x and y directions, respectively. The slope of that edge point. The angle between the positive horizontal direction of the edge point and the tangent is given by the given angle. Figure 5 and Figure 6 As shown, where, Figure 5 This diagram illustrates the confirmation of angles and curvatures at the endpoints of a continuous curve. Figure 6 This is a schematic diagram for confirming the angle and curvature at the endpoints of a single curve. When the slope value of the edge point is 0, the edge point is discarded.
[0025] Considering the possibility of noise affecting the edges of arc segments in an image, this invention introduces neighborhood direction estimation at the endpoints of the arc segments, using statistical methods to ensure the stability and robustness of the arc segment positive / negative determination. This applies to the left and right endpoints of the arc segment. and A small pixel neighborhood is set around each of them, for example, a K×K region centered at the two endpoints, such as a 3×3 region or a 5×5 region. The average gradient vector is calculated for all edge pixels or non-zero gradient pixels in this neighborhood, as shown in formula (6): (6) in, As endpoints The set of all pixels or edge pixels within the neighborhood. and These are the gradient values in the x and y directions at that pixel, respectively. The direction is the overall direction of the endpoint, and the calculation process is shown in formula (7): (7) in, Used to ensure direction is Within the range.
[0026] Let the direction of the left endpoint of the arc segment be denoted as The right endpoint is denoted as Based on the relationship between the two, establish Let be the product of the two values. When the product of the two values is positive, denote . For positive, conversely, record. The value is negative. When a segment to be classified is identified, the positive or negative value of the current segment is determined by calculating the directions of the two endpoints of the segment. That is, the segment can be divided into positive and negative categories based on the positive or negative value of the product of the directions at both ends of the segment, and the segment can be divided into positive and negative categories based on the positive or negative value of the slope of the endpoints of the segment, as shown in formula (8): (8) Based on the above formula, the arc segments to be classified are divided into positive and negative categories, and arc segments of the same category are grouped together, as shown in formula (9): (9) in, This is used to describe the positive or negative nature of the arc segment. Further classification is then performed based on the concavity or convexity of the arc segment to be classified. Based on the location of the left and right endpoints of each arc segment, the left and right endpoints of each arc segment are obtained. and The coordinates of the two endpoints of the arc segment. and Connect them to form a straight line. Based on the coordinates of the two endpoints of the arc segment, the standard straight line equation of the baseline can be derived as shown in formula (10): (10) in, And based on the two endpoints of the arc segment. and It can calculate the midpoint of an arc segment. The coordinates are shown in formula (11): (11) For example, the concavity and convexity of an arc segment, such as Figure 7 As shown, calculate the midpoint using the formula for the distance from a point to a line. The perpendicular distance d from the midpoint N of the baseline is such that when the midpoint N is above point M (i.e., d > 0), the midpoint is above the baseline and the arc segment is convex. When the midpoint N is below point M (i.e., d < 0), the midpoint is below the baseline and the arc segment is concave. The concavity and convexity of the arc segment are described by formula (12): (12) Based on formulas (12) and (9), the arc segments to be classified can be divided into four categories: I, II, III and IV, as shown in formula (4).
[0027] Because the image detection method for elliptical cams of harmonic reducers provided by this invention can take into account the possibility that the edge of the arc segment is greatly affected by noise in the image, and the edge detection accuracy is low, the extraction of the arc segment endpoints has a deviation. Compared with the method of directly calculating the slope of the left and right endpoints of the arc segment based on the formula (5), it avoids the problem that the gradient information at the endpoints is prone to instantaneous fluctuation or error, which affects the judgment standard of the positive and negative of the arc segment, thus affecting the subsequent grouping and combination. It also avoids the problem that the slope value is equal to zero or does not exist, ensuring the accuracy of the subsequent candidate elliptical quadruple arc segment combination, and thus ensuring the detection accuracy of the elliptical cam.
[0028] Based on the above embodiments, the geometric constraints of the ellipse include adjacency constraints, coordinate constraints, and tangent continuity constraints. In the elliptical cam image detection method for harmonic reducers provided by the present invention, step 14 further includes: Step 144: Combine arc segments according to the positive / negative classification results and the concavity / convexity classification results to obtain quadruple arc segments; Step 145: Verify the elliptical topological properties of the quadruplet arc segments through adjacent constraint conditions to obtain the quadruplet arc segments after adjacent constraints. Step 146: Verify the spatial position rationality of adjacent constrained quadruple arc segments using coordinate constraints to obtain the coordinate-constrained quadruple arc segments. Step 147: Calculate the endpoint tangent direction of the quadruplet arc segment after coordinate constraint, and verify the tangent angle through tangent continuity constraint to obtain the candidate elliptical quadruplet arc segment.
[0029] Specifically, in the elliptical cam image detection method for harmonic reducers provided by this invention, geometric constraints such as attribute constraints, polarity constraints, and tangent continuity constraints can be introduced to ensure that the fitted quadruplet arc segments belong to the same ellipse.
[0030] Firstly, considering the geometric structure of an ellipse, adjacent arc segments need to have a certain continuity and reasonable connection relationship. Since each arc segment in the candidate arc segments is located in a different category after classification, and any two adjacent arc segments must be in adjacent quadrants, an adjacency constraint condition is introduced to verify whether the relative position between the arc segments conforms to the topological characteristics of the ellipse. The adjacency constraint rule is shown in formula (13): (13) in, and This represents any two adjacent arc segments in a single quadrant; I, II, III, and IV are the four quadrants in the arc segment classification. After satisfying the adjacency constraint, considering that the four arc segments must satisfy a specific relative positional relationship to form an ellipse, a coordinate constraint validity marker is introduced to determine whether the spatial positions of the four arc segments are reasonable, as shown in formula (14): (14) in, Mark the validity of coordinate constraints. The x-coordinate represents the leftmost extreme value of the arc segment of type I, and The y-coordinate represents the rightmost extreme value of the arc segment of type II. The extreme value coordinates of the endpoints of the other arc segments are as follows: Figure 3 As shown, the present invention will not be described in detail.
[0031] Furthermore, considering that an ellipse is a smooth and closed geometric curve, the tangent direction at any point has strict continuity. That is, when any two arc segments are selected on the same ellipse and connected at their endpoints, the tangent direction should not change significantly. This continuity of tangent direction is an important manifestation of the geometric characteristics of an ellipse. If the tangent direction of adjacent arc segments changes abruptly at the connection point, it indicates a lack of smooth transition, and such a combination of arc segments may not belong to the same ellipse. Therefore, this invention also uses the tangent continuity constraint to filter out arc segment groups that do not conform to the geometric characteristics of an ellipse.
[0032] For example, first, determine the endpoints on both sides of each arc segment, and then obtain the tangent directions at the endpoints of the arc segment through geometric calculations. To simplify the process, the angle between the tangent direction at the endpoint and the positive x-axis can be used as the metric. For each pair of adjacent arc segments in the quadruple, let their tangent vectors at the common connection point be denoted as follows: and The angle between the tangent directions is shown in formula (15): (15) in, Represents the vector dot product. and Let these represent the magnitudes of the two vectors, respectively. To ensure the smoothness of the tangent direction of the arc segment, a reasonable threshold needs to be set. This is usually a small angle. If the angle between the tangent directions of adjacent arc segments at the connection point satisfies... ≤ If the tangents between them are considered to be continuous and conform to the geometric characteristics of an ellipse, then they should be excluded from the candidate combinations of the same ellipse.
[0033] Because the elliptical cam image detection method for harmonic reducers provided by this invention takes into account the fact that without any restrictions, four different types of arc segments can be arbitrarily selected and combined, resulting in a large number of candidate arc segments, most of which are invalid, affecting the image detection efficiency. By using geometric constraints such as adjacent constraints, coordinate constraints, and tangent continuity constraints to filter out incorrectly spliced arc segment combinations, the accuracy and robustness of ellipse recognition and fitting are effectively eliminated.
[0034] Based on the above embodiments, the method for detecting elliptical cam images of harmonic reducers provided by the present invention further includes the following step before step 13: Step 16: Calculate the number of edge points for multiple arc segments, and select the arc segments with a number of edge points greater than the preset edge point threshold as the preliminary filtered arc segments.
[0035] Specifically, in the elliptical cam image detection method for harmonic reducers provided by this invention, before performing edge segment filtering based on the minimum bounding rectangle, a threshold is also set. This method limits the number of edge points for each arc segment, thus reducing the number of edge points to less than [a certain number]. The arc segments are removed directly.
[0036] Since the present invention takes into account that the 8-neighborhood connection step based on the Canny edge detection algorithm will generate a large number of arc segments, and that these are mostly straight lines and short arc segments rather than elliptical edges due to noise and invalid information, the edge points are first screened out by the number of edge points before the minimum bounding rectangle calculation, which further reduces the computational load of the image detection method and improves the image detection efficiency of the elliptical cam of the harmonic reducer.
[0037] Based on the above embodiments, the method for detecting elliptical cam images of harmonic reducers provided by the present invention further includes the following step before step 12: Step 17: Convert the image of the harmonic reducer to grayscale to obtain a grayscale image; Step 18: Perform Gaussian filtering on the grayscale image to remove noise and obtain a smoothed image; Step 19: Sharpen the edges of the smoothed image to obtain the pre-processed image of the harmonic reducer to be identified.
[0038] Specifically, in the image detection method for the elliptical cam of the harmonic reducer provided by this invention, after acquiring the image of the harmonic reducer to be identified, the image is first converted to grayscale and denoised using Gaussian filtering to convert the RGB color image into a grayscale image. For example, the input RGB color image is converted to a grayscale image to reduce the data dimension, retain only the brightness information, and remove the color influence. Grayscale conversion is performed using a weighted summation method. Subsequently, considering the need to suppress noise, Gaussian filtering is used to smooth the grayscale image. Gaussian filtering is a low-pass filter that can effectively smooth the image while preserving edge features as much as possible. The filter function is shown in formula (16): (16) In this embodiment, the standard deviation parameter of the Gaussian filter is set to 2 to achieve a balance between noise reduction and detail preservation. Furthermore, considering that some edges may be over-smoothed during the filtering process, leading to the omission of certain edge information during detection, the image is also sharpened to enhance edge features, resulting in a more accurate edge map with higher detail preservation for subsequent arc extraction.
[0039] The elliptical cam image detection method for harmonic reducers provided in this invention takes into account the large amount of complex information contained in the images captured by the camera. It removes noise from the image through image preprocessing such as grayscale conversion and Gaussian filtering, thereby highlighting the target features of the image and improving the accuracy and stability of edge detection, thus providing a series of assistance for subsequent arc selection. Furthermore, by sharpening to highlight edge features, the completeness of edge detection can be effectively improved, obtaining more valuable information. An adaptive method is used to dynamically determine the high and low thresholds for edge detection, which can adaptively adjust the thresholds according to local image features, resulting in a more accurate edge map with higher detail preservation.
[0040] Based on the above embodiments, in the harmonic reducer elliptical cam image detection method provided by the present invention, step 15 includes: Step 151: Calculate the arc segments of the candidate ellipse quadruples using the least squares method to obtain the ellipse center, ellipse tilt angle, and ellipse semi-axis length; Step 152: Obtain the ellipse parameter fitting results based on the ellipse center, ellipse tilt angle, and ellipse semi-axis length; Step 153: Determine the elliptical cam fitting image based on the ellipse parameter fitting results.
[0041] Specifically, in the elliptical cam image detection method for harmonic reducers provided by this invention, after coordinate constraints, adjacency constraints, and tangent continuity constraints, a large number of invalid arc segment quadruples are removed from the candidate ellipse quadruples. To avoid fitting these meaningless combinations, an algebraic least squares method is used for parameter fitting, for example, to estimate the five parameters of the ellipse, including the ellipse center. The five parameters are: ellipse tilt angle θ, semi-axis length a, and semi-axis length b. The fitted ellipse candidate group is obtained as the ellipse parameter fitting result based on the five parameters obtained.
[0042] Based on the above embodiments, the method for detecting elliptical cam images of harmonic reducers provided by the present invention further includes the following step before step 153: Step 154: Calculate the ellipse fraction based on the ellipse parameter fitting results; Step 155: When the calculated elliptic fraction is greater than the preset elliptic fraction threshold, perform elliptic reliability calculation; Step 156: When the ellipse reliability calculation result is greater than the preset ellipse reliability threshold, perform similarity calculation based on the ellipse center, ellipse tilt angle and ellipse semi-axis length corresponding to the fitting results of multiple ellipse parameters respectively. Based on the similarity calculation results, cluster the fitting results of multiple ellipse parameters to obtain the filtered ellipse parameter fitting results.
[0043] Specifically, in the elliptical cam image detection method for harmonic reducers provided by the present invention, low-quality candidate ellipses are removed through a verification step, and ellipses that may belong to the same target object are clustered through a clustering step to exclude similar duplicate candidate ellipses.
[0044] For example, firstly, the ellipse score index is calculated based on the fitting results of the ellipse parameters, and then the fitting level of the candidate ellipse generated by the arc segment quadruples is evaluated. The general ellipse equation of the candidate ellipse is shown in equation (17): (17) When edge pixels If it lies on the ellipse, then it should satisfy the following condition: At this point, the ratio of the number of edge pixels in the arc segment quadruple that satisfies the above ellipse equation or the number of edge pixels in the arc segment quadruple that fall on the candidate ellipse to the total number of edge pixels in the quadruple is defined as the ellipse fraction, as shown in formula (18): (18) in, For elliptic fractions, This represents the number of pixels in the arc segment quadruple that actually satisfy the equation of the ellipse; These represent the number of edge pixels of the four types of arc segments in the arc segment quadruple, and .when A higher numerical value indicates a better fit between the candidate ellipse and the arc segment quadruple. Set an ellipse fraction threshold. When the candidate ellipse If the result is satisfactory, it is considered a valid candidate ellipse and moved to the next evaluation metric. Otherwise, it is judged as a misfitted ellipse and removed.
[0045] The reliability of the candidate ellipse is then further evaluated using reliability metrics. The center of the fitted ellipse is taken as the origin of the new coordinate system, the major axis of the ellipse is taken as the x-axis, and the minor axis as the y-axis. Let a point in the original coordinate system... After the following translation and rotation, the coordinate system is transformed to the new coordinate system. In the middle, as shown in formulas (19) and (20): (19) (20) make and They represent the k-th type of arc segments in the quadruple. After mapping the two endpoints or extreme points in the original coordinate system to the new coordinate system using formula (20), we obtain... and The projection lengths of the Kth type arc segment on the major axis of the ellipse and the projection lengths of the kth type arc segment on the minor axis of the ellipse in the quaternion are calculated as shown in formula (21): (twenty one) in, is the projection length of the Kth type arc segment in the quadruple group onto the major axis of the ellipse; Let be the projection length of the k-th arc segment in the quaternion onto the minor axis of the ellipse. Similarly, calculate the projection lengths of the arc segments of types II, III, and IV in the quaternion onto the major and minor axes of the ellipse, respectively. Sum the projection lengths corresponding to all arc segments in each quaternion as the numerator, and use four times the sum of the major and minor semi-axes as the denominator. Determine the reliability score based on the ratio, as shown in formula (22): (twenty two) in, For reliability score, ,like The larger the value, the higher the reliability of the candidate ellipse fitted by the arc segment quadruples. Similarly, a reliability threshold is set. When the candidate ellipse > If the ellipse has a high geometric coverage of the arc segment quadruples and good overall consistency, it is considered a reliable candidate ellipse; otherwise, it is considered an unreliable false ellipse and removed.
[0046] Finally, similar duplicate candidate ellipses that may belong to the same object are clustered, and the cluster centers are used as the final detection results. The criterion for whether two ellipses belong to the same cluster is the similarity of five parameters of the ellipses. For example, when two ellipses belong to the same cluster, the following condition is met: Let the lengths of the major axes of the two ellipses be... and The longer major axis length is denoted as Calculate the length difference between the two major axes. Then it must meet the following conditions. Let the lengths of the minor axes of the two ellipses be... and The shorter minor axis length is denoted as Calculate the length difference between the two minor axes. Then the difference in minor axis length must meet the following condition. Let the coordinates of the centers of the two ellipses be respectively... and The distance between the centers of the two ellipses must satisfy the following condition: Let the rotation angles of the two ellipses be respectively... and The difference in rotation angle between the two ellipses must satisfy the following conditions: Once clustering is complete, cam detection results for the image of the harmonic reducer to be identified are generated based on the ellipse parameter fitting results.
[0047] The elliptical cam image detection method for harmonic reducers provided by this invention can effectively remove low-quality candidate ellipses. For example, it removes candidate ellipses with invalid fitting levels or misfitted candidate ellipses through ellipse score index, and removes false candidate ellipses with low overall consistency and unreliability through reliability index, thus ensuring the recognition accuracy of elliptical cams. Furthermore, considering that the breakage of the elliptical contour may lead to multiple detections on the same ellipse, it clusters similar repeated candidate ellipses that may belong to the same object through ellipse parameter similarity, further reducing the number of elliptical images to be recognized in the harmonic reducer image and improving the recognition accuracy of elliptical cams.
[0048] Example 2 Building upon Example 1, this invention also provides a specific example of ellipse image detection for the publicly available datasets Prasad, Occluded Ellipse, and Overlap Ellipses. All ellipse image detection was performed on a 64-bit computer with an Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, 16GB RAM, Windows 10 operating system, and Matlab 2024a compiled software.
[0049] The Prasad dataset consists of 198 real-world images. The ellipses in these images are typically affected by complex backgrounds, lighting variations, and noise interference, making the detection task highly challenging. Of particular note is the large number of small ellipses, such as those with a semi-major axis length of less than 20 pixels, which further tests the robustness of the detection algorithm in handling incomplete edges and noise interference. The Occluded Ellipses dataset consists of 300 images of occluded ellipses, primarily used to examine the robustness and accuracy of ellipse detection algorithms in handling occlusion and incomplete edges. The images in this dataset have a resolution of 300×300, and the discontinuous or incomplete ellipse boundaries increase the detection difficulty. Therefore, this dataset provides strong support for validating the algorithm's generalization ability under conditions of occlusion and noise. The Overlap Ellipses dataset contains 300 images of overlapping elliptical objects, used to evaluate the performance of ellipse detection algorithms in handling cases of partial occlusion of ellipses, edge intersections, and complex layouts. Because ellipses often overlap in the dataset, resulting in boundary blending and contour discontinuities, this poses a significant challenge to the algorithm's segmentation, matching, and accurate fitting.
[0050] The evaluation metrics among different elliptic image detection methods include precision, recall, and F-metric, which are calculated as shown in formula (23): (twenty three) Considering that the elliptical cam image detection method for harmonic reducers provided by this invention contains variable parameters in each screening step, the parameters... and tangent continuity threshold Key parameters such as these affect the algorithm's selection process for arcs and ellipses. Based on three datasets, the value range of one parameter was changed for each dataset, and the impact on the algorithm's F-metric and running time (T) was observed, while the remaining parameters remained at their default or optimal configurations.
[0051] when The mean values of F and T for the elliptical cam image detection method of harmonic reducer with different values are shown in the test set. Figure 8 and Figure 9 As shown, where, Figure 8 Threshold for edge points A dotted line graph of edge point threshold and F-measure, where the dashed line composed of points and boxes represents the data set Prasad. The solid line represents the variation in the F-value when using the Occluded Ellipse dataset. The dashed line composed of line segments and triangles represents the fluctuation of the F-value when using the Overlap Ellipses dataset. With the fluctuation of the F value; Figure 9 Threshold for edge points A dotted line graph of edge point threshold versus time T (Time), where the dashed line composed of points and boxes represents the time when using the Prasad dataset. The variation with T, the solid line represents the variation when using the Occluded Ellipse dataset. The fluctuations in T are represented by the dashed line composed of line segments and triangles when using the Overlap Ellipses dataset. The fluctuation of T. Combining the results from the three datasets, it can be determined that when... When the value is 16, most of the retained arc segments are real and valid arc segments, significantly improving detection performance, and in The peak value was reached at 16. As the threshold gradually increases, the overall running time of the detection algorithm shows a significant decreasing trend. This is due to the larger... This allows the system to filter out more arc segments with fewer edge points, thus reducing the number of candidate ellipses participating in subsequent fitting and validation. This not only reduces the proportion of invalid computations but also significantly alleviates the computational burden on the algorithm during the fitting and post-processing stages. Therefore, the reduction in computation directly leads to an improvement in detection efficiency. A score of around 16 can achieve a relatively balanced accuracy and speed.
[0052] Side length ratio threshold This value is used to measure the curvature of an arc segment; the smaller the value, the flatter the arc segment that can be retained, and the smaller the curvature. Figure 10 Side length ratio threshold A dotted line graph of the Aspect ratio threshold and the F-measure. The dashed line, composed of dots and boxes, represents the values when using the Prasad dataset. The solid line represents the variation in the F-value when using the Occluded Ellipse dataset. The dashed line composed of line segments and triangles represents the fluctuation of the F-value when using the Overlap Ellipses dataset. With the fluctuation of the F value; Figure 11 Side length ratio threshold A dotted line graph of (Aspect ratio threshold) versus time T, where the dashed line composed of dots and boxes represents the time when using the Prasad dataset. The variation with T, the solid line represents the variation when using the Occluded Ellipse dataset. The fluctuations in T are represented by the dashed line composed of line segments and triangles when using the Overlap Ellipses dataset. The fluctuations and changes in T. From Figure 10 As can be seen from the curve, with As the value increases, the system's filtering ability for approximately straight line segments improves, and the F-value increases accordingly. When the F-value is 0.1, the F-value reaches its peak, indicating that the arc segment selection effect is optimal at this point. The retained arc segments are of higher quality, and the constructed quadruplets are more accurate, which helps improve the overall detection effect. Figure 11 As can be seen, the overall running time of ellipse detection is significantly reduced as the side length ratio threshold gradually increases. Therefore, appropriately increasing the threshold... This not only improves the quality of the arc segment and enhances detection accuracy, but also effectively controls the consumption of computational resources. Considering both detection performance and operational efficiency, this embodiment sets the side length ratio threshold. Set to 0.1 to achieve the best balance between detection accuracy and computational cost.
[0053] Due to the threshold of the tangent angle The parameters directly affect whether the tangent continuity condition is met between arc segments, thus indirectly affecting the computational workload of the system in the quadruplet construction and screening stage. Figure 12 Tangent angle threshold A dotted line graph of Anglethreshold and F-measure, where the dashed line composed of dots and boxes represents the result when using the Prasad dataset. The solid line represents the variation in the F-value when using the Occluded Ellipse dataset. The dashed line composed of line segments and triangles represents the fluctuations in the F-value when using the Overlap Ellipses dataset. With the fluctuation of the F value; Figure 13 Tangent angle threshold A dotted line graph of (Angle threshold) versus time T, where the dashed line composed of dots and boxes represents the time when using the Prasad dataset. The variation with T, the solid line represents the variation when using the Occluded Ellipse dataset. The fluctuations in T are represented by the dashed line composed of line segments and triangles when using the Overlap Ellipses dataset. The fluctuations and changes in T. From Figure 12 and Figure 13 It can be observed that when When the angle is 12°, the judgment condition is relaxed, and the system is more likely to consider two arc segments as continuous, thus reducing the number of arc segment pairs filtered out due to angle discrepancies, and the F-value reaches its maximum. However, because the number of combinations involved in the screening increases, but the judgment process becomes more lenient, the overall judgment efficiency of the system actually improves, so the detection time decreases in this interval. However, when As the threshold is further increased, many arc segments that should not have been joined are misjudged as continuous, generating more unreasonable candidate quadruples. This not only increases the computational burden of subsequent verification and fitting but may also cause the system to process a large number of low-quality ellipses, causing the detection time to stabilize or even slightly increase. Therefore, this embodiment sets the tangent angle threshold... Setting it to 12° can significantly improve detection accuracy while achieving the best balance between efficiency and accuracy while maintaining a reasonable system uptime.
[0054] In the elliptical cam image detection method for harmonic reducers provided in this embodiment, during the post-processing stage of elliptical image detection, an elliptical fraction threshold is used. and reliability threshold Ellipses are validated. If these two thresholds are set too high, the judgment criteria will be too strict, which may cause some true candidate ellipses to fail the validation and be incorrectly eliminated, thereby reducing the system's recall rate and overall detection performance. Conversely, if the thresholds are set too low, the screening criteria become lenient, making it easier to detect some pseudo-ellipses that do not conform to geometric features, leading to an increase in the false detection rate and affecting accuracy. This embodiment considers the ellipse fraction threshold. and reliability threshold Primarily used in the post-processing verification stage, their computation time is extremely small, thus their impact on the overall detection time is negligible. Therefore, when evaluating their effectiveness, this embodiment only focuses on the changes in their relationship with the comprehensive detection performance index F-value. Figure 14 Elliptic fraction threshold A dotted line graph of the elliptical threshold and the F-measure; the dashed line consisting of dots and boxes represents the data when using the Prasad dataset. The solid line represents the variation in the F-value when using the Occluded Ellipse dataset. The dashed line composed of line segments and triangles represents the fluctuation of the F-value when using the OverlapEllipses dataset. With the fluctuation of the F value; Figure 15 Elliptic fraction threshold A dotted line graph of (elliptical threshold) versus time T, where the dashed line composed of dots and boxes represents the time when using the Prasad dataset. The variation with T, the solid line represents the variation when using the Occluded Ellipse dataset. The fluctuations in T are represented by the dashed line composed of line segments and triangles when using the Overlap Ellipses dataset. The fluctuations and changes in T. For example... Figure 14 and Figure 15 Mid-elliptic fraction threshold The trend shows that when the value is below 0.5, the F-value continuously increases with the gradual increase of the threshold, indicating that the fitting quality of the candidate ellipse is effectively improved. However, when... After the threshold exceeds 0.5, the F-value actually begins to decrease, meaning that an excessively high threshold can mistakenly remove some true ellipses, affecting overall performance. Similarly, Figure 16 Elliptic reliability threshold A dotted line graph of the Reliability threshold and the F-measure, where the dashed line consisting of dots and boxes represents the values when using the Prasad dataset. The solid line represents the variation in the F-value when using the Occluded Ellipse dataset. The dashed line composed of line segments and triangles represents the fluctuations in the F-value when using the Overlap Ellipses dataset. With the fluctuation of the F value; Figure 17 Elliptic reliability threshold A dotted line graph of the reliability threshold versus time T, where the dashed line consisting of dots and boxes represents the time when the Prasad dataset is used. The variation with T, the solid line represents the variation when using the Occluded Ellipse dataset. The fluctuations in T are represented by the dashed line composed of line segments and triangles when using the Overlap Ellipses dataset. The fluctuations and changes in T. For example... Figure 16 and Figure 17 Medium reliability threshold The changing trend shows that when it is less than 0.6, the F value increases slowly with the threshold, indicating that the structural distribution of the candidate ellipse gradually becomes more reasonable; when... When the F-value is >0.6, it drops rapidly, indicating that some true ellipses with slight structural deviations are mistakenly excluded. In summary, this embodiment will... Set it to 0.5, Set it to 0.6.
[0055] After determining the threshold parameters for elliptical image detection in this embodiment based on a public dataset, image resolution, noise level, and scene complexity are uniformly incorporated into the verification example. Through a multi-factor cross-validation example, the running time and performance of the algorithm provided in this embodiment under different scales, levels of interference, and target densities are intuitively reflected. Specifically, four types of images are constructed based on three resolutions: 256×256, 512×512, and 1024×1024: low-noise and sparse-edge images, low-noise and dense-edge images, high-noise and sparse-edge images, and high-noise and dense-edge images, resulting in a total of 12 test images. These images fully encompass different sizes, levels of interference with irrelevant information, and target complexity. Two images from each type are selected, for a total of six images, to avoid randomness. The algorithm is run under a unified hardware environment and fixed algorithm parameters. The results are shown in Table 1. Table 1. Results of Multivariate Comparison Validation
[0056] As shown in Table 1, with the increase in resolution, the number of pixels and edge points in the image increases significantly, leading to an approximately linear increase in detection time. This phenomenon is particularly pronounced under fixed noise and scene conditions. High-noise environments introduce a large number of false edges, drastically increasing the number of edges. However, the algorithm effectively eliminates most irrelevant information through early threshold screening, thus effectively controlling the increase in detection time. The comparative data in Table 1 fully demonstrates the changes in the number of edges and detection time under low and high noise conditions, as well as the number of detected ellipses, reflecting the stability of the algorithm's overall performance. Further observation of the multivariate comparative verification results under different scene complexities in Table 1 reveals that in cases of complex backgrounds or dense targets, the detection time increases accordingly due to the sharp increase in the number of candidate combinations. However, it is worth noting that the introduction of multiple geometric constraints, such as coordinate, proximity, and tangent continuity constraints, effectively eliminates a large number of invalid candidate arc segments. Although the actual running time of the harmonic reducer elliptical cam image detection method increases, it remains at an acceptable level overall.
[0057] In summary, under high noise and complex scene conditions, the elliptical cam image detection method for harmonic reducers provided in this embodiment can effectively control the detection time and maintain efficient operation through pre-screening and constraint mechanisms, with the time increase still controlled and within a reasonable range. This result fully verifies the advantages of the elliptical cam image detection method for harmonic reducers provided in this embodiment in controlling invalid computation and improving efficiency, and demonstrates its good scalability and robustness. It shows that the elliptical cam image detection method for harmonic reducers provided in this embodiment not only theoretically reduces invalid computation, but also verifies its high efficiency and stability through practical tests in various complex environments.
[0058] Furthermore, the elliptical cam image detection method provided in this embodiment is compared with existing methods based on the geometric relationship between the elliptical chord and its center, which estimate the ellipse by decomposing the parameter space (Fornaciari method); methods that introduce line pruning strategies to effectively remove invalid candidates and estimate the ellipse (Jia method); methods that extract arc branch segments and iteratively aggregate them into arc branch groups, then combine local saliency and global pairing to quickly fit the initial ellipse, perform hierarchical clustering of its 5D parameters and refine it through rigorous validation (Lu method); and a highly efficient ellipse detection method that combines a circular arc selection-growth strategy with fast corner detection, fitting grouped and ungrouped salient arcs and validating and deduplicating candidate ellipses (Wang method). These methods are compared on the Prasad dataset. The detection results are shown in Table 2, comparing accuracy (P), recall (R), F-value, and runtime (T). The source code for the above four methods is publicly available and can be obtained online. Table 2 Comparison of various ellipse detection algorithms
[0059] As can be seen from the data in Table 2, the elliptical cam image detection method for harmonic reducers provided in this embodiment not only significantly outperforms other comparative methods in terms of overall F-value in elliptical image recognition—for example, our method achieves an F-value of 0.5632, significantly higher than Fornaciari's 0.4352 and Jia's 0.4253, but also surpasses Lu's 0.5183 and Wang's 0.5324—while maintaining a high recall rate, the elliptical cam image detection method for harmonic reducers provided in this embodiment also ensures a stable accuracy rate. This fully demonstrates that the method can better balance the contradiction between missed detections and false detections in the detection system, thereby improving the overall detection performance.
[0060] The image detection method for elliptical cams of harmonic reducers provided in this embodiment achieves a recall rate of 0.4635, which is basically on par with the Lu method and significantly higher than the Fornaciari, Jia, and Wang methods. This improvement is mainly due to the efficient arc segment screening and rigorous candidate verification strategy, which effectively reduces the false negatives of true ellipses. In terms of accuracy, the image detection method for elliptical cams of harmonic reducers provided in this embodiment achieves a value of 0.7443, slightly higher than the Fornaciari method's 0.7398 and the Liu method's 0.7246, and significantly better than the Jia method's 0.5846. This indicates that the image detection method for elliptical cams of harmonic reducers provided in this embodiment not only improves the recall rate but also effectively controls the false positive rate. Regarding detection speed, the image detection method for elliptical cams of harmonic reducers provided in this embodiment has a runtime of only 34.8 milliseconds, which is significantly faster than other methods. The rapid detection speed is mainly attributed to the efficient arc segment filtering and matching strategy introduced into our algorithm, which reduces computational complexity and ensures the feasibility of real-time processing. In other words, the elliptical cam image detection method for harmonic reducers provided in this embodiment not only breaks through the bottleneck of traditional methods in terms of performance indicators, but also shows significant advantages in terms of actual operating efficiency and robustness.
[0061] Images representing typical scenes from three datasets are used for visualization and comparison. Figure 18 As shown in the results, the elliptical cam image detection method for harmonic reducers provided in this embodiment exhibits significant advantages in complex scenarios involving multiple elliptical boundaries with blurred edges, small ellipse sizes, and the inclusion of both regular and flat ellipses. Specifically, in complex backgrounds with multiple ellipses and blurred boundaries, the elliptical cam image detection method for harmonic reducers provided in this embodiment can accurately detect the target ellipse, while the Fornaciari and Jia methods show significant duplicate detection. In small ellipse detection scenarios, the elliptical cam image detection method for harmonic reducers provided in this embodiment can also stably detect all targets, while other methods have varying degrees of missed detection issues and errors when fitting overlapping ellipses. In cases involving missing edges and flat ellipses, the Liu and Wang methods show significant missed detections, while the elliptical cam image detection method for harmonic reducers provided in this embodiment can effectively detect all elliptical targets.
[0062] Specifically, such as Figure 18 As shown, in the cam image of the harmonic reducer, regardless of the method provided in this embodiment of the invention, or the existing Fornaciari method, Jia method, Liu method, and Wang method, the outer contour of the cam can be identified. Specifically, it can be seen that... Figure 18The outermost regions are highlighted with a lighter shade. For the more complex ellipse image recognition examples 1 and 2, the highlighted areas represent the contours identified by their respective methods, while the lighter areas represent lines from the original image. It is evident that existing methods such as Fornaciari, Jia, Liu, and Wang often miss some ellipses in scenarios involving small ellipses, partially intersecting ellipses, or partially occluded ellipses. However, the harmonic reducer elliptical cam image detection method provided in this embodiment of the invention can identify all ellipses in both example images, further demonstrating that the invention can fully recognize elliptical images, providing a fundamental guarantee for elliptical cam detection in harmonic reducer images.
[0063] In summary, the elliptical cam image detection method for harmonic reducers provided in this embodiment first performs image preprocessing through adaptive Canny edge detection and Gaussian filtering. Then, it employs an efficient arc segment extraction and multi-level arc segment filtering strategy to effectively remove a large number of invalid short and straight arcs. Furthermore, it constructs candidate elliptical quadruplet arc segments through carefully designed arc segment grouping and geometric constraints such as coordinate constraints, adjacency constraints, and tangent continuity constraints. Finally, it uses the least squares method based on algebraic distance to fit the elliptical parameters of the candidate quadruplet arc segments. In addition, it removes pseudo-ellipses and duplicate detected ellipses through candidate ellipse verification and clustering. Combining the detection results from three public datasets, the detection method provided in this embodiment significantly improves the running speed while ensuring detection accuracy; the detection time is linearly related to the number of edge points. Compared with current advanced ellipse detection algorithms, the overall running efficiency is improved, and the F-value is significantly better than other methods. Moreover, compared with several existing ellipse detection algorithms, the detection method provided in this embodiment demonstrates good robustness in detecting small ellipses, flat ellipses, and ellipses affected by noise in the real world, outperforming other representative algorithms.
[0064] Example 3 The present invention also provides an elliptical cam image detection system for a harmonic reducer, comprising: The image acquisition module is used to acquire images of the harmonic reducer to be identified.
[0065] The edge extraction module is used to extract the edges of the image of the harmonic reducer to be identified, and obtain multiple arc segments.
[0066] The arc segment filtering module is used to determine the minimum bounding rectangle of multiple arc segments and calculate the aspect ratio of the minimum bounding rectangle. When the aspect ratio of the minimum bounding rectangle is greater than the preset aspect ratio threshold, the arc segment corresponding to the minimum bounding rectangle is taken as the arc segment to be classified.
[0067] The classification and combination module is used to classify arc segments according to their positive or negative polarity, obtaining positive or negative polarity classification results, and to classify arc segments according to their concavity or convexity, obtaining concavity or convexity classification results. Through pre-set geometric constraints, the module filters quadruple arc segments based on pre-set elliptical geometric constraints, obtaining candidate elliptical quadruple arc segments. Each quadruple arc segment is obtained by combining arc segments with four different classification results, and these four classification results are determined based on both the positive / negative polarity classification results and the concavity / convexity classification results.
[0068] The parameter fitting module is used to perform parameter fitting on the arc segments of the candidate ellipse quadruples to obtain the cam detection results of the image of the harmonic reducer to be identified.
[0069] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps in an embodiment of a method for detecting an elliptical cam image of a harmonic reducer. Specific implementation methods can be found in the method embodiments, and will not be repeated here.
[0070] Furthermore, the present invention also provides a non-transitory computer-readable storage medium containing instructions on which a computer program is stored. For example, a memory containing instructions that can be executed by a processor of a computer device to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc. When the computer program is executed by the processor, it can implement the steps in an embodiment of a harmonic reducer elliptical cam image detection method. Specific implementation methods can be found in the method embodiments, which will not be repeated here.
[0071] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification and embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the present invention patent. No reference numerals in the claims should be construed as limiting the scope of the claims. Any simple variations or equivalent substitutions of technical solutions that can be readily obtained by those skilled in the art within the scope of the technology disclosed in the present invention are within the protection scope of the present invention.
Claims
1. A method for detecting elliptical cam images of a harmonic reducer, characterized in that, include: Acquire an image of the harmonic reducer to be identified; Edge extraction is performed on the image of the harmonic reducer to be identified to obtain multiple arc segments; Determine the minimum bounding rectangle of multiple arc segments and calculate the aspect ratio of the minimum bounding rectangle. When the aspect ratio of the minimum bounding rectangle is greater than a preset aspect ratio threshold, the arc segment corresponding to the minimum bounding rectangle is taken as the arc segment to be classified. The arc segments to be classified are classified according to their positive and negative values to obtain a positive and negative classification result. Specifically, this includes setting pixel neighborhoods at the left and right endpoints of the arc segments to be classified, calculating the average gradient vector based on the edge pixels in the pixel neighborhoods of the left and right endpoints to obtain the direction of the left and right endpoints of the arc segments, and determining the positive and negative classification result of the arc segments based on the product of the direction of the left and right endpoints of the arc segments, wherein the positive and negative values of the arc segments are consistent with the positive and negative values of the product; the arc segments to be classified are also classified according to their concavity and convexity to obtain a concavity and convexity classification result; and the quadruplet arc segments are filtered based on the pre-set geometric constraints of ellipses to obtain candidate elliptical quadruplet arc segments, wherein the quadruplet arc segments are obtained by combining arc segments with four different classification results, and the four classification results are determined based on the positive and negative classification result and the concavity and convexity classification result. The candidate ellipse quadruples arc segments are fitted with parameters to obtain the elliptical cam fitted image of the image of the harmonic reducer to be identified.
2. The method for detecting elliptical cam images of a harmonic reducer according to claim 1, characterized in that, The geometric constraints of the ellipse include adjacency constraints, coordinate constraints, and tangent continuity constraints. The quadruplet arc segments resulting from the combination of the arc segment positive / negative classification results and the arc segment concavity / convexity classification results are filtered based on the pre-set geometric constraints of the ellipse to obtain candidate ellipse quadruplet arc segments, including: The arc segments are combined according to the positive / negative classification results and the concavity / convexity classification results to obtain the quadruple arc segments; The elliptic topological properties of the quadruple arc segment are verified by the adjacency constraint conditions to obtain the quadruple arc segment after adjacency constraint. The spatial position rationality of the adjacent constrained quadruple arc segments is verified by the coordinate constraint conditions to obtain the coordinate constrained quadruple arc segments. The endpoint tangent direction is calculated for the quadruplet arc segment after the coordinate constraint, and the tangent angle is verified by the tangent continuity constraint condition to obtain the candidate elliptical quadruplet arc segment.
3. The method for detecting elliptical cam images of a harmonic reducer according to claim 1, characterized in that, Before determining the minimum bounding rectangle of the plurality of said arc segments and calculating the aspect ratio of said minimum bounding rectangle, the method further includes: The number of edge points is calculated for multiple arc segments, and the arc segments with a number of edge points greater than a preset edge point threshold are selected as the arc segments after preliminary screening.
4. The method for detecting elliptical cam images of a harmonic reducer according to claim 1, characterized in that, Before performing edge extraction on the image of the harmonic reducer to be identified to obtain multiple arc segments, the process further includes: The image of the harmonic reducer to be identified is converted to grayscale to obtain a grayscale image; The grayscale image is subjected to Gaussian filtering for noise reduction to obtain a smoothed image; The smoothed image is then edge-sharpened to obtain the pre-processed image of the harmonic reducer to be identified.
5. The method for detecting elliptical cam images of a harmonic reducer according to claim 1, characterized in that, The parameter fitting of the candidate elliptical quadrupole arc segments yields the elliptical cam-fitted image of the harmonic reducer image to be identified, including: The candidate ellipse quadruples arc segments are calculated using the least squares method to obtain the ellipse center, ellipse tilt angle, and ellipse semi-axis length; The ellipse parameter fitting results are obtained by fitting the ellipse center, ellipse tilt angle and ellipse semi-axis length. The elliptical cam fitting image is determined based on the ellipse parameter fitting results.
6. The method for detecting elliptical cam images of a harmonic reducer according to claim 5, characterized in that, Before determining the elliptical cam fitting image based on the elliptical parameter fitting result, the method further includes: The ellipse fraction is calculated based on the fitting results of the ellipse parameters. When the calculated ellipse fraction is greater than the preset ellipse fraction threshold, an ellipse reliability calculation is performed. When the calculated ellipse reliability result is greater than the preset ellipse reliability threshold, similarity is calculated based on the ellipse center, ellipse tilt angle and ellipse semi-axis length corresponding to the fitting results of multiple ellipse parameters. Based on the similarity calculation results, the fitting results of multiple ellipse parameters are clustered to obtain the filtered fitting results of the ellipse parameters.
7. An elliptical cam image detection system for harmonic reducers, characterized in that, include: The image acquisition module is used to acquire images of the harmonic reducer to be identified. The edge extraction module is used to extract the edges of the image of the harmonic reducer to be identified, and obtain multiple arc segments; The arc segment filtering module is used to determine the minimum bounding rectangle of multiple arc segments and calculate the aspect ratio of the minimum bounding rectangle. When the aspect ratio of the minimum bounding rectangle is greater than a preset aspect ratio threshold, the arc segment corresponding to the minimum bounding rectangle is taken as the arc segment to be classified. The classification and combination module is used to classify the arc segments to be classified according to their positive and negative values to obtain a positive and negative classification result. Specifically, it includes setting pixel neighborhoods at the left and right endpoints of the arc segments to be classified, calculating the average gradient vector based on the edge pixels in the pixel neighborhoods of the left and right endpoints to obtain the left and right endpoint directions of the arc segments, and determining the positive and negative classification result of the arc segments based on the product of the left and right endpoint directions, wherein the positive and negative values of the arc segments are consistent with the positive and negative values of the product; classifying the arc segments to be classified according to their concavity and convexity to obtain a concavity and convexity classification result; and filtering the quadruplet arc segments based on pre-set geometric constraints and pre-set elliptical geometric constraints to obtain candidate elliptical quadruplet arc segments, wherein the quadruplet arc segments are obtained by combining arc segments with four different classification results, and the four classification results are determined based on the positive and negative classification result and the concavity and convexity classification result. The parameter fitting module is used to perform parameter fitting on the candidate elliptical quadruple arc segments to obtain the elliptical cam fitting image of the image of the harmonic reducer to be identified.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the harmonic reducer elliptical cam image detection method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is able to execute the steps of the harmonic reducer elliptical cam image detection method according to any one of claims 1 to 6.