A 3D vision guidance-based self-tool setting method for a numerical control machine tool

CN121132514BActive Publication Date: 2026-10-09CHONGQING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511434186.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2025-06-28
Filing Date
2025-10-09
Publication Date
2026-10-09
Estimated Expiration
2045-10-09

AI Technical Summary

Technical Problem

[0002]传统数控磨床对刀技术普遍依赖人工试切法或接触式传感器检测,其中,人工试切法高度依赖操作人员的经验,不仅效率低下,而且精度容易受到主观因素的影响;接触式传感器检测虽然可以提高一定的测量精度,但由于机械磨损的存在,其精度会随时间逐渐衰减,并且在高温高速的工况下难以保持稳定性能

Benefits of technology

[0020] In summary, the present invention has the advantages of automatically measuring the relative positional relationship between the workpiece and the cutting tool during the machining process, completing autonomous and rapid tool setting, and ensuring machining quality and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121132514B_ABST
    Figure CN121132514B_ABST
Patent Text Reader

Abstract

The application discloses a kind of numerical control machine tool self-guiding tool setting methods based on 3D vision.First, the three-dimensional point cloud data of tool and workpiece are collected using 3D vision sensor and preprocessed;Subsequently, the point cloud is segmented by region growing algorithm, the separation of tool point cloud and workpiece point cloud is realized, and the point cloud of each cylindrical section of workpiece is extracted.Next, based on cylindrical fitting algorithm, the cylindrical model fitting of segmented tool and workpiece point cloud is carried out, and the geometric parameters such as axis direction, radius and center coordinates are obtained.According to the relative position relationship between tool and workpiece, the tool setting path is generated and converted into NC code.Finally, the NC code is transmitted to the grinding machine control system through the grinding machine communication module, and the tool setting operation is completed.The application has the advantages of automatically measuring the relative position relationship between workpiece and tool during machining, completing self-guiding tool setting, ensuring machining quality and efficiency, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine tool technology, and in particular to a method for autonomous tool setting of CNC machine tools based on 3D vision guidance. Background Technology

[0002] Traditional CNC grinding machine tool setting technology generally relies on manual trial cutting or contact sensor detection. Among them, manual trial cutting is highly dependent on the operator's experience, which is not only inefficient, but also easily affected by subjective factors. Although contact sensor detection can improve the measurement accuracy to a certain extent, its accuracy will gradually decrease over time due to mechanical wear, and it is difficult to maintain stable performance under high temperature and high speed conditions.

[0003] Although non-contact tool setting technology developed in recent years has achieved preliminary automation through laser or 2D vision inspection, it still has obvious limitations in the recognition of geometric features of complex workpieces: 2D vision systems cannot obtain 3D spatial pose information, while conventional 3D vision technology is easily affected by point cloud noise when processing multi-segment cylindrical features, resulting in inaccurate feature segmentation. Furthermore, existing region growing algorithms are prone to missegmentation in stepped transition regions, affecting the accuracy of cylinder parameter fitting and making it difficult to meet the micron-level tool setting requirements of high-precision grinding. Summary of the Invention

[0004] In view of the shortcomings of the prior art, the technical problem to be solved by the present invention is: how to provide a CNC machine tool autonomous tool setting method that can automatically measure the relative positional relationship between the workpiece and the tool during the machining process, complete autonomous and rapid tool setting, and ensure machining quality and efficiency.

