Elliptical hole automatic detection and fitting method and system based on three-dimensional point cloud

By performing normal calculation and principal component analysis in three-dimensional space, a triangular mesh model is reconstructed, and boundary loops are extracted and fitted. This solves the problem of unstable fitting of three-dimensional point cloud holes in existing technologies, and achieves high-precision and robust elliptical hole detection, which is suitable for CAD modeling and quality inspection.

CN121661285APending Publication Date: 2026-03-13NANJING YUNTONG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing technologies for fitting holes in 3D point clouds, the fitting process is highly dependent on the quality of the 2D projection point set, which leads to unstable fitting results. In particular, when there is noise or uneven distribution at the boundary points, the rotation angle and ellipse parameters deviate from the true values.

Method used

By performing normal calculation and principal component analysis in three-dimensional space, a triangular mesh model is reconstructed, boundary loops are extracted and separated from the inside and outside, and an ellipse is fitted using principal component analysis. Combined with convex hull calculation and back projection, high-precision ellipse fitting is achieved.

Benefits of technology

It achieves highly automated and robust elliptical hole detection, with accurate fitting results, suitable for CAD modeling and quality inspection, and improves fitting accuracy and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661285A_ABST
    Figure CN121661285A_ABST
Patent Text Reader

Abstract

The invention discloses an elliptical hole automatic detection and fitting method based on a three-dimensional point cloud. The method comprises the steps that a target point cloud area is selected from a known point cloud; loading a target point cloud and carrying out initialization; performing normal calculation to obtain a target point cloud with normal information; reconstructing a triangular mesh model of the target point cloud through a greedy projection triangulation algorithm; extracting all boundary rings in the triangular mesh model based on the topological relation of the mesh data; performing inner and outer boundary ring separation, and abandoning an outer boundary ring; taking the inner boundary ring containing the maximum number of vertexes as a target elliptical hole contour; and based on a principal component analysis method, performing ellipse fitting on the contour of the target elliptical hole, obtaining a three-dimensional point set of the target elliptical hole according to two-dimensional fitting ellipse back projection, and realizing accurate description of the shape and pose of the target elliptical hole. The hole detection method based on three-dimensional point cloud boundary extraction and ellipse fitting is high in automation degree, good in fitting precision and high in robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of three-dimensional data processing technology, and in particular relates to a method and system for automatic detection and fitting of elliptical holes based on three-dimensional point clouds. Background Technology

[0002] With the rapid development of 3D scanning technologies (such as LiDAR, structured light, and photogrammetry), quickly acquiring high-precision 3D point cloud data of object surfaces has gradually become a common application. Currently, holes are a common geometric feature, widely found in mechanical parts (such as mounting holes and pin holes) and building components (such as door and window openings). Accurately identifying these holes and measuring their geometric parameters (such as center, major and minor axes, and orientation) is crucial for applications such as product quality inspection, reverse engineering, and digital archiving.

[0003] However, existing technologies still have shortcomings. In the traditional ellipse fitting process (especially when dealing with holes in 3D point clouds), the boundary points of the 3D holes are usually projected onto a 2D plane first, and then the ellipse equation is fitted directly on the 2D plane using algorithms such as the least squares method. The rotation angle is then calculated from the coefficients of the fitted ellipse equation.

[0004] The fatal flaw of this traditional method is that the fitting process is extremely dependent on the local quality of the projected two-dimensional point set. If the boundary points are noisy, uneven (non-convex), or unevenly distributed, the fitting process will directly incorporate these errors into the calculation, causing the calculated rotation angle (and even the entire ellipse) to deviate significantly from the true value, resulting in highly unstable fitting results.

[0005] Therefore, there is an urgent need in this field for a method that can automatically and accurately extract holes from 3D point clouds and perform parametric ellipse fitting on them. Summary of the Invention

[0006] To address the problems existing in the prior art, this invention proposes an automatic elliptical hole detection and fitting method based on three-dimensional point clouds, aiming to provide a hole detection method based on three-dimensional point cloud boundary extraction and ellipse fitting with high automation, good fitting accuracy, and strong robustness.

