Automatic tool setting method for numerical control machine tool based on 3D visual guidance

By segmenting point clouds using 3D vision sensors and region growing algorithms, and combining this with a cylinder fitting algorithm to generate tool setting paths, the problem of unstable tool setting accuracy in traditional CNC grinding machines is solved, and efficient automatic tool setting is achieved.

CN121132514APending Publication Date: 2025-12-16CHONGQING UNIV OF TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511434186.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-06-28
Filing Date
2025-10-09
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

Traditional CNC grinding machine tool setting technology relies on human experience, resulting in unstable accuracy. Existing non-contact tool setting technology has limitations in recognizing the geometric features of complex workpieces, making it difficult to meet the requirements of high-precision grinding.

Method used

A 3D vision sensor is used to acquire 3D point cloud data of the workpiece and tool. The point cloud is segmented by a region growing algorithm and geometric parameters are obtained by combining a cylinder fitting algorithm. The tool setting path is generated and converted into NC code to achieve automatic tool setting.

Benefits of technology

It improves the tool setting accuracy and automation level of CNC machine tools, reduces manual intervention, and increases processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005626328020000021
    Figure BDA0005626328020000021
  • Figure BDA0005626328020000023
    Figure BDA0005626328020000023
  • Figure BDA0005626328020000024
    Figure BDA0005626328020000024
Patent Text Reader

Abstract

The invention discloses a numerical control machine tool autonomous tool setting method based on 3D visual guidance. The method comprises the following steps: firstly, acquiring three-dimensional point cloud data of a cutter and a workpiece by using a 3D visual sensor and preprocessing; then, segmenting the point clouds through a region growing algorithm, realizing the separation of the tool point clouds and the workpiece point clouds, and extracting the point clouds of each cylindrical section of the workpiece; thirdly, based on a cylinder fitting algorithm, cylinder model fitting is conducted on the segmented tool and workpiece point cloud, and geometric parameters such as the axis direction, the radius and the center coordinate are obtained; calculating a relative position relation between the tool and the workpiece according to the geometric parameters, generating a tool setting path and converting the tool setting path into an NC code; and finally, the NC code is transmitted to a grinding machine control system through a grinding machine communication module, and tool setting operation is completed. The automatic tool setting device has the advantages that the relative position relation between the workpiece and the tool can be automatically measured in the machining process, automatic and rapid tool setting is completed, and the machining quality and efficiency are guaranteed.
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:

[0006] A method for autonomous tool setting of CNC machine tools based on 3D vision guidance includes the following steps:

[0007] 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.

[0008] 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.

[0009] 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.

[0010] 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;

[0011] S5. The NC code is transmitted to the grinding machine control system through the grinding machine communication module to perform the tool setting operation.

[0012] 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.

[0013] Furthermore, in step S2, the step of segmenting the point cloud using a region growing algorithm is as follows:

[0014] S21. Perform normal estimation and curvature calculation on the point cloud data;

[0015] 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.

[0016] 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.

[0017] S24. For each point with an assigned category label, check all k nearest neighbors of that point, and identify the points with unassigned category labels and curvature κ. i Below the preset threshold κ t The points are added to the current region and assigned the same category identifier until the region stops growing;

[0018] 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.

[0019] 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.

[0020] 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.

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

[0022] Furthermore, in step S21, for each point p in the point cloud data... i The k-NN algorithm is used to search for and select the k nearest neighbors N from the neighborhood. i ={p1′,p2′,...,p′ k} and calculate the covariance matrix C of the neighborhood points. i Covariance matrix C i The definition is as follows:

[0023]

[0024] in, It is the mean of the neighborhood points:

[0025]

[0026] For the covariance matrix C i Perform eigenvalue decomposition to obtain three eigenvalues ​​λ1, λ2, λ3, where λ1 ≥ λ2 ≥ λ3; then point p i The direction of the normal is:

[0027] n i =v3

[0028] Point p i The curvature is:

[0029]

[0030] Where λ3 is the smallest eigenvalue of the covariance matrix, λ1+λ2+λ3 is the sum of the eigenvalues ​​of the covariance matrix, and v3 is the eigenvector related to the smallest eigenvalue λ3.

[0031] Furthermore, in step S3, the cylindrical model M is defined in the point cloud set P as follows:

[0032] M = {c, a, r, h}

[0033] 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;