[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A method for autonomous tool setting of CNC machine tools based on 3D vision guidance includes the following steps: S1. Acquire three-dimensional point cloud data of the tool and workpiece through a 3D vision sensor, and preprocess the three-dimensional point cloud data. S2. The processed 3D point cloud data is segmented using a region growing algorithm to separate the tool point cloud from the workpiece point cloud and extract the point cloud of each cylindrical segment of the workpiece. S3. The cylindrical fitting algorithm is used to fit the segmented tool point cloud and workpiece point cloud to a cylindrical model to obtain the geometric parameters of the tool and workpiece, including the axial direction, radius and center coordinates. S4. Calculate the relative positional relationship between the tool and the workpiece based on the geometric parameters of the tool and the workpiece, generate the tool setting path and convert it into NC code; S5. The NC code is transmitted to the grinding machine control system through the grinding machine communication module to perform the tool setting operation.

[0006] The method described above utilizes a 3D vision sensor to acquire 3D point cloud data of the tool and workpiece, and preprocesses the point cloud to remove noise. Then, a region growing algorithm is used to segment the point cloud, effectively separating the tool and workpiece regions and extracting the point cloud of each cylindrical segment of the workpiece. Next, cylindrical fitting is performed on the segmented point cloud to accurately obtain the geometric parameters of the tool and workpiece, including axial direction, radius, and center coordinates. Based on these parameters, the method can accurately calculate the relative positional relationship between the tool and workpiece and generate the corresponding tool setting path, which is then converted into NC code. Finally, the NC code is sent to the grinding machine control system via a communication module to achieve automatic tool setting. This process improves the tool setting accuracy and automation level of CNC machine tools, reduces manual intervention, and increases machining efficiency.

[0007] Furthermore, in step S2, the step of segmenting the point cloud using a region growing algorithm is as follows: S21. Perform normal estimation and curvature calculation on the point cloud data; S22. Determine the 3D bounding box of the point cloud, and divide the 3D bounding box into multiple voxel units at equal intervals along the x, y, and z axes according to the preset mesh resolution r. S23. For each voxel element, select the point with the smallest curvature as the seed point of that voxel element and assign a category identifier. S24. For each point with an assigned category label, check all k nearest neighbors of that point, and identify those without a category label and with curvature. Below the preset threshold The points are added to the current region and assigned the same category identifier until the region stops growing; S25. Based on the segmentation results, separate the tool point cloud and the workpiece point cloud, and extract the point cloud of each cylindrical segment of the workpiece.

[0008] In this way, by dividing the point cloud into 3D bounding boxes and generating voxel units, and selecting the point with the minimum curvature within each voxel, the uniform spatial distribution of seed points is ensured. Next, for each labeled seed point, its nearest neighbors are checked sequentially. Points with curvature below a threshold and not yet labeled are added to the region and assigned the same label, until the region expansion is complete. This strategy effectively improves the accuracy of segmentation in flat regions and boundaries, reduces the probability of redundant computation and missegmentation, and enhances the method's adaptability to different geometric features.

[0009] Furthermore, in step S24, after each region stops growing, if the number of points in that region is less than the preset minimum clustering size, the category label of that region is canceled, and all points in that region are set to an unlabeled state.

[0010] This ensures that each region in the final output is sufficiently representative, thereby improving the quality of the segmentation results.

[0011] Furthermore, in step S21, for each point of the point cloud data... The k-NN algorithm is used to search for and select the k nearest neighbors from the neighborhood. And calculate the covariance matrix of the neighborhood points. covariance matrix The definition is as follows: in, It is the mean of the neighborhood points: For covariance matrix Eigenvalue decomposition yields three eigenvalues. , Then point The direction of the normal is: point The curvature is: in, It is the smallest eigenvalue of the covariance matrix. It is the sum of the eigenvalues ​​of the covariance matrix. Minimum eigenvalue Relevant feature vectors.

[0012] Furthermore, in step S3, the cylindrical model M is defined in the point cloud set P as follows: Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector of unit length, r represents the radius of the cylinder, and h represents the height of the cylinder; When fitting the cylindrical model, the RANSAC algorithm is used to iteratively search for the optimal model parameters. In each iteration, a preliminary cylindrical model is calculated based on randomly selected sample points. In the preliminary cylindrical model In the middle, traverse the point cloud data and calculate any point Distance to the surface of the cylinder satisfy: In the formula, Point The projected length to the axis. Represents the perpendicular distance from the point to the axis, where r is the radius of the cylinder; if Less than the preset threshold Then the point If a point is determined to be an interior point, then the set of interior points is obtained. for: After iteration, the model with the most interior points is selected as the optimal solution.

[0013] Thus, by introducing an interior point detection mechanism based on the distance from a point to the surface of the cylindrical model into the RANSAC algorithm, the robustness and accuracy of fitting the cylindrical model are effectively improved. This mechanism uses geometric distance as a criterion to ensure that the set of interior points only contains points that truly conform to the characteristics of a cylinder, significantly reducing the interference of outliers on the fitting results and enhancing model stability.

[0014] Furthermore, the set of interior points any point in The normal is The expected normal vector of the model at this point is The cosine similarity between the two for: Establish point The scoring function is: In the formula, Point The rating; is the consistency weight coefficient for the normal vector direction, within the interval [0, 1]. For point The distance to the surface of the cylinder; From the set of interior points Points with scores below the preset value will be deleted, and the inlier set will be updated. And after the iteration is complete, based on the updated set of interior points... The model with the most interior points is selected as the optimal solution.

[0015] In this way, by introducing a normal vector consistency weighting mechanism, the geometric distance error and the normal vector direction consistency are jointly optimized, so as to maintain high fitting accuracy under noise interference and exhibit stronger robustness.

[0016] Furthermore, in step S1, the preprocessing includes depth threshold filtering of the point cloud data, the steps of which are as follows: S11. Define a 3D point cloud dataset containing n points as follows: any point The coordinates are , Depth information represents points Distance to the reference plane; extract depth information from all points to form a depth vector. ,in , indicating a point The absolute depth value; S12. Construct a vector containing the z-coordinates of all points. And calculate the sample mean of vector z. and sample standard deviation , respectively represented as: In the formula, This represents the average depth of the dataset along the Z-axis. This indicates the degree of dispersion of data points around the average depth; S13. Based on the sample mean and sample standard deviation Linear combination defines dynamic depth threshold for: In the formula, k is an adjustable constant factor used to control the offset of the threshold relative to the average depth. S14. Based on the dynamic depth threshold A binarization mask was constructed. If point absolute depth value ,but and the point Remove from 3D point cloud data, otherwise Keep this point .

[0017] In this way, by employing dynamic depth threshold filtering based on statistical characteristics, the computation only involves calculating the mean and standard deviation. Even with large-scale point cloud datasets, this ensures rapid data processing, thereby improving real-time processing capabilities and saving valuable computational resources for subsequent data analysis and modeling. Simultaneously, it exhibits good robustness and stability, providing consistent and reliable results when handling scenes with well-defined depth boundaries.

[0018] Furthermore, in step S1, after depth threshold filtering, the 3D point cloud data undergoes noise reduction processing, as follows: S15. Determine any point in the point cloud data. neighborhood The global mean of the average distance of all points within the area and standard deviation for: In the formula, and Representing points respectively The average location within its neighborhood and the standard deviation of its location distribution, where k is the number of points. The number of neighboring points, For point k neighborhood points to point average distance, For point To neighboring points Euclidean distance; S16, Determine the point Standardized distance between it and the mean of its neighborhood for: If point of If the value exceeds the preset threshold, then the point will be... Remove from 3D point cloud data.

[0019] Furthermore, in step S1, after noise reduction, an adaptive downsampling algorithm based on grid acceleration Poisson disk sampling is used. The specific steps are as follows: S17. Divide the point cloud space into a regular three-dimensional mesh structure to ensure that each mesh cell of the three-dimensional mesh structure can only contain one sampling point; map the spatial coordinates of each point to the mesh index of the mesh cell, and use the mesh index of the mesh cell as the key and the point stored in the mesh cell as the value to store it as a sparse hash table structure. S18. Dynamically adjust the sampling radius based on the local density features of point clouds. for: For point Local density, This is the proportionality coefficient. For point The average distance to the k nearest neighbors; S19. Use hash table indexes to accelerate neighborhood queries and generate a uniform set of sampling points that satisfy the minimum distance constraint.

[0020] In summary, the present invention has the advantages of automatically measuring the relative positional relationship between the workpiece and the cutting tool during the machining process, completing autonomous and rapid tool setting, and ensuring machining quality and efficiency. Attached Figure Description

[0021] Figure 1 This is for DSDTF filtering effects on point clouds.

[0022] Figure 2 This is a schematic diagram of the statistical filtering effect on point clouds.

[0023] Figure 3 This is a schematic diagram of point cloud data hash mapping.

[0024] Figure 4 A schematic diagram illustrating the effect of downsampling the point cloud of the workpiece.

[0025] Figure 5 This is a schematic diagram illustrating the overall point cloud downsampling effect.

[0026] Figure 6 The effect of parameter values ​​on segmentation results.

[0027] Figure 7 This is a comparison of the segmentation results of the algorithm of this invention with other point cloud segmentation algorithms.

[0028] Figure 8 This is a diagram showing the results of a noise test.

[0029] Figure 9 This is a visualization diagram of the point cloud normal vectors.

[0030] Figure 10 This is a schematic diagram of a cylindrical triangular mesh.

[0031] Figure 11 This is a diagram illustrating the comparison of fitting results.

[0032] Figure 12 This is a schematic diagram showing the fitting results for different noise levels. Detailed Implementation

[0033] The present invention will be further described in detail below with reference to embodiments. A method for autonomous tool setting of CNC machine tools based on 3D vision guidance includes the following steps: S1. Acquire three-dimensional point cloud data of the tool and workpiece through a 3D vision sensor, and preprocess the three-dimensional point cloud data. S2. The processed 3D point cloud data is segmented using a region growing algorithm to separate the tool point cloud from the workpiece point cloud and extract the point cloud of each cylindrical segment of the workpiece. S3. The cylindrical fitting algorithm is used to fit the segmented tool point cloud and workpiece point cloud to a cylindrical model to obtain the geometric parameters of the tool and workpiece, including the axial direction, radius and center coordinates. S4. Calculate the relative positional relationship between the tool and the workpiece based on the geometric parameters of the tool and the workpiece, generate the tool setting path and convert it into NC code; S5. The NC code is transmitted to the grinding machine control system through the grinding machine communication module to perform the tool setting operation.

[0034] The method described above utilizes a 3D vision sensor to acquire 3D point cloud data of the tool and workpiece, and preprocesses the point cloud to remove noise. Then, a region growing algorithm is used to segment the point cloud, effectively separating the tool and workpiece regions and extracting the point cloud of each cylindrical segment of the workpiece. Next, cylindrical fitting is performed on the segmented point cloud to accurately obtain the geometric parameters of the tool and workpiece, including axial direction, radius, and center coordinates. Based on these parameters, the method can accurately calculate the relative positional relationship between the tool and workpiece and generate the corresponding tool setting path, which is then converted into NC code. Finally, the NC code is sent to the grinding machine control system via a communication module to achieve automatic tool setting. This process improves the tool setting accuracy and automation level of CNC machine tools, reduces manual intervention, and increases machining efficiency.

[0035] In step S2, the point cloud segmentation using the region growing algorithm is as follows: S21. Perform normal estimation and curvature calculation on the point cloud data; S22. Determine the 3D bounding box of the point cloud, and divide the 3D bounding box into multiple voxel units at equal intervals along the x, y, and z axes according to the preset mesh resolution r. S23. For each voxel element, select the point with the smallest curvature as the seed point of that voxel element and assign a category identifier. S24. For each point with an assigned category label, check all k nearest neighbors of that point, and identify those without a category label and with curvature. Below the preset threshold The points are added to the current region and assigned the same category identifier until the region stops growing; S25. Based on the segmentation results, separate the tool point cloud and the workpiece point cloud, and extract the point cloud of each cylindrical segment of the workpiece.

[0036] The above steps involve dividing the point cloud into 3D bounding boxes and generating voxel units. By selecting the point with the minimum curvature within each voxel, a uniform spatial distribution of seed points is ensured. Next, for each labeled seed point, its nearest neighbors are checked sequentially. Points with curvature below a threshold and not yet labeled are added to the region and assigned the same label, until the region expansion is complete. This strategy effectively improves the accuracy of segmentation in flat regions and boundaries, reduces the probability of redundant calculations and missegmentation, and enhances the method's adaptability to different geometric features.

[0037] In step S24, after each region stops growing, if the number of points in that region is less than the preset minimum clustering size, the category label of that region is canceled and all points in that region are set to an unlabeled state.

[0038] This ensures that each region in the final output is sufficiently representative, thereby improving the quality of the segmentation results.

[0039] In step S21, for each point of the point cloud data The k-NN algorithm is used to search for and select the k nearest neighbors from the neighborhood. And calculate the covariance matrix of the neighborhood points. covariance matrix The definition is as follows: in, It is the mean of the neighborhood points: For covariance matrix Eigenvalue decomposition yields three eigenvalues. , Then point The direction of the normal is: point The curvature is: in, It is the smallest eigenvalue of the covariance matrix. It is the sum of the eigenvalues ​​of the covariance matrix. Minimum eigenvalue Relevant feature vectors.

[0040] In step S3, the cylindrical model M is defined in the point cloud set P as follows: Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector of unit length, r represents the radius of the cylinder, and h represents the height of the cylinder; When fitting the cylindrical model, the RANSAC algorithm is used to iteratively search for the optimal model parameters. In each iteration, a preliminary cylindrical model is calculated based on randomly selected sample points. In the preliminary cylindrical model In the middle, traverse the point cloud data and calculate any point Distance to the surface of the cylinder satisfy: In the formula, Point The projected length to the axis. Represents the perpendicular distance from the point to the axis, where r is the radius of the cylinder; if Less than the preset threshold Then the point If a point is determined to be an interior point, then the set of interior points is obtained. for: After iteration, the model with the most interior points is selected as the optimal solution.

[0041] Thus, by introducing an interior point detection mechanism based on the distance from a point to the surface of the cylindrical model into the RANSAC algorithm, the robustness and accuracy of fitting the cylindrical model are effectively improved. This mechanism uses geometric distance as a criterion to ensure that the set of interior points only contains points that truly conform to the characteristics of a cylinder, significantly reducing the interference of outliers on the fitting results and enhancing model stability.

[0042] Interior point set any point in The normal is The expected normal vector of the model at this point is The cosine similarity between the two for: Establish point The scoring function is: In the formula, Point The rating; is the consistency weight coefficient for the normal vector direction, within the interval [0, 1]. For point The distance to the surface of the cylinder; From the set of interior points Points with scores below the preset value will be deleted, and the inlier set will be updated. And after the iteration is complete, based on the updated set of interior points... The model with the most interior points is selected as the optimal solution.

[0043] In this way, by introducing a normal vector consistency weighting mechanism, the geometric distance error and the normal vector direction consistency are jointly optimized, so as to maintain high fitting accuracy under noise interference and exhibit stronger robustness.

[0044] In step S1, the preprocessing includes depth threshold filtering of the point cloud data, and the steps are as follows: S11. Define a 3D point cloud dataset containing n points as follows: any point The coordinates are , Depth information represents points Distance to the reference plane; extract depth information from all points to form a depth vector. ,in , indicating a point The absolute depth value; S12. Construct a vector containing the z-coordinates of all points. And calculate the sample mean of vector z. and sample standard deviation , respectively represented as: In the formula, This represents the average depth of the dataset along the Z-axis. This indicates the degree of dispersion of data points around the average depth; S13. Based on the sample mean and sample standard deviation Linear combination defines dynamic depth threshold for: In the formula, k is an adjustable constant factor used to control the offset of the threshold relative to the average depth. S14. Based on the dynamic depth threshold A binarization mask was constructed. If point absolute depth value ,but and the point Remove from 3D point cloud data, otherwise Keep this point .

[0045] In this way, by employing dynamic depth threshold filtering based on statistical characteristics, the computation only involves calculating the mean and standard deviation. Even with large-scale point cloud datasets, this ensures rapid data processing, thereby improving real-time processing capabilities and saving valuable computational resources for subsequent data analysis and modeling. Simultaneously, it exhibits good robustness and stability, providing consistent and reliable results when handling scenes with well-defined depth boundaries.

[0046] In step S1, after depth threshold filtering, the 3D point cloud data undergoes noise reduction processing, as follows: S15. Determine any point in the point cloud data. neighborhood The global mean of the average distance of all points within the area and standard deviation for: In the formula, and Representing points respectively The average location within its neighborhood and the standard deviation of its location distribution, where k is the number of points. The number of neighboring points, For point k neighborhood points to point average distance, For point To neighboring points Euclidean distance; S16, Determine the point Standardized distance between it and the mean of its neighborhood for: If point of If the value exceeds the preset threshold, then the point will be... Remove from 3D point cloud data.

[0047] Furthermore, in step S1, after noise reduction, an adaptive downsampling algorithm based on grid acceleration Poisson disk sampling is used. The specific steps are as follows: S17. Divide the point cloud space into a regular three-dimensional mesh structure to ensure that each mesh cell of the three-dimensional mesh structure can only contain one sampling point; map the spatial coordinates of each point to the mesh index of the mesh cell, and use the mesh index of the mesh cell as the key and the point stored in the mesh cell as the value to store it as a sparse hash table structure. S18. Dynamically adjust the sampling radius based on the local density features of point clouds. for: For point Local density, This is the proportionality coefficient. For point The average distance to the k nearest neighbors; S19. Use hash table indexes to accelerate neighborhood queries and generate a uniform set of sampling points that satisfy the minimum distance constraint.

[0048] To better illustrate the method of this invention, the following section provides a more detailed explanation of the complete process of the autonomous tool setting method for high-speed CBN grinding machines based on 3D structured light guidance.

[0049] The autonomous tool setting method for high-speed CBN grinding machines based on 3D structured light guidance mainly includes point cloud data preprocessing and adaptive sampling, multi-starting point cloud segmentation based on curvature and normal estimation, and cylinder model fitting and 3D reconstruction.

[0050] The point cloud data preprocessing and adaptive sampling includes point cloud data acquisition, point cloud data depth threshold filtering, point cloud data filtering and noise reduction, and adaptive mesh-accelerated Poisson disk sampling.

[0051] Point cloud data acquisition: Due to the unavoidable presence of various interference factors in the actual measurement environment, such as sensor noise, changes in environmental reflection characteristics, and non-ideal measurement conditions, the acquired point cloud data often contains noisy points and outliers. The original dataset is usually large in scale, and direct processing will consume a lot of computing resources and may reduce the accuracy and efficiency of subsequent processing steps.

[0052] The fundamental principle of point cloud data acquisition involves capturing three-dimensional spatial information of an object or environment using various sensors or measuring devices. This process typically relies on the fusion of knowledge from multiple disciplines, including geometric optics, physics, and computer science. Point cloud data refers to a dataset consisting of a series of discrete points, each representing a position coordinate on the surface of a target object. Furthermore, it may include attribute information such as color and reflectivity. Acquiring such a dataset involves passively or actively sensing the surrounding environment through sensors and converting the obtained information into a digital format.

[0053] The specific objects in this embodiment are stepped shaft parts and CBN grinding wheels. Their geometric characteristics require the measurement system to not only provide high-resolution spatial morphology information, but also to achieve an optimal balance between accuracy and efficiency within a short measurement range. Therefore, the Mech-Eye PRO S high-precision structured light industrial 3D camera based on structured light scanning technology was selected as the primary measurement tool.

[0054] Point cloud data depth threshold filtering: During 3D scanning using a structured light camera, the acquired point cloud data includes not only the point cloud data related to the target workpiece but also point cloud information from the background environment. To ensure the accuracy and efficiency of subsequent point cloud processing steps, it is necessary to remove the background point cloud data to purify the point cloud dataset and retain only the point cloud data of the workpiece itself.

[0055] Dynamic depth percentile thresholding is an effective method for processing 3D point cloud data for object separation in complex scenes. Consider a 3D point cloud dataset containing n points. , where each point It consists of three coordinate values, each representing the point's position in three-dimensional space. Specifically, The value reflects the distance from the point to the reference plane, i.e., depth information. To determine a suitable depth threshold, depth information needs to be extracted from all points to form a depth vector. ,in This represents the absolute depth value of each point. Based on this, a key parameter, percentile p, is introduced, with a value range of [0, 100], to define the percentage of points in the dataset expected to be included within a threshold range. Using the statistical principle of percentile calculation, a depth threshold can be calculated. This threshold ensures that at least p% of the points in the dataset have a depth less than or equal to it. The depth threshold is calculated based on this value. Construct a binary mask m, whose elements According to the point depth With threshold The relationship is assigned different values: if ,but This indicates that the depth of the point exceeds the threshold and it is not considered an object of interest; conversely, if... ,but This indicates that the point falls within the threshold range and is part of the target object. This process effectively achieves object separation and filtering based on depth information.

[0056] Dynamic Statistical Depth Threshold Filtering (DSDTF) aims to effectively focus on structures within a specific depth range. A vector is constructed. This vector contains the z-coordinates of all points in the dataset. To quantify the central tendency and dispersion of the dataset, the sample mean of z was calculated. and sample standard deviation The results are obtained using the following formulas: (1) (2) in, This describes the average depth of the dataset along the Z-axis, while This measures the dispersion of data points around the average depth. Based on the above statistics, a dynamic depth threshold is set. This threshold is defined by a linear combination of the mean and the standard deviation, specifically in the form: (3) Here, k is an adjustable constant factor used to control the offset of the threshold relative to the average depth, which can be adjusted according to the needs of the actual application scenario. A binary mask is constructed using this depth threshold. By retaining the satisfaction The point that is not satisfied can be deleted. The points are used to update the point cloud, resulting in a filtered point cloud, such as... Figure 1 As shown.

[0057] From a computational efficiency perspective, DSDTF demonstrates a clear advantage over other complex algorithms. The core computations of this method only involve calculating the mean and standard deviation, with a time complexity of O(n log n). This means linear time complexity, ensuring fast data processing even with large-scale point cloud datasets, thus improving real-time processing capabilities and saving valuable computational resources for subsequent data analysis and modeling. The DSDTF method exhibits good robustness and stability, providing consistent and reliable results when handling scenes with well-defined depth boundaries. Since it does not require data sorting, it further reduces the computational burden. The method has a certain tolerance for a small number of outliers, ensuring the accuracy and reliability of the output results, making DSDTF an efficient and stable choice for processing such point cloud data.

[0058] Noise Reduction and Filtering for Point Cloud Data: In the field of point cloud data processing, due to limitations of measurement equipment, inherent noise characteristics of sensors, and interference from external environmental factors, the acquired data often contains outliers. If these outliers are not processed, they will significantly impact subsequent data processing tasks, reducing the accuracy and reliability of the results. Noise reduction and filtering can effectively remove noise points and outliers from point cloud data, thereby improving the overall accuracy and efficiency of data processing.

[0059] In this embodiment, to improve the quality and reliability of point cloud data and increase processing efficiency, a statistical filter method is used to identify and remove outliers. The process is as follows: For any point in the point cloud Define its neighborhood That is, the point containing The set of the k nearest surrounding points. Definition To its neighboring points The Euclidean distance is: (4) For point Calculate the average distance from its neighboring points to the point: (5) For each point, calculate the global mean of the average distances to all points in its neighborhood. and standard deviation : (6) (7) in, and Representing points respectively The average location within its neighborhood and the standard deviation of its location distribution.

[0060] To effectively identify outliers, a standard ratio is introduced. The indicator is used to measure points. The standardized distance between it and the mean of its neighborhood is calculated as follows: (8) when If the value exceeds a preset threshold, the point is considered an anomaly and removed from the original point cloud.

[0061] A fixed standard deviation of 1 was used, and the noise reduction effect was examined for a neighborhood search number of 20 to 100 (step size of 20).

[0062] Table 1 Statistical Filtering Noise Reduction Statistics As shown in Figure 1, the experimental results indicate that the noise reduction effect exhibits a diminishing marginal effect as the number of neighborhood search points increases. When the number of neighborhood search points increases from 20 to 60, the number of noise points removed decreases significantly from 11,922 to 8,237; however, when the number of neighborhood search points continues to increase to 100, the number of noise points removed only decreases slightly from 8,237 to 8,081. Considering the balance between noise reduction effect and detail preservation, this embodiment ultimately selects 60 neighborhood search points and a standard deviation of 1 as the optimal parameter combination.

[0063] Through statistical filtering, the workpiece point cloud data was significantly optimized, reducing the number of points from the initial 78,848 to 70,611, removing 8,237 noise points. The overall point cloud data reduced the number of points from 131,003 to 114,026, removing 16,977 noise points. The filtering effect is shown in Figure 2. This preprocessing method not only effectively reduces noise interference and improves the signal-to-noise ratio of the data, but also lays a reliable data foundation for subsequent advanced processing tasks such as point cloud segmentation and model fitting. Experimental results show that this method can significantly improve the accuracy and robustness of downstream tasks.

[0064] Adaptive Mesh Acceleration of Poisson Disk Sampling: Point cloud downsampling aims to optimize data representation to improve computational efficiency and processing accuracy. By reducing the number of points, downsampling not only significantly reduces computational complexity and accelerates data processing, but also eliminates redundant information in high-density regions, making the dataset more compact and representative, thereby enhancing the effectiveness and accuracy of subsequent analysis. A well-planned downsampling strategy can reduce the impact of noise and outliers while preserving key geometric structures, improving the quality of 3D reconstruction and ensuring that the model can smoothly and accurately reflect the true shape of the measured object. The core objective of point cloud downsampling is to construct an optimized data representation that faithfully reflects the characteristics of the original data while effectively supporting advanced processing tasks.

[0065] Poisson disk sampling is an advanced downsampling method designed to balance uniformity and feature preservation. Classical Poisson disk sampling algorithms (such as the dart-throwing method and grid culling) face numerous challenges in practical applications, particularly regarding computational complexity and adaptability. Their global search mechanism often results in time complexity exceeding [a certain threshold]. When processing large-scale point cloud data, these algorithms suffer from a significant decrease in efficiency. They typically assume a fixed distance between sampling points, failing to dynamically respond to changes in local density within the point cloud. This assumption leads to redundant sampling in high-density areas and insufficient sampling in low-density areas, thus affecting the accurate capture of geometric features. To ensure that candidate points meet the minimum distance requirement with selected sampling points, traditional methods require numerous distance checks, which not only further increases computational overhead but also limits the flexibility of spatial distribution.

[0066] To address the aforementioned issues, this embodiment applies mesh acceleration and adaptive strategies to Poisson disk sampling, proposing an improved point cloud downsampling algorithm. This algorithm focuses on improving computational efficiency, enhancing adaptability to non-uniform point clouds, and optimizing sampling quality while preserving geometric features. The core innovation of this algorithm lies in introducing dynamically adjusted sampling radii and mesh acceleration techniques, achieving efficient discretization of the point cloud space and rapid verification of candidate point neighborhood constraints. The algorithm divides the point cloud space into a regular mesh and combines it with a hash table to construct a fast indexing mechanism, thereby significantly reducing the space complexity of traditional algorithms and avoiding the computational bottleneck caused by global search.

[0067] Specifically, to address the complex density distribution in point clouds, this embodiment designs an adaptive radius dynamic adjustment model based on local density statistics. This model establishes a radius evaluation mechanism that can respond in real-time to changes in local geometric features by mathematically analyzing the nearest neighbor distance distribution of the point cloud. Compared with traditional fixed-radius methods, this adaptive model effectively alleviates the oversampling problem in high-density regions and the undersampling problem in low-density regions, achieving a dynamic balance between uniformity and feature preservation.

[0068] In terms of candidate point generation strategy, this embodiment adopts an innovative method based on spherical orientation pre-generation. By uniformly distributing orientation vectors on a unit sphere, it provides a candidate point generation method with determinism and controllability, thereby optimizing the spatial distribution characteristics of Poisson disk sampling.

[0069] To improve the robustness of sampling results and the quality control of point clouds, this embodiment also introduces a multi-dimensional outlier handling mechanism. By combining global statistical characteristics with local geometric constraints and employing a dynamic threshold discrimination strategy, isolated points and noise points are effectively identified and eliminated. This mechanism further optimizes the stability of downsampling, enabling the algorithm to better cope with noise interference in real-world application scenarios.

[0070] Specifically, Poisson disk sampling aims to achieve uniform distribution by ensuring minimum distance constraints between sampling points. Directly checking the distances between all points would result in high computational complexity, making the reduction of this complexity through spatial mesh generation a crucial step. Mesh generation, based on the idea of ​​spatial partitioning, embeds point cloud data into a regular 3D mesh structure. By managing the mesh cells, it achieves the goal of rapid localization and efficient verification of sampling points.

[0071] To satisfy the minimum distance constraint *r* for Poisson disk sampling, the mesh generation must be based on the sampling radius *r* to determine the size of the mesh cells. Assuming the sampling points are in three-dimensional Euclidean space, the mesh cells are cubes with side length *h*. To ensure that each mesh cell contains at most one sampling point, its side length *h* must satisfy the condition that the shortest distance between any two points in the mesh cell is not less than *r*. Since the length of the diagonal of a cube is equal to the length of its side... Therefore, the theoretical upper limit of the side length h can be derived using the following formula.

[0072] (9) (10) This formula effectively prevents sampling points from clashing within the grid cells. By using grid partitioning, the original global point distance check is transformed into a local neighborhood check, thereby greatly reducing computational complexity.

[0073] The second step in mesh generation is determining the index of the grid cell containing each point. This is achieved by mapping the spatial coordinates of the point to the grid index. The minimum boundary of the point cloud space is set as follows: If the side length of a grid cell is h, then any point Grid index The calculation can be performed using the following formula: (11) These formulas allow each point in the point cloud to be precisely assigned to a unique corresponding grid cell, with the grid index being an integer value, thus establishing a mapping relationship between points and grid cells. This indexing method is not only convenient in terms of storage but also lays the foundation for subsequent neighborhood queries.

[0074] After the grid is divided, the points are stored using a sparse hash table structure, with the index of each grid cell as the key and the point stored in that cell as the value, such as... Figure 3 As shown. A hash table is an efficient data structure that maps keys to specific data storage locations using a hash function, enabling fast insertion, lookup, and deletion operations. In this study, a hash table is used to efficiently manage points within a grid cell, allowing for the rapid location of the grid cell containing any given candidate point and all its neighboring grid cells, thus accelerating the distance verification process. The entire space is divided into a series of regular grid cells, each corresponding to a slot in the hash table. Each slot stores a list or set of all points located within that grid cell. When a new candidate point needs to be verified, its grid cell is calculated, and the corresponding slot is accessed directly through the hash function, allowing for rapid retrieval of all neighboring points for distance checking.

[0075] The use of hash tables avoids the storage overhead of unaccessed grid cells and can achieve storage speeds close to... The time complexity is low, allowing for rapid location of the grid cell containing the point. This characteristic of mesh generation endows Poisson disk sampling with efficient data management capabilities.

[0076] During the sampling process, the verification of new candidate points requires checking whether they meet the minimum distance constraint. Since the mesh cell design ensures that there are no conflict points within the same cell, the verification process only needs to check the mesh containing the candidate point and its neighboring meshes. The neighborhood of a mesh cell can be considered as centered on that cell. The cube, assuming the grid indices of the candidate points are... Then the neighborhood to be checked includes... Centered There are 10 grid cells. The verification process first extracts the set of already stored sampling points from these grid cells, and assuming the candidate points are 100,000. Sampling points are The Euclidean distance between the candidate points and these sampling points is calculated using the following formula: (12) If all distances satisfy If the candidate point passes the verification, it is added to the sampling point set; otherwise, it is discarded. The verification process relies on the neighborhood constraints formed by grid partitioning, simplifying the originally complex global search into a local neighborhood search, which significantly improves the algorithm efficiency.

[0077] It is worth noting that the grid partitioning method not only significantly reduces the complexity of the algorithm implementation, but also theoretically ensures the uniformity and accuracy of the sampling results. By reasonably designing the size of the grid cells, the Poisson disk sampling algorithm can generate a set of points that satisfy the minimum distance constraint in space, and effectively avoid the phenomena of clustering or sparseness of sampling points. The grid-based point management method provides a flexible storage and query mechanism, which is very suitable for processing large-scale point cloud data.

[0078] In the Poisson disk sampling algorithm, the verification of new candidate points requires that their distances to already sampled points satisfy the minimum distance constraint r. If global distance calculations are performed on all sampled points, the computational complexity will reach [value missing]. When processing large-scale point cloud data, this can lead to severe performance bottlenecks. The algorithm addresses this by using a grid partitioning approach, transforming the global verification problem into a local neighborhood query, thus significantly reducing computational complexity. The combination of grid partitioning and neighborhood querying only checks a limited number of grid cells, eliminating the need for a global traversal of the entire point cloud space, thereby reducing complexity from... Reduced to a level proportional to the number of neighboring points. , where K represents the number of points in the neighborhood of a candidate point.

[0079] This method not only significantly reduces the complexity of algorithm implementation but also theoretically guarantees the uniformity and accuracy of sampling results. Through reasonable grid cell design and efficient point management mechanism, the grid partitioning and neighborhood-accelerated query method provides a practical and efficient solution for Poisson disk sampling, which is particularly suitable for processing large-scale point cloud data. It can generate a set of points that meet the minimum distance constraint in space, effectively avoiding the clustering or sparseness of sampling points.

[0080] In the Poisson disk sampling algorithm, the sampling radius *r* is a crucial parameter controlling the sparsity of the sampling point distribution. In traditional algorithms, the sampling radius is typically set to a globally fixed value. However, real-world point cloud data often exhibits a non-uniform density distribution, and a fixed sampling radius may lead to oversampling in high-density areas or undersampling in low-density areas, thus reducing the representativeness and efficiency of the sampling results. Therefore, this embodiment dynamically adjusts the sampling radius based on the local density features of the point cloud. The specific operation is as follows: Point cloud density is fundamental to adaptive sampling radius calculation. The global density of the point cloud is estimated using its axis-aligned bounding box (AABB). Let the AABB range of the point cloud be... , , Its volume is: (13) Global average density of point cloud It can be calculated from the total number of points N and the volume V: (14) In estimating the local density of points in multidimensional spatial data, constructing a Kd-Tree is an efficient method. A Kd-Tree recursively partitions the k-dimensional space into subspaces, forming a tree-like structure, which facilitates rapid retrieval of nearest neighbor information. To quantify the local density of each point... Define it as that point The average distance between its k nearest neighbors The local density is a function of . It can be estimated using the following formula: (15) This formula reflects the number of data points contained within a unit volume of the sphere, i.e., the local point cloud density.

[0081] To adapt to different application scenarios, a scaling factor is introduced. To adjust the sampling radius This is to achieve the capture of features at different scales. Sampling radius The calculation is based on local density. The inverse cube root of is given by the following formula: (16) This method not only provides an effective estimate of point cloud density, but also allows for flexible adjustment of the sampling strategy according to actual needs.

[0082] The core of the Poisson disk sampling algorithm lies in generating candidate points that meet the sampling distance constraints and ensuring the uniformity of the sampling point distribution. To improve the efficiency and quality of sampling point generation, this embodiment uses a candidate point generation strategy based on direction pre-generation and dynamic adjustment of the sampling radius, which significantly improves the success rate of sampling point generation.

[0083] Traditional candidate point generation typically relies on completely random direction selection, which may lead to uneven distribution of generated points and increase the probability of neighborhood validation failure. A spherical direction pre-generation strategy is adopted, which generates a fixed number of direction vectors uniformly distributed across a unit sphere, providing an efficient direction selection scheme for candidate point generation. The specific steps are as follows: (1) Direction vector generation: Given a random number generator, it can generate a direction vector in the interval The pseudo-random number u and uniformly distributed within the range The following formula can be used to generate a direction vector uniformly distributed on the surface of a sphere: (17) (18) in, and These are the polar angle and azimuth angle of the spherical surface, respectively. The generated direction vector is: (19) (2) Direction vector selection: When generating candidate points, a direction vector is randomly selected from the pre-generated set, and combined with the current sampling point position and dynamically adjusted sampling radius to generate candidate points. Through the direction pre-generation strategy, the direction of candidate point generation is more uniform, avoiding sampling blind spots that may be caused by completely random generation.

[0084] To adapt to local density variations in point cloud data, an adaptive radius adjustment method is used to dynamically adjust the distance range for candidate point generation. Each time a candidate point is generated, the distance *d* from the candidate point to the current sampling point follows a uniform distribution on the interval [r, 2r], and its probability density function is defined as: (20) Where r represents the sampling radius, and [r, 2r] is the range of distance values. This distribution ensures that the distance between generated points is at least r, satisfying the distance constraint of Poisson disk sampling, and can also introduce randomness over a larger range to increase the diversity of sampling point distribution.

[0085] Sampling Experiment: The key parameter of the algorithm in this embodiment is the number of neighboring query points, which directly affects the downsampling effect of the point cloud. In order to select a suitable number of neighboring query points, five sets of comparative experiments were conducted using workpiece point clouds to test the impact of different numbers of neighboring query points on the sampling results.

[0086] Table 2. Impact of the number of neighborhood query points on downsampling performance As shown in Table 2, the experimental results indicate that within the parameter adjustment range of increasing the number of neighborhood query points from 10 to 30, the downsampling rate fluctuates relatively little, while the processing time is significantly positively correlated with the number of neighborhood query points. However, it is worth noting that when the number of neighborhood query points is small (<15) or large (>35), downsampling may lose local features. To balance processing time and processing effect, this embodiment selects 25 as the number of neighborhood query points.

[0087] The improved Poisson disk sampling algorithm proposed in this embodiment is used to downsample the Bunny point cloud model. Comparative analysis shows that the sampling point set is uniformly distributed; the power spectrum characteristics are well maintained; the peak value of the radial distribution function is consistent with the height of the original point cloud, and the curve fluctuation is small. This verifies that the algorithm can effectively maintain the geometric features and statistical properties of the point cloud while ensuring a high sampling rate.

[0088] In the sampling experiment of single-workpiece point cloud data, the original point cloud data contained 75,864 points. After adaptive mesh acceleration Poisson disk sampling processing, the number of point cloud data points was reduced to 7,396, with a downsampling rate of approximately 9.75%. The entire sampling process took 10.57 seconds, indicating that the algorithm has high computational efficiency when processing medium-sized point cloud data. Figure 4 As can be seen, the downsampled point cloud data significantly reduces redundant points while preserving the key geometric features of the workpiece. The point cloud is evenly distributed and there is no obvious oversampling or undersampling phenomenon.

[0089] To further verify the applicability of the algorithm in complex scenarios, this embodiment also conducted a sampling experiment on the overall point cloud data of the workpiece and grinding wheel combination. The original overall point cloud data contained 131,954 points. After sampling using a Poisson disk, the number of point cloud data points was reduced to 6,636, with a downsampling rate of approximately 5.03%. The sampling process took 10.79 seconds, which is similar to the processing time for single workpiece point cloud data, indicating that the algorithm can still maintain high computational efficiency when processing larger-scale point cloud data. Figure 5 As can be seen, the downsampled overall point cloud data significantly reduces background noise and redundant points while preserving the key geometric features of the workpiece and grinding wheel. The point cloud is evenly distributed and has no obvious geometric distortion.

[0090] Experiments show that the adaptive mesh-accelerated Poisson disk sampling algorithm exhibits significant advantages in point cloud downsampling tasks. It drastically reduces the computational complexity of neighborhood queries through efficient mesh generation and hash table indexing, ensuring computational efficiency when processing large-scale point cloud data. By employing a strategy of pre-generating orientations and dynamically adjusting the sampling radius, it achieves uniformity in the distribution of sampling points, avoiding oversampling or undersampling problems in traditional methods. This algorithm effectively preserves geometric features while downsampling, providing high-quality data support for subsequent tasks such as segmentation and model fitting. Its adaptive sampling radius adjustment capability allows the algorithm to flexibly handle changes in local point cloud density, demonstrating good adaptability in processing non-uniformly distributed point clouds.

[0091] Multi-starting-point region growth point cloud segmentation based on curvature and normal estimation is a crucial step in 3D data processing. It aims to divide a point cloud dataset into several subsets, each representing an independent part of an object or scene. Stepped shaft parts typically consist of multiple cylindrical segments of different diameters. To allow for flexible selection and individual processing of each segment during subsequent tool setting operations, these cylindrical segments must first be accurately segmented from the overall point cloud.

[0092] Point cloud segmentation refers to the process of dividing a point cloud dataset into several subsets, each representing an independent part of an object or scene. In the field of point cloud processing, accurate and efficient segmentation algorithms are crucial for extracting meaningful information from complex data. A multi-starting-point region growing segmentation algorithm based on curvature and normal estimation effectively improves segmentation efficiency and accuracy by optimizing the seed point selection strategy. Traditional region growing algorithms rely on single or random seed points, which can easily lead to incomplete growth or redundant calculations, especially in flat regions. The improved algorithm combines curvature analysis and mesh generation, prioritizing low-curvature points as seeds to avoid boundary or noise interference. Simultaneously, it dynamically selects the optimal seed point through mesh cells to ensure uniform distribution. This strategy not only enhances the algorithm's adaptability to point clouds with different geometric structures but also significantly reduces invalid iterations, improving the robustness of flat region and boundary recognition while maintaining the accuracy of geometric features.

[0093] The core idea of ​​the region growing algorithm is to use the geometric features of the point cloud to group points with similar characteristics into the same cluster. The algorithm mainly includes three key steps: normal estimation, curvature calculation, and region growing.

[0094] Normal estimation is fundamental to region growing algorithms; its purpose is to determine the local geometric properties of each point in a point cloud. Let the point cloud be... For each point The k-NN algorithm is used to search for and select the k nearest neighbors from its neighborhood. And calculate the covariance matrix of these neighborhood points. The matrix is ​​defined as follows: (twenty one) in, It is the mean of the neighborhood points: (twenty two) By analyzing the covariance matrix Eigenvalue decomposition yields three eigenvalues. (Assuming) The corresponding feature vector. (and minimum eigenvalue) (Related) is a point Normal direction: (twenty three) The geometric meaning of normal estimation is to find the principal direction of the neighborhood surface of a point by analyzing the local neighborhood distribution of the point, thereby determining the local normal vector.

[0095] After estimating the normals, the curvature of each point can be further calculated. Curvature is an important feature reflecting the local geometry of the point cloud surface. Based on the eigenvalue decomposition of the covariance matrix, the curvature of each point can be calculated. The curvature is defined as follows: (twenty four) in, It is the smallest eigenvalue of the covariance matrix, representing the degree to which the local surface of a point deviates from the plane; the denominator is the smallest eigenvalue of the covariance matrix. It is the sum of the eigenvalues ​​of the covariance matrix, reflecting the overall distribution range of the point cloud in the local neighborhood.

[0096] This definition ensures the curvature value It lies within the interval [0, 1]. When When it is close to 0, it indicates that the surface of the point's neighborhood is relatively flat; when A larger value indicates that there are significant geometric changes in the local region where the point is located.

[0097] Region growing is the core step of the algorithm, aiming to divide the point cloud into multiple clusters based on features. Region growing starts with one or more initial seed points and expands the clusters by searching their neighborhood points and applying certain similarity criteria. Initially, all points are unlabeled. The algorithm iterates through every point in the point cloud. If the point has not yet been labeled and its curvature Below the preset threshold If a point is identified as a potential seed point, it is assigned a new category label. Then, a breadth-first search process is initiated, examining all k nearest neighbors of the current point. If a neighbor is also unlabeled and its curvature is less than a threshold, the search continues. If a point meets the criteria, it is added to the currently growing region, and its label is updated. This process continues until the queue is empty, meaning there are no more points that meet the criteria to be added to the current region.

[0098] It is worth noting that once a region stops growing, it is also necessary to assess whether its size has met the minimum cluster size requirement. If the criteria are met, the region is considered noise or an anomaly, and its label is removed, meaning all points within it are reset to an unlabeled state. This is done to ensure that each region in the final output is sufficiently representative, thereby improving the quality of the segmentation results.

[0099] This method guides the region growing process by accurately estimating the geometric properties of points, achieving an efficient transformation from raw point cloud data to meaningful segmentation results. This method is not only adaptable to surfaces of different shapes and scales but also exhibits robustness to noise.

[0100] In point cloud segmentation tasks, the seed point is the starting point for region growth, and its selection directly affects the coverage of the growth process and the reduction of redundant computation. The core objective of the multi-starting point selection strategy is to improve the efficiency of point cloud region growth and segmentation algorithms and the accuracy of segmentation results by rationally selecting seed points.

[0101] Curvature is a fundamental characteristic for judging surface variations in point clouds. Throughout the point cloud, points with higher curvature values ​​are typically located in regions of dramatic surface changes (such as boundaries or protrusions), while points with lower curvature values ​​are distributed across flat surfaces. The global distribution of curvature can be used to measure the complexity of the point cloud. By analyzing the statistical distribution of point cloud curvature, a preliminary screening of the point cloud is performed, avoiding the repeated selection of too many seed points in relatively flat areas. Points with curvature below a certain threshold are marked as candidate points to ensure that seed points are concentrated in regions of significant geometric changes, reducing excessive redundant computation on flat surfaces.

[0102] Based on the candidate point set, the algorithm further utilizes a spatial grid partitioning strategy to uniformly distribute seed points: (1) Constructing a spatial mesh: The first step in spatial mesh generation is to determine the 3D bounding box of the point cloud. Let the point cloud be... , where each point The three-dimensional coordinates are The bounding box extent is defined by calculating the minimum and maximum values ​​of the point cloud in each dimension.

[0103] Next, based on the preset mesh resolution r, the bounding box is divided into several voxel units at equal intervals along the x, y, and z axes. The size of each voxel unit is... Each cell is uniquely identified by its three-dimensional index in the mesh. It means that, among them: (25) (2) Selecting seed points: For each voxel unit, extract all points within that unit as a candidate point set. In the candidate point set, the point with the smallest curvature is preferentially selected as the seed point for that voxel: (26) here It is the curvature value of point p. If there are no points within a voxel, then no seed point is generated for that voxel.

[0104] The spatial mesh generation process not only ensures a uniform distribution of seed points globally, but also guarantees the sensitivity of seed points to geometrically changing regions through a curvature-priority selection mechanism. Compared to directly selecting seed points randomly from the point cloud, the mesh generation strategy effectively avoids situations where seed points are too dense in dense regions or completely absent in sparse regions, thereby improving the efficiency of the region growing algorithm.

[0105] Experimental Analysis: To investigate the impact of neighborhood search range (k-value), curvature threshold, and minimum cluster size on segmentation performance and to determine the optimal parameter combination, a series of experiments were designed and implemented. The experiments used a point cloud dataset with five stepped axes as the test object. Theoretically, this object should be correctly segmented into five independent regions, with each stepped axis corresponding to one label. In the experiments, various parameter combinations were systematically explored to determine the optimal configuration of the k-value, curvature threshold, and minimum cluster size. These parameters are crucial for achieving efficient computational performance and high-precision segmentation results. Specifically, the parameter search space was set as follows: the k-value range was set to 10 to 550; the curvature threshold range was set to 0.1 to 10.1; and the minimum cluster size range was also set to 10 to 550 points. Each parameter combination was segmented using the proposed algorithm, and the number of labels obtained from the segmentation was recorded to evaluate the segmentation performance. By analyzing the segmentation results under different parameter combinations, the aim was to find an optimized parameter setting that maintains high computational efficiency while ensuring segmentation accuracy. Finally, all experimental results were summarized into a three-dimensional scatter plot, as shown below. Figure 6 As shown.

[0106] After a series of tests, it was finally determined that the expected segmentation effect could be achieved when k=25, the curvature threshold was set to 0.4, and the minimum cluster size was 100. This parameter combination not only ensured the accuracy of the algorithm but also provided a benchmark for subsequent performance comparisons.

[0107] The experiment used a representative point cloud dataset to test the performance of the algorithm in different scenarios and compared it with other point cloud segmentation algorithms, as shown in Table 3. Figure 7 As shown.

[0108] Table 3 Comparison data of point cloud segmentation algorithms Table 3 shows that the improved algorithm significantly increases computational efficiency, reducing the time required from 479.17 seconds using the traditional method to only 0.87 seconds, indicating a substantial improvement in processing speed. This improvement is mainly attributed to the application of a multi-starting point selection strategy. By optimizing the selection of seed points, unnecessary redundant calculations are reduced, making the region growth process more efficient. This strategy ensures that each region growth begins where geometric features change significantly, thereby accelerating the recognition of complex shapes. Regarding segmentation quality, the algorithm in this embodiment preserves the feature details of the point cloud, while the Euclidean clustering algorithm exhibits significant loss of detail. For example, the number of point clouds for label 2 decreased from 3,666 to 3,206, a reduction of 12.5%, indicating that the Euclidean clustering algorithm struggles to adapt to complex curved surface boundaries.

[0109] Table 4 Performance Comparison of Point Cloud Segmentation Algorithms Table 4 shows that the algorithm in this embodiment outperforms both the traditional region growing algorithm and the Euclidean clustering algorithm in terms of both the silhouette coefficient and the Davies-Bouldin index. The silhouette coefficient improves from 0.212 in the traditional algorithm and 0.363 in Euclidean clustering to 0.498, indicating that the algorithm in this embodiment performs better in terms of cluster separation and compactness, and the point cloud segmentation results are more discriminative. The Davies-Bouldin index significantly decreases from 0.980 in the traditional algorithm and 0.998 in Euclidean clustering to 0.566, indicating that the algorithm in this embodiment achieves a significant improvement in the balance between intra-class and inter-class distances, resulting in higher cluster quality and clearer inter-class separation. This result proves that the multi-starting point selection strategy not only improves the computation speed but also enhances the ability to preserve the geometric features of the segmentation by optimizing the selection of seed points, thereby avoiding the loss of details in Euclidean clustering when handling curved surface boundaries.

[0110] To further verify the robustness and adaptability of the improved multi-starting-point region growing point cloud segmentation algorithm, a noise test was introduced into the experiment. Gaussian noise with a mean of 0 and a standard deviation of 0.12 was added to the original five-segment stepped-axis point cloud data. This operation aims to simulate the unavoidable measurement errors and environmental interference during point cloud data acquisition in real-world environments, thereby evaluating the performance of the algorithm in the face of noise pollution.

[0111] Experimental results are as follows Figure 8 As shown, even with the addition of Gaussian noise, the algorithm of this invention can still accurately segment the point cloud and successfully identify five independent regions, consistent with the segmentation results under noise-free conditions.

[0112] Table 5 Performance Comparison of Point Cloud Segmentation Algorithms in Noisy Environments The data in Table 5 show that the algorithm of this invention still maintains optimal performance in noisy environments, with a silhouette coefficient of 0.493, which is significantly higher than the 0.394 of the traditional region growing algorithm and the 0.245 of the Euclidean clustering algorithm; the Davies-Bouldin index is only 0.570, which is significantly better than the 1.038 of the traditional algorithm and the 1.196 of the Euclidean clustering algorithm. This indicates that the algorithm of this invention can still maintain excellent intra-class compactness and inter-class separation under noise interference, and exhibits stronger robustness and stability.

[0113] The cylinder model fitting and 3D reconstruction employed the RANSAC algorithm to extract cylinder parameters. The core idea of ​​the RANSAC algorithm is to extract the optimal cylinder model from point cloud data containing noise and outliers through random sampling and model validation mechanisms.

[71] This process not only relies on the iterative optimization capabilities of RANSAC, but also requires parametric modeling based on the geometric characteristics of the cylinder to accurately determine key parameters such as the central axis, radius, and height. However, traditional RANSAC algorithms have significant limitations when handling complex geometries or high-noise environments, and are prone to model shift or unstable fitting.

[0114] To address these limitations, the improved RANSAC cylinder fitting algorithm proposed in this embodiment achieves significant improvements in fitting accuracy, noise resistance, and computational efficiency. The improved algorithm innovatively introduces a normal vector consistency weight mechanism, jointly optimizing geometric distance error and normal vector direction consistency, thereby maintaining high fitting accuracy and exhibiting stronger robustness even under noise interference. Simultaneously, by optimizing the interior point detection mechanism and scoring function, the algorithm reduces unnecessary iterations, significantly improving computational efficiency while maintaining accuracy.

[0115] Normal vector estimation: Normal vector estimation typically employs a neighborhood-based approach to analyze the local geometric characteristics around each point. The k-NN algorithm is used to analyze the neighborhood around each point and calculate the normal vector in the point cloud. This process utilizes the geometric distribution of the local neighborhood of the point cloud to estimate the normal vector.

[0116] Define each point in the point cloud as Estimate the normal vector This can be obtained by fitting a local plane using the least squares method. Assuming that... There is a local neighborhood containing a set of points. , where k is the neighborhood size. By calculating the covariance matrix of these neighborhood points, the optimal normal vector estimate can be obtained. This covariance matrix is: (27) in, This represents the mean of all points in the neighborhood. This represents the offset of each point relative to the mean. The eigenvalue decomposition of the covariance matrix yields the normal vector. The eigenvector corresponding to its smallest eigenvalue is the normal vector. The normal vector is perpendicular to the point cloud plane of the local neighborhood.

[0117] The normal vectors calculated in this way provide the necessary local geometric information for subsequent model fitting. The results of the normal vector calculation are as follows: Figure 9 As shown, significant downsampling was performed on the original point cloud data to improve visibility. When fitting a cylinder, the normal vector helps determine the direction of the cylinder's principal axis. It can be seen that the normal vector at each point on the cylinder's surface points towards the cylinder's axis. The normal vector also affects the convergence speed and accuracy of the cylinder fitting algorithm. Normal vector estimation, as one of the preprocessing steps in RANSAC cylinder fitting, provides a description of the local region's geometry. This process plays a crucial role in the accuracy and robustness of the cylinder fitting results. Through accurate normal vector estimation, the RANSAC algorithm can better identify and fit cylinders in the point cloud, avoiding erroneous fitting results.

[0118] Interior point detection and scoring function: In 3D data processing, interior point detection and model fitting are crucial steps, especially when extracting geometric features such as cylinders from point cloud data. For cylinder fitting, interior points are those that conform to the pre-assumed cylinder model and whose error is within an acceptable range. The cylinder fitting process based on the RANSAC algorithm is as follows: Given a point cloud set P, define a cylindrical model M, which is represented as: (28) Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector of unit length, r represents the radius of the cylinder, and h represents the height of the cylinder.

[0119] When performing cylinder fitting, the RANSAC algorithm is used to iteratively search for the optimal model parameters. In each iteration, a certain number of points are randomly selected as the initial sample set, and a preliminary cylinder model is calculated based on these points. Iterate through all point cloud data, and for any point... Its distance from the surface of the cylinder It can be calculated using the following formula: (29) here, Point The projected length to the axis, and This represents the perpendicular distance from the point to the axis. When the absolute value of this perpendicular distance minus the radius is less than a preset threshold... At time, point Considered as interior points, i.e., a cylindrical model that conforms to the current assumptions, a set of interior points can be defined. as follows: (30) To ensure model accuracy, the RANSAC algorithm repeats the above process multiple times until the maximum number of iterations is reached or a sufficient number of inliers are found. The model with the most inliers is ultimately selected as the optimal solution. In this process, the number and distribution of inliers directly reflect the model's fit to the original data and can serve as an important scoring metric. The higher the proportion of inliers, the more accurately the model is likely to represent the real object.

[0120] To improve the fitting quality, a consistency weight for the normal vector direction is also set, which adjusts the degree to which the normal vector direction is considered during model estimation. This parameter allows the algorithm to consider not only the distance from the point to the model surface but also the angular difference between the point's normal vector direction and the model's expected normal vector direction when evaluating whether a point is an interior point. Let the point... The normal is The expected normal vector of the model at this point is Then the cosine similarity between the two It can be given by the following formula: (31) By introducing a consistency weight for the normal vector direction The scoring function will not only depend on the distance from the point to the model. Instead, it takes into account both distance and consistency of normal direction: (32) in Point The rating, The weighting coefficients are within the interval [0, 1]. When When the value is close to 1, the consistency of the normal vector direction will have a greater impact on the score; while when... When the score is close to 0, the score depends primarily on distance. This mechanism helps to eliminate outliers that are geographically close but have significantly different normal vector directions, thereby improving the accuracy of the model fit.

[0121] The reconstruction of cylinders is based on precise geometric description and parametric modeling. By extracting key geometric parameters of the cylinder, such as axis, radius and height, from point cloud data, a mathematical model of the cylinder can be established, and finally a three-dimensional mesh of the cylinder can be generated.

[0122] Parametric Modeling of Cylinders: A cylinder is a fundamental geometric shape in three-dimensional space, consisting of an axis and a circular cross-section with a fixed radius. Given a point cloud set P, a cylinder model M is defined as follows: (33) Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector of unit length, r represents the radius of the cylinder, and h represents the height of the cylinder.

[0123] The surface of a cylinder is formed by the two ends of its axis (at which...) and It is composed of a point on the surface of a cylinder and the cross-section of a circle. Using a parametric method, any point on the surface of a cylinder can be described by the following mathematical expression.

[0124] Let a point be on the surface of the cylinder. Described by the following parameterized formula: (34) in, These are the parameters of the circle, which determine its position on the circumference; The parameter along the axis of the cylinder controls the position of the point on the axis; u and v are unit vectors perpendicular to the axis vector a, forming the base coordinate system of the circle.

[0125] Specifically, the unit vectors u and v can be calculated from the axis vector a in the following way: (35) (36) in The vector cross product operation is represented by u and v, which are two unit vectors perpendicular to the axis and determine the orientation of the cylindrical cross section.

[0126] Using the above formula, any point on the cylindrical surface can be determined by parameters. and To use as a unique representation.

[0127] Cylindrical Mesh Creation: Creating a cylindrical mesh is a crucial step, involving discretizing the continuous surface of a cylinder into a finite number of triangular patches to obtain a discrete representation that a computer can process and render. To accomplish this, the surface of the cylinder needs to be discretized, and the corresponding triangular mesh needs to be constructed.

[0128] By parameters and Discretization, choosing an appropriate step size and This can generate multiple discrete points on the surface of a cylinder. For each cross-section of the cylinder, [the following will be done]. Discretize into N points, that is: (37) For each The coordinates of the corresponding cross-sectional points can be calculated using the parameterized formulas described above.

[0129] For discretization along the axis, let: (38) M represents the number of discretization points along the axis of the cylinder. These discrete points represent the position of the cylinder along its axis, and the axial direction of the cylinder is discretized using these discrete points. This results in a gridded set of points, where the position of each point is determined by... and Confirmed. For each We can calculate the cross-section of a circle with a point set of N, where the coordinates of each point are: (39) Where r is the radius of the cylinder.

[0130] Based on the discretized point set of the cylinder, these points need to be connected to form a triangular mesh. The triangular mesh can be constructed by connecting points on adjacent circumferences into triangles. For each pair of adjacent circumferences... and The points on it and It needs to be connected to adjacent points. Assume... and Located on the i-th and j-th circumferences respectively, connecting these points forms a quadrilateral, and each quadrilateral can be further subdivided into two triangles, ensuring that the entire side of the cylinder is completely covered without overlapping.

[0131] The process of constructing the triangular mesh for each pair of adjacent points is as follows: Assuming the cross-section of the cylinder is a circle, after discretization, each point on the circumference can be represented as: (40) in This represents the height discretization point along the axis of the cylinder. This represents the discretized point of the circumference angle.

[0132] (1) For each pair of adjacent circles and Points on each circumference and Points on the adjacent circumference and It forms a quadrilateral.

[0133] (2) Each quadrilateral is divided into two triangles, and for each pair of adjacent circumferences and adjacent points, two triangles are generated.

[0134] like Figure 10 As shown, this partitioning method ensures a smooth transition from one circumference to the next, and each quadrilateral is decomposed into two triangles, thus forming a coherent, gapless triangular mesh. Ultimately, the vertex set contains the coordinates of all discretized points, while each triangular facet consists of three vertex indices pointing to the vertex positions in the vertex set. In this way, the surface of the cylinder is effectively transformed into a mesh composed of triangular faces.

[0135] To evaluate the effectiveness and robustness of the improved RANSAC cylinder fitting algorithm proposed in this embodiment, a dataset containing ten sets of five-segment stepped axis point cloud data was constructed. Each set of data represents a five-segment stepped axis point cloud sample, which has been precisely divided into five regions in the preprocessing stage. Each region corresponds to an independent cylindrical segment, providing a foundation for subsequent piecewise cylinder fitting.

[0136] Under ideal, noise-free conditions, fitting experiments were conducted for each of the five independent cylindrical segments in each dataset, and the fitting results are as follows: Figure 11 As shown.

[0137] Table 6. Fitting accuracy of cylinder diameter using different algorithms Table 7. Fitting accuracy of cylinder length using different algorithms Experimental data are shown in Tables 6 and 7. In diameter fitting, the traditional least squares method has a maximum absolute error of 0.659 mm, while the algorithm of this invention reduces the maximum error to 0.183 mm, and the overall average absolute error is optimized from 0.374 mm for the least squares method and 0.168 mm for RANSAC to 0.130 mm. In length fitting, the overall average absolute error of the algorithm of this invention is 0.177 mm, which is an improvement of 74.5% and 52.9% compared to 0.693 mm for the least squares method and 0.376 mm for RANSAC, respectively. Through the improved interior point detection mechanism and the application of the scoring function, the algorithm of this invention can stably and accurately obtain these key dimensions. Compared with the least squares method and the standard RANSAC algorithm, the algorithm of this invention has a smaller error range, indicating that it has significant advantages in measuring the diameter and length of cylinders, providing more reliable and accurate model estimates.

[0138] Furthermore, to verify the robustness of the algorithm in real-world application scenarios, Gaussian noise at different levels of 5%, 10%, 15%, 20%, 25%, and 30% was introduced into the original point cloud data, and the fitting process was repeated for each noise level.

[0139] like Figure 12 As shown in the experimental results, with the increase of noise ratio, the output of traditional fitting algorithms gradually deviates significantly from the true value, and this deviation intensifies with the increase of noise intensity, ultimately leading to a significant decrease in fitting accuracy. In contrast, the algorithm of this invention exhibits superior stability and noise resistance. Even with continuously increasing noise levels, the algorithm's output shows only small changes, and its deviation is far less than that of traditional methods, demonstrating its advantages over traditional techniques and better meeting the needs of practical applications.

[0140] A cylindrical model is fitted to the point cloud to extract key parameters such as axis, radius, and height, establishing accurate geometric models of the grinding wheel and workpiece, providing spatial pose calculation basis for the tool setting process. Finally, tool setting parameters are calculated based on the fitted data, NC code is automatically generated, and communication and transmission with the CNC machine tool are achieved through the FOCAS library, thus completing a fully closed-loop automated process from point cloud data acquisition, processing and analysis to machining command generation and execution.

[0141] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for autonomous tool setting in CNC machine tools based on 3D vision guidance, characterized in that, Includes the following steps: S1. Acquire three-dimensional point cloud data of the tool and workpiece through a 3D vision sensor, and preprocess the three-dimensional point cloud data. S2. The processed 3D point cloud data is segmented using a region growing algorithm to separate the tool point cloud from the workpiece point cloud and extract the point cloud of each cylindrical segment of the workpiece. S3. The cylindrical fitting algorithm is used to fit the segmented tool point cloud and workpiece point cloud to a cylindrical model to obtain the geometric parameters of the tool and workpiece, including the axial direction, radius and center coordinates. S4. Calculate the relative positional relationship between the tool and the workpiece based on the geometric parameters of the tool and the workpiece, generate the tool setting path and convert it into NC code; S5. Transmit the NC code to the grinding machine control system through the grinding machine communication module to perform the tool setting operation; In step S3, the cylindrical model M is defined in the point cloud set P as follows: Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector of unit length, r represents the radius of the cylinder, and h represents the height of the cylinder; When fitting the cylindrical model, the RANSAC algorithm is used to iteratively search for the optimal model parameters. In each iteration, a preliminary cylindrical model is calculated based on randomly selected sample points. In the preliminary cylindrical model In the middle, traverse the point cloud data and calculate any point Distance to the surface of the cylinder satisfy: In the formula, Point The projected length to the axis. Represents the perpendicular distance from the point to the axis, where r is the radius of the cylinder; if Less than the preset threshold Then the point If a point is determined to be an interior point, then the set of interior points is obtained. for: After the iteration is complete, the model with the most interior points is selected as the optimal solution; Interior point set any point in The normal is The expected normal vector of the model at this point is The cosine similarity between the two for: Establish point The scoring function is: In the formula, Point The rating; is the consistency weight coefficient for the normal vector direction, within the interval [0, 1]. For point The distance to the surface of the cylinder; From the set of interior points Points with scores below the preset value will be deleted, and the inlier set will be updated. After the iteration is complete, based on the updated set of interior points... The model with the most interior points is selected as the optimal solution.

2. The method for autonomous tool setting of CNC machine tools based on 3D vision guidance as described in claim 1, characterized in that, In step S2, the point cloud segmentation using the region growing algorithm is as follows: S21. Perform normal estimation and curvature calculation on the point cloud data; S22. Determine the 3D bounding box of the point cloud and, based on the preset mesh resolution... The 3D bounding box is divided into multiple voxel units at equal intervals along the x, y, and z axes; S23. For each voxel element, select the point with the smallest curvature as the seed point of that voxel element and assign a category identifier. S24. For each point with an assigned category label, check all k nearest neighbors of that point, and identify those without an assigned category label and with curvature. Below the preset threshold The points are added to the current region and assigned the same category identifier until the region stops growing; S25. Based on the segmentation results, separate the tool point cloud and the workpiece point cloud, and extract the point cloud of each cylindrical segment of the workpiece.

3. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 2, characterized in that, In step S24, after each region stops growing, if the number of points in that region is less than the preset minimum clustering size, the category label of that region is canceled and all points in that region are set to an unlabeled state.

4. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 2, characterized in that, In step S21, for each point of the point cloud data The k-NN algorithm is used to search for and select the k nearest neighbors from the neighborhood. And calculate the covariance matrix of the neighborhood points. covariance matrix The definition is as follows: in, It is the mean of the neighborhood points: For covariance matrix Eigenvalue decomposition yields three eigenvalues. , Then point The direction of the normal is: point The curvature is: in, It is the smallest eigenvalue of the covariance matrix. It is the sum of the eigenvalues ​​of the covariance matrix. Minimum eigenvalue Relevant feature vectors.

5. The method for autonomous tool setting of CNC machine tools based on 3D vision guidance as described in claim 1, characterized in that, In step S1, the preprocessing includes depth threshold filtering of the point cloud data, and the steps are as follows: S11. Define a 3D point cloud dataset containing n points as follows: any point The coordinates are , Depth information represents points Distance to the reference plane; extract depth information from all points to form a depth vector. ,in , indicating a point The absolute depth value; S12. Construct a vector containing the z-coordinates of all points. And calculate the sample mean of vector z. and sample standard deviation , respectively represented as: In the formula, This represents the average depth of the dataset along the Z-axis. This indicates the degree of dispersion of data points around the average depth; S13. Based on the sample mean and sample standard deviation Linear combination defines dynamic depth threshold for: In the formula, It is an adjustable constant factor used to control the offset of the threshold relative to the average depth. S14. Based on the dynamic depth threshold A binarization mask was constructed. If point absolute depth value ,but and the point Remove from 3D point cloud data, otherwise Keep this point .

6. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 5, characterized in that, In step S1, after depth threshold filtering, the 3D point cloud data undergoes noise reduction processing, as follows: S15. Determine any point in the point cloud data. neighborhood The global mean of the average distance of all points within the area and standard deviation for: In the formula, and Representing points respectively The average location within its neighborhood and the standard deviation of its location distribution, where k is the number of points. The number of neighboring points, For point k neighborhood points to point average distance, For point To neighboring points Euclidean distance; S16, Determine the point Standardized distance between it and the mean of its neighborhood for: If point of If the value exceeds the preset threshold, then the point will be... Remove from 3D point cloud data.

7. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 6, characterized in that, In step S1, after noise reduction, an adaptive downsampling algorithm based on grid acceleration Poisson disk sampling is used. The specific steps are as follows: S17. Divide the point cloud space into a regular three-dimensional mesh structure to ensure that each mesh cell of the three-dimensional mesh structure can only contain one sampling point; map the spatial coordinates of each point to the mesh index of the mesh cell, and use the mesh index of the mesh cell as the key and the point stored in the mesh cell as the value to store it as a sparse hash table structure. S18. Dynamically adjust the sampling radius based on the local density features of point clouds. for: For point Local density, This is the proportionality coefficient. For point The average distance to the k nearest neighbors; S19. Use hash table indexes to accelerate neighborhood queries and generate a uniform set of sampling points that satisfy the minimum distance constraint.