[0007] To achieve the above-mentioned technical objectives, the present invention provides the following technical solution: An automatic detection and fitting method for elliptical holes based on 3D point clouds, specifically including: Manually select a point cloud region containing the target elliptical hole on a known 3D point cloud as the target point cloud region; load the target point cloud within the target point cloud region to initialize the target point cloud; Perform normal calculations on the initialized target point cloud, calculate the normal vector of each point, and obtain the target point cloud with normal information. Based on the target point cloud with normal information, a triangular mesh model of the target point cloud is reconstructed by a greedy projection triangulation algorithm. The triangular mesh model includes vertex information and polygon patch topology information. Extracting all boundary loops from the triangular mesh model based on the topological relationships of the mesh data; The obtained boundary rings are separated into inner and outer boundary rings. The boundary ring with the most vertices or the largest enclosed area is identified as the outer boundary ring and discarded. The remaining boundary rings are identified as inner boundaries. Compare the number of vertices contained in all inner boundary rings, and use the inner boundary ring with the most vertices as the target elliptical hole contour. Based on principal component analysis, an ellipse fitting operation is performed on the contour of the target elliptical hole. The three-dimensional point set of the target elliptical hole is obtained by back-projection of the two-dimensional fitted ellipse, thereby achieving an accurate description of the shape and pose of the target elliptical hole.

[0008] Furthermore, the initialization of the target point cloud includes integrity verification and format standardization.

[0009] Furthermore, the step of calculating the normal vector of the initialized target point cloud to obtain the target point cloud with normal information specifically involves: For each point in the initialized target point cloud, search for its K nearest neighbors to form a neighbor set. Construct a local covariance matrix based on the neighbor set and calculate the eigenvalues ​​and eigenvectors of the local covariance matrix. Use the eigenvector corresponding to the smallest eigenvalue as the normal vector of that point. After calculating the normal vectors of all points, unify the orientation of each normal vector through viewpoint consistency or normal repair to finally obtain the target point cloud with normal information.

[0010] Furthermore, the extraction of all boundary loops in the triangular mesh model based on the topological relationships of the mesh data specifically includes: Traverse all triangular faces in the triangular mesh model and count the occurrences of each edge of the triangular face; each edge uses an ordered storage structure to ensure that the vertex indices are always arranged in ascending order; Edges that appear only once are selected as candidate edges for the boundary cycle; An undirected graph adjacency list is constructed using the vertices of candidate edges as nodes and the candidate edges as connections. Each vertex in the adjacency list records its adjacent vertices and maintains connection boundary information. The Depth-First Search (DFS) algorithm is used to extract boundary cycles: the traversal starts from the unvisited vertex with degree 1, and the candidate edges are visited sequentially along the adjacent vertices, and the visit history is recorded until the starting vertex is returned, forming a closed boundary cycle; if the traversal starts from a vertex with degree 1 and ends at another vertex with degree 1, it is recorded as an unclosed boundary cycle. Set a ring length threshold to filter out invalid boundary rings and unclosed boundary rings whose length does not meet the threshold; after traversing all candidate edges, retain all the obtained boundary rings.