[0034] When fitting the cylindrical model, the RANSAC algorithm is used to iteratively search for the optimal model parameters. In each iteration, the initial cylindrical model M is calculated based on randomly selected sample points. i In the preliminary cylindrical model M i In the middle, traverse the point cloud data and calculate any point p. j The distance d(p) to the surface of the cylinder j M i )satisfy:

[0035] d(p j M i )=|||(p j -c)-((p j -c)·a)||-r|

[0036] In the formula, (p j -c)·a represents point p j The projected length to the axis, ||(p j -c)-((p j -c)·a)|| represents the perpendicular distance from the point to the axis, and r is the radius of the cylinder; if d(p j M i If the value is less than the preset threshold ∈, then point p will be... j If a point is determined to be an interior point, then the set of interior points I is obtained. i for:

[0037] I i ={p j ∣d(p j M i )<∈,p j ∈P}

[0038] After iteration, the model with the most interior points is selected as the optimal solution.

[0039] 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.

[0040] Furthermore, the set of interior points I i any point p in j The normal is n j The expected normal vector of the model at this point is n. M The cosine similarity cosθ between the two is:

[0041]

[0042] Establish point pj The scoring function is:

[0043] S(p j )=(1-ω)d j +ω(1-|cosθ|)

[0044] In the formula, S(p) j ) represents point p j The score; ω is the consistency weight coefficient of the normal vector direction, which is in the interval [0,1]; d j Point p j The distance to the surface of the cylinder;

[0045] From the set of interior points I i Points with scores below the preset value will be deleted, and the interior point set I will be updated. i And after the iteration is complete, based on the updated set of interior points I i The model with the most interior points is selected as the optimal solution.

[0046] 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.

[0047] Furthermore, in step S1, the preprocessing includes depth threshold filtering of the point cloud data, the steps of which are as follows:

[0048] S11. Define a 3D point cloud dataset containing n points as P = {p1, p2, ..., p...} n}, any point p i The coordinates are (x i ,y i ,z i ), z i For depth information, let point p be represented. i Distance to the reference plane; extract depth information from all points to form a depth vector d = [d1, d2, ..., dn]. n ], where d i =|z i | represents point p i The absolute depth value;

[0049] S12. Construct a vector z = [z1, z2, ..., z2] containing the z-coordinates of all points. n ], and calculate the sample mean μ of vector z. z and sample standard deviation σ z , respectively represented as:

[0050]

[0051] In the formula, μz σ represents the average depth of the dataset along the Z-axis. z This indicates the degree of dispersion of data points around the average depth;

[0052] S13. Based on the sample mean μ z and sample standard deviation σ z The linear combination defines the dynamic depth threshold T. d for:

[0053] T d =μ z +kσ z

[0054] In the formula, k is an adjustable constant factor used to control the offset of the threshold relative to the average depth.

[0055] S14. Based on the dynamic depth threshold T d A binary mask m was constructed. i If point p i absolute depth value d i ≥T d Then m i =1, and set point p i Remove from 3D point cloud data, otherwise m i =0, keep the point p. i .

[0056] 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.

[0057] Furthermore, in step S1, after depth threshold filtering, the 3D point cloud data undergoes noise reduction processing, as follows:

[0058] S15. Determine any point p in the point cloud data. i The domain N k (p i The global mean of the average distances between all points within a given area. and standard deviation for:

[0059]

[0060] In the formula, and They represent point p respectively iThe average location of point p within its neighborhood and the standard deviation of its location distribution, where k is the value of point p. i The number of neighboring points, For point p i k neighborhood points to point p i The average distance, d ij =||p i -p j ||For point p i To the domain point p j Euclidean distance;

[0061] S16, Determine point p j The standardized distance ρ(p) between it and the mean of its neighborhood i )for:

[0062]

[0063] If point p j ρ(p) i If the value exceeds the preset threshold, then point p will be... j Remove from 3D point cloud data.

[0064] 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:

[0065] 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.

[0066] S18. Dynamically adjust the sampling radius r based on the local density features of point clouds. i for:

[0067]

[0068] ρ i Let P be the point i The local density, β is the proportionality constant, d i Let P be the point i The average distance to the k nearest neighbors;

[0069] S19. Use hash table indexes to accelerate neighborhood queries and generate a uniform set of sampling points that satisfy the minimum distance constraint.

[0070] 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

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

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

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

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

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

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

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

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

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

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

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

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

[0083] 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:

[0084] 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.

[0085] 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.

[0086] 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.

[0087] 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;

[0088] S5. The NC code is transmitted to the grinding machine control system through the grinding machine communication module to perform the tool setting operation.

[0089] 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.

[0090] In step S2, the point cloud segmentation using the region growing algorithm is as follows:

[0091] S21. Perform normal estimation and curvature calculation on the point cloud data;

[0092] 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.

[0093] 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.

[0094] S24. For each point with an assigned category label, check all k nearest neighbors of that point, and identify the points with unassigned category labels and curvature κ. i Below the preset threshold κ t The points are added to the current region and assigned the same category identifier until the region stops growing;

[0095] 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.

[0096] 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 computation and missegmentation, and enhances the method's adaptability to different geometric features.

[0097] 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.

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

[0099] In step S21, for each point p in the point cloud data i The k-NN algorithm is used to search for and select the k nearest neighbors N from the neighborhood. i ={p1′,p2′,...,p′ k} and calculate the covariance matrix C of the neighborhood points. i Covariance matrix C i The definition is as follows:

[0100]

[0101] in, It is the mean of the neighborhood points:

[0102]

[0103] For the covariance matrix C i Perform eigenvalue decomposition to obtain three eigenvalues ​​λ1, λ2, λ3, where λ1 ≥ λ2 ≥ λ3; then point p i The direction of the normal is:

[0104] n i =v3

[0105] Point p i The curvature is:

[0106]

[0107] Where λ3 is the smallest eigenvalue of the covariance matrix, λ1+λ2+λ3 is the sum of the eigenvalues ​​of the covariance matrix, and v3 is the eigenvector related to the smallest eigenvalue λ3.

[0108] In step S3, the cylindrical model M is defined in the point cloud set P as follows:

[0109] M = {c, a, r, h}

[0110] 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;

[0111] When fitting the cylindrical model, the RANSAC algorithm is used to iteratively search for the optimal model parameters. In each iteration, the initial cylindrical model M is calculated based on randomly selected sample points. i In the preliminary cylindrical model M i In the middle, traverse the point cloud data and calculate any point p. j The distance d(p) to the surface of the cylinder j M i )satisfy:

[0112] d(p j M i )=||(p j -c)-((p j -c)·a)||-r|

[0113] In the formula, (p j -c)·a represents point p j The projected length to the axis, ||(p j -c)-((p j -c)·a)|| represents the perpendicular distance from the point to the axis, and r is the radius of the cylinder; if d(p j M i If the value is less than the preset threshold ∈, then point p will be... j If a point is determined to be an interior point, then the set of interior points I is obtained. i for:

[0114] I i ={p j ∣d(p j M i )<∈,p j ∈P}

[0115] After iteration, the model with the most interior points is selected as the optimal solution.

[0116] 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.

[0117] Interior point set I iany point p in j The normal is n j The expected normal vector of the model at this point is n. M The cosine similarity cosθ between the two is:

[0118]

[0119] Establish point p j The scoring function is:

[0120] S(p j )=(1-ω)d j +ω(1-|cosθ|)

[0121] In the formula, S(p) j ) represents point p j The score; ω is the consistency weight coefficient of the normal vector direction, which is in the interval [0,1]; d j Point p j The distance to the surface of the cylinder;

[0122] From the set of interior points I i Points with scores below the preset value will be deleted, and the interior point set I will be updated. i And after the iteration is complete, based on the updated set of interior points I i The model with the most interior points is selected as the optimal solution.

[0123] 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.

[0124] In step S1, the preprocessing includes depth threshold filtering of the point cloud data, and the steps are as follows:

[0125] S11. Define a 3D point cloud dataset containing n points as P = {p1, p2, ..., p...} n}, any point p i The coordinates are (x i ,y i ,z i ), z i For depth information, let point p be represented. i Distance to the reference plane; extract depth information from all points to form a depth vector d = [d1, d2, ..., dn]. n ], where d i =|z i | represents point p i The absolute depth value;

[0126] S12. Construct a vector z = [z1, z2, ..., z2] containing the z-coordinates of all points. n ], and calculate the sample mean μ of vector z. z and sample standard deviation σ z , respectively represented as:

[0127]

[0128] In the formula, μ z σ represents the average depth of the dataset along the Z-axis. z This indicates the degree of dispersion of data points around the average depth;

[0129] S13. Based on the sample mean μ z and sample standard deviation σ z The linear combination defines the dynamic depth threshold T. d for:

[0130] T d =μ z +kσ z

[0131] In the formula, k is an adjustable constant factor used to control the offset of the threshold relative to the average depth.