[0011] Furthermore, the step of performing an ellipse fitting operation on the target elliptical hole contour based on principal component analysis, and obtaining the three-dimensional point set of the target elliptical hole by back-projection of the two-dimensional fitted ellipse, thereby achieving an accurate description of the shape and pose of the target elliptical hole, specifically includes: Calculate the centroid of the point cloud corresponding to the elliptical hole contour of the target, translate each point on the boundary to the centroid coordinate system for decentering, perform principal component analysis on the decentered point cloud, and calculate the covariance matrix of the coordinates of each point after decentering. Solving the covariance matrix yields three eigenvectors representing the directions of the three principal components, and the corresponding eigenvalues ​​for each eigenvector. The eigenvectors are then denoted as follows, in descending order of their eigenvalues: The eigenvector PC1 of the first principal component direction represents the major axis direction of the target elliptical hole; The eigenvector PC2 of the second principal component direction represents the minor axis direction of the target elliptical hole; The eigenvector PC3 of the third principal component direction represents the normal vector of the target elliptical hole plane; The plane spanned by PC1 and PC2 is used as the optimal projection plane. The three-dimensional points on the inner boundary ring are projected onto the optimal projection plane. The projection coordinates of each point in the principal direction are calculated by dot product operation to obtain the two-dimensional projection point set. Calculate the convex hull of the two-dimensional projection point set, use the convex hull to calculate the fitted ellipse of the target elliptical hole, and obtain an initial axis-aligned ellipse through the convex hull. The center coordinates, major axis length, and minor axis length of the initial axis-aligned ellipse are all calculated from the axial extrema of the convex hull on the optimal projection plane. Using the angle between the eigenvector PC1 of the first principal component direction and the X-axis of the optimal projection plane as the initial axis, the rotation angle of the ellipse is aligned to obtain a fitted ellipse with the correct orientation. Parametric sampling is performed, and N uniformly distributed sampling points are generated on the optimal projection plane according to the elliptic parametric equation of the fitted ellipse, so as to obtain the two-dimensional point set and parametric equation of the target elliptical hole. Based on the inverse of the transformation matrix obtained from principal component analysis, the two-dimensional point set of the target elliptical hole is back-projected back into the original three-dimensional point cloud space. Then, through centroid coordinate offset, the three-dimensional point set of the target elliptical hole is obtained, thereby determining the shape and pose of the target elliptical hole.

[0012] More specifically, the center coordinates, major axis length, and minor axis length of the initial axis-aligned ellipse are all calculated from the axial extrema of the convex hull on the optimal projection plane, specifically as follows: The center coordinates are determined by the midpoint of the extreme values ​​of the convex hull in the X and Y axes of the optimal projection plane, as expressed by the formula: ; in With the center coordinates, , Let be the maximum and minimum values ​​of the convex hull along the X-axis of the optimal projection plane, respectively. , These are the maximum and minimum values ​​of the convex hull along the Y-axis of the optimal projection plane, respectively. The length of the major axis and minor axis length It is then determined by half the difference between the extreme values ​​in the X and Y directions, as expressed by the formula: ; ; ; ; in, , These represent the semi-major axis length and the semi-minor axis length, respectively.

[0013] More specifically, the rotation angle of the ellipse aligned with the eigenvector PC1 of the first principal component direction and the X-axis of the optimal projection plane as the initial axis is as follows: Obtain the projection of the eigenvector PC1 of the first principal component direction onto the optimal projection plane. Using the projected coordinates as input, the angle between PC1 and the X-axis of the optimal projection plane is solved using the two-parameter arctangent function. The rotation angle used as the initial axis to align the ellipse, the included angle The formula is expressed as: ; in, This represents the two-parameter arctangent function. , These are the X-axis and Y-axis coordinates of PC1 projected onto the optimal projection plane, respectively.

[0014] This invention also provides an application system for the above-mentioned automatic detection and fitting method for elliptical holes based on three-dimensional point clouds, specifically including: The module includes a data processing module, a mesh processing module, a boundary extraction module, and an ellipse fitting module, among which: The data processing module is used to select the target point cloud region and calculate the target point cloud normal information; The mesh processing module is used to reconstruct a triangular mesh model of a target point cloud with normal information using a greedy projection triangulation method. The boundary extraction module is used to extract the inner boundary ring from the triangular mesh model and filter out the target elliptical hole contour from the inner boundary ring. The ellipse fitting module includes a PCA analysis module, a point cloud projection module, a convex hull calculation module, a parameter calculation module, a fitting generation module, and a back projection module, which are used to perform ellipse fitting on the contour of the target elliptical hole to obtain the precise shape and pose of the target elliptical hole.

[0015] Furthermore, the present invention also provides an electronic device comprising a memory and a processor, wherein: Memory is used to store computer programs that can run on a processor; The processor is configured to execute, as described above, the automatic detection and fitting method for elliptical holes based on three-dimensional point clouds when running the computer program.

[0016] A computer-readable storage medium is also provided, which stores computer instructions for causing a processor to execute the above-described method for automatic detection and fitting of elliptical holes based on three-dimensional point clouds.