[0132] S14. Based on the dynamic depth threshold T d A binary mask m was constructed. i If point p i absolute depth value d i ≥T d Then m i =1, and set point p i Remove from 3D point cloud data, otherwise m i =0, keep the point p. i .

[0133] 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.

[0134] In step S1, after depth threshold filtering, the 3D point cloud data undergoes noise reduction processing, as follows:

[0135] S15. Determine any point p in the point cloud data. i The domain N k (p iThe global mean of the average distances between all points within a given area. and standard deviation for:

[0136]

[0137] In the formula, and They represent point p respectively i The average location of point p within its neighborhood and the standard deviation of its location distribution, where k is the value of point p. i The number of neighboring points, For point p i k neighborhood points to point p i The average distance, d ij =||p i -p j ||For point p i To the domain point p j Euclidean distance;

[0138] S16, Determine point p j The standardized distance ρ(p) between it and the mean of its neighborhood i )for:

[0139]

[0140] If point p j ρ(p) i If the value exceeds the preset threshold, then point p will be... j Remove from 3D point cloud data.

[0141] 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:

[0142] 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.

[0143] S18. Dynamically adjust the sampling radius r based on the local density features of point clouds. i for:

[0144]

[0145] ρ i Let P be the point i The local density, β is the proportionality constant, d i Let P be the point i The average distance to the k nearest neighbors;

[0146] S19. Use hash table indexes to accelerate neighborhood queries and generate a uniform set of sampling points that satisfy the minimum distance constraint.

[0147] 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.

[0148] 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.

[0149] 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.

[0150] 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.

[0151] The fundamental principle of point cloud data acquisition involves capturing three-dimensional spatial information of objects or environments through 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 (x, y, z) on the surface of a target object, and may also 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.

[0152] 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.

[0153] 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.