[0017] Based on the above technical solution, the present invention has at least the following beneficial effects: This invention achieves a fully automated processing flow from raw point cloud to parameterized hole model in the overall process, and can effectively separate and extract multiple holes; This invention first smooths the boundary by calculating the convex hull, eliminating the influence of noise and unevenness on the fitting, making the fitted ellipse closer to the theoretical shape of the hole. Second, this invention uses the first principal direction obtained by principal component analysis to determine the rotation angle of the fitted ellipse. This direction is based on the global statistical characteristics of all points and is not sensitive to local noise, which significantly improves the robustness and accuracy of the fitted ellipse direction estimation and solves the problem of misalignment between the fitted ellipse and the target ellipse hole position.

[0018] The invention ultimately outputs a parametric model of the target elliptical hole, thereby obtaining its precise shape and pose information, rather than discrete boundary points. It can be directly used for downstream tasks such as CAD modeling and quality inspection, and has high practical value. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating the overall process of the automatic detection and fitting method for elliptical holes based on 3D point clouds proposed in this invention. Figure 2 A schematic diagram of the triangular mesh model transformed by the greedy projection triangulation algorithm; Figure 3A schematic diagram of the target elliptical hole outline selected from the inner boundary ring; Figure 4 A schematic diagram of the two-dimensional projection point set and convex hull projected onto the PCA principal plane; Figure 5 The ellipse is fitted based on the axial extrema of the convex hull on the PCA principal plane and the PCA principal direction; Figure 6 This is a schematic diagram of the final target elliptical hole. Detailed Implementation

[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the following description is provided in conjunction with the accompanying drawings. Figure 1-6 The present invention will be further described in detail with reference to the embodiments. This will allow for a full understanding of how the present application uses technical means to solve technical problems and achieve technical effects, and to facilitate its implementation.

[0021] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0022] This invention proposes an automatic elliptical hole detection and fitting method based on 3D point clouds. This method completely breaks away from traditional thinking. The core is as follows: First, a global analysis is performed in 3D space, executing Principal Component Analysis (PCA) on the original, unprojected 3D hole boundary point set. Through analysis based on the statistical characteristics of all points, the obtained results (principal directions) are naturally robust to local noise and defects. Since the first principal component direction is essentially the "direction where the point set is most dispersed in space," it is physically highly consistent with the "major axis direction of the ellipse." Next, the direction parameter is directly extracted. By calculating the angle between the first principal component direction and the optimal projection plane, the rotation angle is directly obtained from the 3D analysis results. This angle is not "fitted" or "optimized" from noisy 2D points, but rather "calculated" through global statistics. Finally, a stable parameter is used for 2D definition. This highly stable rotation angle, derived from 3D space, is used as a known and reliable parameter to directly define the ellipse on the 2D projection plane. Subsequently, only the size (major and minor axes) and position (center) need to be calculated on the 2D plane, and these two parameters can be easily and stably obtained by calculating the extreme values ​​of the convex hull.

[0023] Therefore, the method proposed in this invention is a highly automated, accurate, and robust method for detecting elliptical holes. Figure 1 As shown, it specifically includes the following steps: Manually select a point cloud region containing the target elliptical hole on a known 3D point cloud as the target point cloud region; load the target point cloud within the target point cloud region to initialize the target point cloud; In this application, a pre-acquired 3D point cloud data file (such as PCD format) is first read from a storage medium. This point cloud data contains a large number of discrete 3D coordinate points, representing the surface geometry of the target object. However, during the reading and loading process, due to multiple uncontrollable factors, loading failures may occur, resulting in invalid extracted data or insufficient points for subsequent processing. Therefore, this application performs integrity verification and format standardization on the target point cloud to ensure that the subsequent processing module can correctly parse and use the point cloud data.

[0024] Perform normal calculations on the initialized target point cloud, calculate the normal vector of each point, and obtain the target point cloud with normal information. In a preferred embodiment, the step of performing normal calculation on the initialized target point cloud, calculating the normal vector of each point, and obtaining the target point cloud with normal information specifically involves: For each point in the initialized target point cloud, search for its K nearest neighbors to form a neighbor set. Construct a local covariance matrix based on the neighbor set (the local covariance matrix is ​​the covariance matrix between the coordinates of the neighboring points and the mean of the neighborhood coordinates), and calculate the eigenvalues ​​and eigenvectors of the local covariance matrix. Use the eigenvector corresponding to the smallest eigenvalue as the normal vector of that point. After calculating the normal vectors of all points, unify the orientation of each normal vector through viewpoint consistency or normal repair, and finally obtain the target point cloud with normal information.

[0025] Compared to point clouds, mesh data better reflects 3D topological information, facilitating the detection and extraction of elliptical groove contour information. Therefore, this application reconstructs a triangular mesh model of the target point cloud based on the target point cloud with normal information using a greedy projection triangulation algorithm, i.e., a continuous curved surface mesh, such as... Figure 2 As shown; the triangular mesh model includes vertex information and polygonal patch topology information; Extracting all boundary loops from the triangular mesh model based on the topological relationships of the mesh data; The obtained boundary rings are separated into inner and outer boundary rings. The boundary ring with the most vertices or the largest enclosed area is identified as the outer boundary ring and discarded. The remaining boundary rings are identified as inner boundaries. In a preferred embodiment, the extraction of all boundary loops in the triangular mesh model based on the topological relationships of mesh data specifically includes: Traverse all triangular faces in the triangular mesh model and count the occurrences of each edge of the triangular face; each edge uses an ordered storage structure to ensure that the vertex indices are always arranged in ascending order; Edges that appear only once are selected as candidate edges for the boundary cycle; An undirected graph adjacency list is constructed using the vertices of candidate edges as nodes and the candidate edges as connections. Each vertex in the adjacency list records its adjacent vertices and maintains connection boundary information. The Depth-First Search (DFS) algorithm is used to extract boundary cycles: the traversal starts from the unvisited vertex with degree 1, and the candidate edges are visited sequentially along the adjacent vertices, and the visit history is recorded until the starting vertex is returned, forming a closed boundary cycle; if the traversal starts from a vertex with degree 1 and ends at another vertex with degree 1, it is recorded as an unclosed boundary cycle. Set a ring length threshold to filter out invalid boundary rings and unclosed boundary rings whose length does not meet the threshold; after traversing all candidate edges, retain all the obtained boundary rings.

[0026] The method proposed in this invention is geared towards industrial vision scenarios and requires high accuracy. Therefore, point cloud data with high-quality boundary features are selected for subsequent processing, and boundary loops that do not meet the conditions (including those lacking inner boundary information and those whose inner boundary loop length does not meet the threshold) need to be filtered out. Therefore, the application uses the aforementioned boundary loop closure and boundary loop length threshold to filter data, ensuring the accuracy of the target elliptical hole detection and fitting results.

[0027] Compare the number of vertices contained in all inner boundary rings, and use the inner boundary ring with the most vertices as the target elliptical hole contour, such as... Figure 3 As shown; Based on principal component analysis, an ellipse fitting operation is performed on the contour of the target elliptical hole. The three-dimensional point set of the target elliptical hole is obtained by back projection of the two-dimensional fitted ellipse, thereby achieving an accurate description of the shape and pose of the target elliptical hole. In a preferred embodiment, the step of performing an ellipse fitting operation on the target elliptical hole contour based on principal component analysis, and obtaining the three-dimensional point set of the target elliptical hole by back projection of the two-dimensional fitted ellipse, thereby achieving an accurate description of the shape and pose of the target elliptical hole, specifically includes: Calculate the centroid of the point cloud corresponding to the target elliptical hole contour, translate each point on the boundary to the centroid coordinate system for decentering, perform principal component analysis on the decentered point cloud, calculate the covariance matrix of the coordinates of each point after decentering, and obtain the main distribution direction of the points in the point cloud corresponding to the target elliptical hole contour. Solving the covariance matrix yields three eigenvectors representing the directions of the three principal components, and the corresponding eigenvalues ​​for each eigenvector. The eigenvectors are then denoted as follows, in descending order of their eigenvalues: The eigenvector PC1 of the first principal component direction represents the major axis direction of the target elliptical hole; The eigenvector PC2 of the second principal component direction represents the minor axis direction of the target elliptical hole; The eigenvector PC3 of the third principal component direction represents the normal vector of the target elliptical hole plane; The plane spanned by PC1 and PC2 is used as the optimal projection plane. The three-dimensional points on the inner boundary ring are projected onto the optimal projection plane. The projection coordinates of each point in the principal direction are calculated by dot product operation to obtain the two-dimensional projection point set.