[0154] 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 P = {p1, p2, ..., pn} containing n points. n}, where each point p i =(x i ,y i ,z i The value consists of three coordinates, representing the point's position in three-dimensional space. Specifically, z... i 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 d = [d1, d2, ..., dn]. n ], where d i =|z i | 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 the threshold range. Using the statistical principle of percentile calculation, a depth threshold T can be calculated. d This threshold ensures that at least p% of the points in the dataset have a depth less than or equal to it. Based on the calculated depth threshold T... d Construct a binary mask m, whose elements m i According to point p i depth d i With threshold T d The relation is assigned different values: if d i ≥T d Then m i =1 indicates that the depth of this point exceeds the threshold and it is not considered an object of interest; conversely, if d = 1, it means that the depth of this point exceeds the threshold and it is not considered an object of interest. i <T d Then m i A value of 0 indicates that the point is within the threshold range and is part of the target object. This process effectively achieves object separation and filtering based on depth information.

[0155] Dynamic Statistical Depth Threshold Filtering (DSDTF) aims to effectively focus on structures within a specific depth range. It constructs a vector z = [z1, z2, ..., z...]. n 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. z and sample standard deviation σ zThe results are obtained using the following formulas:

[0156]

[0157] Where, μ z This describes the average depth of the dataset along the Z-axis, while σ z This measures the dispersion of data points around the average depth. Based on the above statistics, a dynamic depth threshold T is set. d This threshold is defined by a linear combination of the mean and the standard deviation, specifically in the form:

[0158] T d =μ z +kσ z (3)

[0159] 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 m is constructed using this depth threshold. i By retaining m i For points where m = 1, delete those that do not satisfy m. i The point cloud is updated with points equal to 1, resulting in a filtered point cloud, such as... Figure 1 As shown.

[0160] From a computational efficiency perspective, DSDTF exhibits significant advantages over other complex algorithms. The core operations of this method involve only the calculation of the mean and standard deviation, with a time complexity of O(n), i.e., linear time complexity. Even with large-scale point cloud datasets, it ensures rapid data processing, thereby improving real-time processing capabilities and saving valuable computational resources for subsequent data analysis and modeling. The DSDTF method demonstrates good robustness and stability, providing consistent and reliable results when handling scenes with well-defined depth boundaries. Since it does not require data sorting, the computational burden is further reduced. 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.

[0161] 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.

[0162] 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:

[0163] For any point p in the point cloud i Define its neighborhood N k (p i ), that is, containing point p i The set of the k nearest surrounding points. Define p. i to its neighboring point p j The Euclidean distance is:

[0164] d ij =||p i -p j || (4)

[0165] For point p i Calculate the average distance from its neighboring points to the point:

[0166]

[0167] For each point, calculate the global mean of the average distances to all points in its neighborhood. and standard deviation

[0168]

[0169] in, and They represent point p respectively i The average location within its neighborhood and the standard deviation of its location distribution.

[0170] To effectively identify outliers, an index called the standard ratio ρ is introduced, which is used to measure the performance of point p. i The standardized distance between it and the mean of its neighborhood is calculated as follows:

[0171]

[0172] When ρ(p) i When the value exceeds a preset threshold, the point is considered an anomaly and removed from the original point cloud.

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

[0174] Table 1 Statistical Analysis of Filtering and Noise Reduction

[0175]

[0176]

[0177] 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.

[0178] 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.

[0179] 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.

[0180] 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 typically results in a time complexity as high as O(n^2). 2These algorithms suffer from significant efficiency degradation when processing large-scale point cloud data. 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, further increasing computational overhead and limiting the flexibility of spatial distribution.

[0181] 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.

[0182] 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.

[0183] 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.

[0184] 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.

[0185] 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.

[0186] 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.

[0187]

[0188] 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.

[0189] 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: p min =(x min ,y min ,z min If the side length of a grid cell is h, then the grid index (i,j,k) of any point p = (x,y,z) can be calculated using the following formula:

[0190]

[0191] 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.

[0192] 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 3As 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.

[0193] The use of hash tables avoids the storage overhead of unaccessed grid cells and can quickly locate the grid cell containing the point with a time complexity close to O(1). This characteristic of grid partitioning gives Poisson disk sampling efficient data management capabilities.

[0194] During the sampling process, the verification of new candidate points requires checking whether they meet the minimum distance constraint. Since the grid cell design ensures that there are no conflict points within the same cell, the verification process only needs to check the grid cell containing the candidate point and its neighboring grid cells. The neighborhood of a grid cell can be viewed as a 3×3×3 cube centered on that cell. Assuming the grid index of the candidate point is (i,j,k), then the neighborhood to be checked contains 3×3×3 = 27 grid cells centered at (i,j,k). The verification process first extracts the set of sampled points already stored in these grid cells. Let the candidate point be P. c Sampling point P s The Euclidean distance between the candidate points and these sampling points is calculated using the following formula:

[0195]

[0196] If all distances satisfy d≥r, the candidate point is validated and added to the sampling point set; otherwise, the candidate point is discarded. The validation 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.

[0197] 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.

[0198] 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 calculation is performed on all sampled points, the computational complexity will reach O(n^2). 2 When processing large-scale point cloud data, this can lead to a severe performance bottleneck. The algorithm transforms the global verification problem into a local neighborhood query by partitioning the data into a grid, thus significantly reducing computational complexity. The grid partitioning combined with 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 the complexity from O(n^2) to O(n^2). 2 The value is reduced to O(K), which is proportional to the number of neighboring points, where K represents the number of points in the neighborhood of a candidate point.

[0199] 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.

[0200] 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:

[0201] 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 [x...]. min ,x max ]、[y min ,y max ]、[zmin ,z max Its volume is:

[0202] V=(x max -x min )·(y max -y min )·(z max -z min (13)

[0203] Global average density ρ of point cloud avg It can be calculated from the total number of points N and the volume V:

[0204]

[0205] 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... i Define it as point P. i The average distance d between its k nearest neighbors i The local density is a function of . It can be estimated using the following formula:

[0206]

[0207] This formula reflects the number of data points contained within a unit volume of the sphere, i.e., the local point cloud density.

[0208] To adapt to different application scenarios, a scaling factor β is introduced to adjust the sampling radius r. i This is to achieve the capture of features at different scales. Sampling radius r i The calculation is based on the local density ρ i The inverse cube root of is given by the following formula:

[0209]

[0210] 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.

[0211] 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.

[0212] 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:

[0213] (1) Direction Vector Generation: Given a random number generator that can generate pseudo-random numbers u and υ uniformly distributed in the interval [0,1), the following formula can be used to generate a direction vector uniformly distributed on the sphere:

[0214] φ=arccos(1-2u) (17)

[0215] θ=2πυ (18)

[0216] Where φ and θ are the polar angle and azimuth angle of the spherical direction, respectively. The generated direction vector is:

[0217]

[0218] (2) Direction Vector Selection: When generating candidate points, a direction vector is randomly selected from the pre-generated set. This selection is then combined with the current sampling point's position and the dynamically adjusted sampling radius to generate candidate points. Through this direction pre-generation strategy, the generated candidate points have more uniform directions, avoiding sampling blind spots that might result from completely random generation.

[0219] 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:

[0220]

[0221] 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.

[0222] 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.

[0223] Table 2. Impact of the Number of Neighborhood Query Points on Downsampling Effect

[0224]

[0225] 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.

[0226] 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.

[0227] In the sampling experiment of single-workpiece point cloud data, the original point cloud data contained 75,864 points. After adaptive mesh-accelerated 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.

[0228] 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.

[0229] 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.

[0230] 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.

[0231] 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.

[0232] 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.

[0233] Normal estimation is fundamental to region growing algorithms, and its purpose is to determine the local geometric properties of each point in a point cloud. Let the point cloud be P = {p1, p2, ..., p...} n For each point p i The k-NN algorithm is used to search for and select the k nearest neighbors N from its neighborhood. i={p1′,p′2,...,p′ k} and calculate the covariance matrix C of these neighborhood points. i The matrix is ​​defined as follows:

[0234]

[0235] in, It is the mean of the neighborhood points:

[0236]

[0237] By analyzing the covariance matrix C i Eigenvalue decomposition yields three eigenvalues ​​λ1, λ2, and λ3 (assuming λ1 ≥ λ2 ≥ λ3). The corresponding eigenvector v3 (related to the smallest eigenvalue λ3) is the point p. i Normal direction:

[0238] n i =v3 (23)

[0239] 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.

[0240] 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 point p... i The curvature is defined as follows:

[0241]

[0242] Where λ3 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 λ1+λ2+λ3 is the sum of the eigenvalues ​​of the covariance matrix, reflecting the overall distribution range of the point cloud in the local neighborhood.

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

[0244] 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 each point p in the point cloud. i If the point has not yet been labeled and its curvature κ iBelow the preset threshold κ t 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 nearest neighbor is also unlabeled and its curvature is less than the threshold κ, the search continues. t 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.

[0245] It is worth noting that once a region stops growing, it is also necessary to assess whether its size has reached the minimum cluster size requirement N. min 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.

[0246] 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.

[0247] 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.

[0248] 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.

[0249] Based on the candidate point set, the algorithm further utilizes a spatial grid partitioning strategy to uniformly distribute seed points:

[0250] (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 P = {p1, p2, ..., p...} n}, where each point p i The three-dimensional coordinates are (x i ,y i ,z iThe bounding box extent is defined by calculating the minimum and maximum values ​​of the point cloud in each dimension.

[0251] 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 r × r × r, and each unit is uniquely represented by its three-dimensional index (i, j, k) in the mesh, where:

[0252]

[0253] (2) Seed point selection: For each voxel unit, extract all points within that unit as a candidate point set V. ijk In the candidate point set, the point with the smallest curvature is preferentially selected as the seed point for that voxel:

[0254]

[0255] Here, κ(p) is the curvature value of point p. If there are no points within a voxel, then no seed point is generated for that voxel.

[0256] 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.

[0257] 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.

[0258] 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.

[0259] 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.

[0260] Table 3 Comparison of Point Cloud Segmentation Algorithms

[0261]

[0262] 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.

[0263] Table 4 Performance Comparison of Point Cloud Segmentation Algorithms

[0264]

[0265] 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.

[0266] 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.

[0267] 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.

[0268] Table 5 Performance Comparison of Point Cloud Segmentation Algorithms under Noisy Environments

[0269]

[0270] 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.

[0271] 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.

[0272] 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.

[0273] 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.

[0274] Let each point in the point cloud be p. i =(x i ,y i ,z i Estimate the normal vector This can be obtained by fitting a local plane using the least squares method. Assume that at p... i There is a local neighborhood containing the point set {p1, p2, ..., p}. k}, 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:

[0275]

[0276] 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.

[0277] 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.

[0278] 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:

[0279] Given a point cloud set P, define a cylindrical model M, which is represented as:

[0280] M = {c, a, r, h} (28)

[0281] Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector per unit length, r represents the radius of the cylinder, and h represents the height of the cylinder.

[0282] 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 M is calculated based on these points. i Iterate through all point cloud data. For any point p... j The distance d(p) from it to the surface of the cylinder j M i It can be calculated using the following formula:

[0283] d(p j M i )=|||(p j -c)-((p j -c)·a)||-r| (29)

[0284] Here, (p j -c)·a represents point p j The projected length to the axis, and ||(p j -c)-((p j -c)·a)|| 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 ∈, point p... j Considered as interior points, i.e., a cylindrical model that conforms to the current assumptions, we can define a set of interior points I. i as follows:

[0285] I i ={p j ∣d(p j M i )<∈,p j ∈P} (30)

[0286] 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.

[0287] 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 point p... j The normal is n j The expected normal vector of the model at this point is n. M Then the cosine similarity cosθ between the two can be given by the following formula:

[0288]

[0289] By introducing a consistency weight ω for the normal vector direction, the scoring function will no longer depend solely on the distance d from the point to the model. j Instead, it takes into account both distance and consistency of normal direction:

[0290] S(p j )=(1-ω)d j +ω(1-|cosθ|) (32)

[0291] Where S(p) j ) represents point p j The score is calculated using the weighting factor ω, which is the weighting factor within the interval [0,1]. When ω is close to 1, the consistency of the normal vector direction has a greater impact on the score; while when ω is close to 0, the score mainly depends on the distance factor. This mechanism helps to eliminate outliers that are close in location but have significantly different normal vector directions, thereby improving the accuracy of the model fitting.

[0292] 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.

[0293] 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:

[0294] M = {c, a, r, h} (33)

[0295] Where c is the coordinate vector of a point on the cylinder axis, a is the cylinder axis vector per unit length, r represents the radius of the cylinder, and h represents the height of the cylinder.

[0296] 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.

[0297] Let p be a point on the surface of the cylinder. j Described by the following parameterized formula:

[0298] p j (θ,t)=c+t·a+r(cosθ·u+sinθ·v) (34)

[0299] Where θ∈[0,2π] is a parameter of the circle, which determines the 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.

[0300] Specifically, the unit vectors u and v can be calculated from the axis vector a in the following way:

[0301]

[0302] v = a × u (36)

[0303] Where × represents the cross product operation, and u and v are two unit vectors perpendicular to the axis, which determine the orientation of the cylindrical cross section.

[0304] Using the above formula, any point on the cylindrical surface can be uniquely represented by the parameters θ and t.

[0305] 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.

[0306] By discretizing the parameters θ and t, and choosing appropriate step sizes Δθ and Δt, multiple discrete points on the surface of the cylinder can be generated. For each cross-section of the cylinder, θ is discretized into N points, i.e.:

[0307]

[0308] For each θ i The coordinates of the corresponding cross-sectional points can be calculated using the parameterized formulas described above.

[0309] For discretization along the axis, let:

[0310]

[0311] M represents the number of discretization points along the axis of the cylinder, then t j The cylinder's axial direction is discretized using these discrete points, representing its position along the axis. This results in a gridded set of points, where the position of each point is determined by θ. i and t j Determined. For each t j We can calculate the cross-section of a circle with a point set of N, where the coordinates of each point are:

[0312] p i,j =(r·cosθ) i ,r·sinθ i ,t j (39)

[0313] Where r is the radius of the cylinder.

[0314] Based on the discretized point set of the cylinder, these points need to be connected into a triangular mesh. The triangular mesh can be constructed by connecting points on adjacent circles into triangles. For each pair of adjacent circles t... j and t j+1 Point p on it i,j and p i,j+1 It needs to be connected to adjacent points. Assume p i,j and p i,j+1 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.

[0315] The process of constructing the triangular mesh for each pair of adjacent points is as follows:

[0316] Assuming the cross-section of the cylinder is a circle, after discretization, each point on the circumference can be represented as:

[0317] p i,j =(r·cosθ) i ,r·sinθ i ,t j (40)

[0318] Where t j θ represents the height discretization point along the axis of the cylinder. i This represents the discretized point of the circumference angle.

[0319] (1) For each pair of adjacent circumferences t j and t j+1 Point p on each circle i,j and p i,j+1 Point p on the adjacent circle i+1,j and p i+1,j+1It forms a quadrilateral.

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

[0321] 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.

[0322] 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.

[0323] 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.

[0324] Table 6. Fitting accuracy of cylinder diameter using different algorithms

[0325]

[0326] Table 7. Fitting accuracy of cylinder length using different algorithms

[0327]

[0328] 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.

[0329] 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.

[0330] 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.

[0331] 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.

[0332] 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. The NC code is transmitted to the grinding machine control system through the grinding machine communication module to perform the tool setting operation.

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 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 the points with unassigned category labels and curvature κ. i Below the preset threshold κ t 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 method for autonomous tool setting of 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 p in the point cloud data i The k-NN algorithm is used to search for and select the k nearest neighbors N from the neighborhood. i ={p1′,p2′,...,p′ k } and calculate the covariance matrix C of the neighborhood points. i Covariance matrix C i The definition is as follows: in, It is the mean of the neighborhood points: For the covariance matrix C i Perform eigenvalue decomposition to obtain three eigenvalues ​​λ1, λ2, λ3, where λ1 ≥ λ2 ≥ λ3; then point p i The direction of the normal is: n i = v3 Point p i The curvature is: Where λ3 is the smallest eigenvalue of the covariance matrix, λ1+λ2+λ3 is the sum of the eigenvalues ​​of the covariance matrix, and v3 is the eigenvector related to the smallest eigenvalue λ3.

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 S3, the cylindrical model M is defined in the point cloud set P as follows: M = {c, a, r, h} 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, the initial cylindrical model M is calculated based on randomly selected sample points. i In the preliminary cylindrical model M i In the middle, traverse the point cloud data and calculate any point p. j The distance d(p) to the surface of the cylinder j M i )satisfy: d(p j ,M i )=|||(p j -c)-((p j -c)·a)||-r| In the formula, (p j -c)·a represents point p j The projected length to the axis, ||(p j -c)-((p j -c)·a)|| represents the perpendicular distance from the point to the axis, and r is the radius of the cylinder; if d(p j M i If the value is less than the preset threshold ∈, then point p will be... j If a point is determined to be an interior point, then the set of interior points I is obtained. i for: I i ={p j ∣d(p j ,M i )<∈,p j ∈P} After iteration, the model with the most interior points is selected as the optimal solution.

6. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 5, characterized in that, Interior point set I i any point p in j The normal is n j The expected normal vector of the model at this point is n. M The cosine similarity cosθ between the two is: Establish point p j The scoring function is: S(p j )=(1-ω)d j +ω(1-|cosθ|) In the formula, S(p) j ) represents point p j The score; ω is the consistency weight coefficient of the normal vector direction, which is in the interval [0,1]; d j Point p j The distance to the surface of the cylinder; From the set of interior points I i Points with scores below the preset value will be deleted, and the interior point set I will be updated. i And after the iteration is complete, based on the updated set of interior points I i The model with the most interior points is selected as the optimal solution.

7. The autonomous tool setting method for 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 P = {p1, p2, ..., p...} n }, any point p i The coordinates are (x i ,y i ,z i ), z i For depth information, represent point p i Distance to the reference plane; extract depth information from all points to form a depth vector d = [d1, d2, ..., dn]. n ], where d i =|z i | represents point p i The absolute depth value; S12. Construct a vector z = [z1, z2, ..., z2] containing the z-coordinates of all points. n ], and calculate the sample mean μ of vector z. z and sample standard deviation σ z , respectively represented as: In the formula, μ z σ represents the average depth of the dataset along the Z-axis. z This indicates the degree of dispersion of data points around the average depth; S13. Based on the sample mean μ z and sample standard deviation σ z The linear combination defines the dynamic depth threshold T. d for: T d =μ z +kσ z 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 T d A binary mask m was constructed. i If point p i absolute depth value d i ≥T d Then m i =1, and set point p i Remove from 3D point cloud data, otherwise m i =0, keep the point p. i .

8. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 7, 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 p in the point cloud data. i The domain N k (p i The global mean of the average distances between all points within a given area. and standard deviation for: In the formula, and They represent point p respectively i The average location of point p within its neighborhood and the standard deviation of its location distribution, where k is the value of point p. i The number of neighboring points, For point p i k neighborhood points to point p i The average distance, d ij =||p i -p j ||For point p i To the domain point p j Euclidean distance; S16, Determine point p j The standardized distance ρ(p) between it and the mean of its neighborhood i )for: If point p j ρ(p) i If the value exceeds the preset threshold, then point p will be... j Remove from 3D point cloud data.

9. The autonomous tool setting method for CNC machine tools based on 3D vision guidance as described in claim 8, 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 r based on the local density features of point clouds. i for: ρ i Let P be the point i The local density, β is the proportionality constant, d i Let P be the point i 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.

Citation Information

Cited By

  • Automatic tool setting system of surface grinding machine and contact type tool setting positioning method of automatic tool setting system

    CN121733432A

  • An automatic tool setting system for a surface grinder and its contact-type tool setting and positioning method

    CN121733432B