[0028] The convex hull of the 2D projected point set is calculated to eliminate interference from concave portions or noise points at boundary points on the ellipse fitting; the 2D projected point set (shown as an ellipse line) and the obtained convex hull are as follows: Figure 4 As shown; The fitting ellipse for the target elliptical hole is calculated using a convex hull. An initial axis-aligned ellipse is obtained through the convex hull. The center coordinates, major axis length, and minor axis length of the initial axis-aligned ellipse are all calculated from the axial extrema of the convex hull on the optimal projection plane. Specifically: The center coordinates are determined by the midpoint of the extreme values ​​of the convex hull in the X and Y axes of the optimal projection plane, as expressed by the formula: ; in With the center coordinates, , Let be the maximum and minimum values ​​of the convex hull along the X-axis of the optimal projection plane, respectively. , These are the maximum and minimum values ​​of the convex hull along the Y-axis of the optimal projection plane, respectively. The length of the major axis and minor axis length It is then determined by half the difference between the extreme values ​​in the X and Y directions, as expressed by the formula: ; ; ; ; in, , These represent the semi-major axis length and the semi-minor axis length, respectively. The angle between the eigenvector PC1 of the first principal component direction and the X-axis of the optimal projection plane is used as the rotation angle of the initial axis-aligned ellipse. The specific calculation method for the angle is as follows: Obtain the projection of the eigenvector PC1 of the first principal component direction onto the optimal projection plane. Using the projected coordinates as input, the angle between PC1 and the X-axis of the optimal projection plane is solved using the two-parameter arctangent function. (In a standard right-handed coordinate system, this is a counter-clockwise angle) The rotation angle used as the initial axis to align the ellipse. The formula is expressed as: ; in, This represents the two-parameter arctangent function. , These are the X-axis and Y-axis coordinates of PC1 projected onto the optimal projection plane, respectively.

[0029] Get the included angle Then, combining the center coordinates, major axis length, and minor axis length obtained earlier, a fitted ellipse with aligned axes and correct orientation is finally obtained, such as... Figure 5 As shown; Parametric sampling is performed, generating N uniformly distributed sampling points on the optimal projection plane based on the elliptic parametric equation of the fitted ellipse, thus obtaining the two-dimensional point set and parametric equation of the target elliptical hole; the parametric equation is expressed as: ; ; in, The coordinates of a two-dimensional point representing the target elliptical hole; To ensure uniform sampling angle, the value range is... ; To make the comparison between the fitted ellipse and the target elliptical hole more intuitive, this application uses the inverse matrix of the transformation matrix (a matrix with PC1 and PC2 as columns) obtained from principal component analysis to backproject the two-dimensional point set of the target elliptical hole back into the original three-dimensional point cloud space. Then, through centroid coordinate offset, the three-dimensional point set of the target elliptical hole is obtained (also displayed as an elliptical line, such as...). Figure 6 Based on the parametric equations and back-projection transformation relationships mentioned above, the shape and pose of the target elliptical hole can be accurately determined.

[0030] The above complete technical process can be integrated into a complete processing pipeline, thereby realizing high-precision automatic identification and parameterized description of elliptical hole boundaries in 3D point clouds. It is particularly suitable for the quantitative analysis needs of features such as elliptical grooves and openings in fields such as industrial inspection, reverse engineering and computer vision.

[0031] In summary, the method proposed in this invention is highly automated, completing the entire process from target point cloud data to an elliptical model without manual intervention. It is applicable to fields such as 3D scanning data processing, industrial inspection, and computer vision. This implementation method can efficiently and accurately fit the elliptical boundaries in the point cloud, providing a reliable foundation for subsequent dimensional measurement, shape analysis, and quality control.

[0032] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0033] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. An automatic detection and fitting method for elliptical holes based on 3D point clouds, characterized in that, Specifically, the following steps are included: Manually select a point cloud region containing the target elliptical hole on a known 3D point cloud as the target point cloud region; load the target point cloud within the target point cloud region to initialize the target point cloud; Perform normal calculations on the initialized target point cloud, calculate the normal vector of each point, and obtain the target point cloud with normal information. Based on the target point cloud with normal information, a triangular mesh model of the target point cloud is reconstructed by a greedy projection triangulation algorithm. The triangular mesh model includes vertex information and polygon patch topology information. Extracting all boundary loops from the triangular mesh model based on the topological relationships of the mesh data; The obtained boundary rings are separated into inner and outer boundary rings. The boundary ring with the most vertices or the boundary ring with the largest enclosed area is identified as the outer boundary ring and discarded. The remaining boundary rings are identified as inner boundaries. Compare the number of vertices contained in all inner boundary rings, and use the inner boundary ring with the most vertices as the target elliptical hole contour. Based on principal component analysis, an ellipse fitting operation is performed on the contour of the target elliptical hole. The three-dimensional point set of the target elliptical hole is obtained by back-projection of the two-dimensional fitted ellipse, thereby achieving an accurate description of the shape and pose of the target elliptical hole.

2. The automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to claim 1, characterized in that, The initialization of the target point cloud includes integrity verification and format standardization.

3. The automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to claim 1, characterized in that, The step of performing normal calculation on the initialized target point cloud, calculating the normal vector of each point, and obtaining the target point cloud with normal information, specifically involves: For each point in the initialized target point cloud, search for its K nearest neighbors to form a neighbor set. Construct a local covariance matrix based on the neighbor set and calculate the eigenvalues ​​and eigenvectors of the local covariance matrix. Use the eigenvector corresponding to the smallest eigenvalue as the normal vector of that point. After calculating the normal vectors of all points, unify the orientation of each normal vector through viewpoint consistency or normal repair to finally obtain the target point cloud with normal information.

4. The automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to claim 1, characterized in that, The extraction of all boundary loops in the triangular mesh model based on the topological relationships of mesh data specifically includes: Traverse all triangular faces in the triangular mesh model and count the occurrences of each edge of the triangular face; each edge uses an ordered storage structure to ensure that the vertex indices are always arranged in ascending order; Edges that appear only once are selected as candidate edges for the boundary cycle; An undirected graph adjacency list is constructed using the vertices of candidate edges as nodes and the candidate edges as connections. Each vertex in the adjacency list records its adjacent vertices and maintains connection boundary information. The Depth-First Search (DFS) algorithm is used to extract boundary cycles: the traversal starts from the unvisited vertex with degree 1, and the candidate edges are visited sequentially along the adjacent vertices, and the visit history is recorded until the starting vertex is returned, forming a closed boundary cycle; if the traversal starts from a vertex with degree 1 and ends at another vertex with degree 1, it is recorded as an unclosed boundary cycle. Set a ring length threshold to filter out invalid boundary rings and unclosed boundary rings whose length does not reach the threshold; after traversing all candidate edges, retain all the obtained boundary rings.

5. The automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to claim 1, characterized in that, The method based on principal component analysis involves performing an ellipse fitting operation on the contour of the target elliptical hole, and obtaining the three-dimensional point set of the target elliptical hole by back projection of the two-dimensional fitted ellipse, thereby achieving an accurate description of the shape and pose of the target elliptical hole. Specifically, this includes: Calculate the centroid of the point cloud corresponding to the elliptical hole contour of the target, translate each point on the boundary to the centroid coordinate system for decentering, perform principal component analysis on the decentered point cloud, and calculate the covariance matrix of the coordinates of each point after decentering. Solving the covariance matrix yields three eigenvectors representing the directions of the three principal components, and the corresponding eigenvalues ​​for each eigenvector. The eigenvectors are then denoted as follows, in descending order of their eigenvalues: The eigenvector PC1 of the first principal component direction represents the major axis direction of the target elliptical hole; The eigenvector PC2 of the second principal component direction represents the minor axis direction of the target elliptical hole; The eigenvector PC3 of the third principal component direction represents the normal vector of the target elliptical hole plane; The plane spanned by PC1 and PC2 is used as the optimal projection plane. The three-dimensional points on the inner boundary ring are projected onto the optimal projection plane. The projection coordinates of each point in the principal direction are calculated by dot product operation to obtain the two-dimensional projection point set. Calculate the convex hull of the two-dimensional projection point set, use the convex hull to calculate the fitted ellipse of the target elliptical hole, and obtain an initial axis-aligned ellipse through the convex hull. The center coordinates, major axis length, and minor axis length of the initial axis-aligned ellipse are all calculated from the axial extrema of the convex hull on the optimal projection plane. Using the angle between the eigenvector PC1 of the first principal component direction and the X-axis of the optimal projection plane as the initial axis, the rotation angle of the ellipse is aligned to obtain a fitted ellipse with the correct orientation. Parametric sampling is performed, and N uniformly distributed sampling points are generated on the optimal projection plane according to the elliptic parametric equation of the fitted ellipse, so as to obtain the two-dimensional point set and parametric equation of the target elliptical hole. Based on the inverse of the transformation matrix obtained from principal component analysis, the two-dimensional point set of the target elliptical hole is back-projected back into the original three-dimensional point cloud space. Then, through centroid coordinate offset, the three-dimensional point set of the target elliptical hole is obtained, thereby determining the shape and pose of the target elliptical hole.

6. The automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to claim 5, characterized in that, The center coordinates, major axis length, and minor axis length of the initial axis-aligned ellipse are all calculated from the axial extrema of the convex hull on the optimal projection plane, specifically as follows: The center coordinates are determined by the midpoint of the extreme values ​​of the convex hull in the X and Y axes of the optimal projection plane, as expressed by the formula: ; in With the center coordinates, , Let be the maximum and minimum values ​​of the convex hull along the X-axis of the optimal projection plane, respectively. , These are the maximum and minimum values ​​of the convex hull along the Y-axis of the optimal projection plane, respectively. The length of the major axis and minor axis length It is then determined by half the difference between the extreme values ​​in the X and Y directions, as expressed by the formula: ; ; ; ; in, , These represent the semi-major axis length and the semi-minor axis length, respectively.

7. The automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to claim 5, characterized in that, The rotation angle of the ellipse aligned with the first principal component direction eigenvector PC1 and the X-axis of the optimal projection plane as the initial axis is specifically as follows: Obtain the projection of the eigenvector PC1 of the first principal component direction onto the optimal projection plane. Using the projected coordinates as input, the angle between PC1 and the X-axis of the optimal projection plane is solved using the two-parameter arctangent function. The rotation angle used as the initial axis to align the ellipse, the included angle The formula is expressed as: ; in, This represents the two-parameter arctangent function. , These are the X-axis and Y-axis coordinates of PC1 projected onto the optimal projection plane, respectively.

8. The application system of the automatic detection and fitting method for elliptical holes based on three-dimensional point clouds according to any one of claims 1-7, characterized in that, Specifically, it includes: The module includes a data processing module, a mesh processing module, a boundary extraction module, and an ellipse fitting module, among which: The data processing module is used to select the target point cloud region and calculate the target point cloud normal information; The mesh processing module is used to reconstruct a triangular mesh model of a target point cloud with normal information using a greedy projection triangulation method. The boundary extraction module is used to extract the inner boundary ring from the triangular mesh model and filter out the target elliptical hole contour from the inner boundary ring. The ellipse fitting module includes a PCA analysis module, a point cloud projection module, a convex hull calculation module, a parameter calculation module, a fitting generation module, and a back projection module, which are used to perform ellipse fitting on the contour of the target elliptical hole to obtain the precise shape and pose of the target elliptical hole.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor, wherein: Memory is used to store computer programs that can run on a processor; A processor is configured to, when running the computer program, execute the automatic detection and fitting method for elliptical holes based on three-dimensional point clouds as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the automatic detection and fitting method for elliptical holes based on three-dimensional point clouds as described in any one of claims 1-7.