Triangulation method of scattered point clouds based on support vector machine
Through the indirect triangulation method and data compression technology of LS-SVM, the difficulty of triangulating scattered data points in the spatial domain is solved, and a regular, uniform, and high-precision three-dimensional triangular mesh is generated, avoiding the problems of singular meshes and holes.
Patent Information
- Application Number
- CN202110097019.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-25
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-01-25
AI Technical Summary
When the existing technology processes the triangulation of scattered data points in the spatial domain, especially when it is non-uniformly distributed, redundant or locally incomplete data, it is easy to generate singular triangular grids or holes, and the effect is not ideal.
The indirect triangulation method based on the least squares support vector machine (LS-SVM) is used to divide the data blocks for triangulation through data compression and surface fitting, and generate a triangular mesh in the plane domain. Combined with the Delaunay triangulation method, it ensures accuracy of topological relationships.
It achieves good adaptability when processing redundant or partially incomplete data, avoids the generation of singular triangular meshes and holes, and obtains regular, uniform, and high-precision three-dimensional triangular meshes.
Smart Images

Figure CN112767552B
Abstract
Description
Technical field:
[0001] The invention relates to a scattered point cloud triangulation method based on support vector machine. Background technology:
[0002] At present, in the fields of industrial product design, medical testing, digital human model establishment, three-dimensional map drawing, etc., it is necessary to obtain the surface shape information of the physical model. Commonly used surface information acquisition equipment is three-dimensional coordinate measuring machine, laser scanner and computerized tomography (CT). The data points obtained by these devices are in different forms. The data obtained by three-dimensional coordinate measuring machine and CT are distributed on parallel plane faults, and have a certain organizational regularity locally. However, from a global perspective, the data points obtained by these three devices are scattered. In the subsequent process of completing the surface continuity reconstruction, it is necessary to describe the topological relationship between these scattered data points. Triangulation is to connect the data points with triangles to form a triangular mesh, and establish the topological connection relationship between each data point and its neighboring points to reveal the shape and topological structure of the original surface represented by the scattered data points.
[0003] According to the different dimensions of the processed data points, the triangulation of scattered data can be divided into two types of algorithms: plane domain and space domain. Most of the triangulation of scattered data in the plane domain uses the Delaunay triangulation algorithm and its optimization criteria, which are relatively mature. However, for scattered data points in the space domain, the topological relationship between them is more complex. If the same triangulation algorithm as that of two-dimensional data is used, it is difficult to achieve the desired effect. Therefore, the triangulation theory and algorithm for scattered spatial data points are still imperfect and need further research. In particular, when the measurement points are unevenly distributed, contain redundant data or are partially incomplete, the existing direct triangulation algorithm is prone to generate singular triangular meshes or holes. Summary of the invention:
[0004] In view of the deficiencies in the above-mentioned prior art, the present invention studies the triangulated mesh generation method for single-valued point cloud data commonly used in engineering practice. For non-single-valued point clouds, they can be divided into multiple single-valued point clouds and triangulated separately. The present invention proposes an indirect triangulation method for spatial scattered data based on the least squares support vector machine (abbreviated as "LS-SVM"), which still has good adaptability when processing redundant or partially incomplete data, and is not easy to generate singular triangulated meshes or holes.
[0005] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is:
[0006] The scattered point cloud triangulation method based on support vector machine includes boundary feature extraction of single-value point cloud data in Z direction, generation of triangular mesh in plane domain, surface fitting based on LS-SVM, and generation of triangular mesh in space domain by three-dimensional mapping; before surface fitting, the raw data is compressed to filter out redundant information in the raw data, and the data compression is performed based on LS-SVM method, as follows:
[0007] (1) Point cloud segmentation: The data points in the original data point cloud are divided into several data blocks. The number of data points in each data block is less than the maximum number of data points in a given block, and D data blocks that meet the requirements are obtained;
[0008] (2) Intra-block pruning: Use LS-SVM to fit each data block separately and calculate the Lagrange multiplier α i , and press |α i | Arrange in descending order from large to small. Suppose the compression rate is k, k<1, and the number of data points in the data block before compression is r, then the last k·r points|α i |The corresponding data points are deleted to obtain compressed data points, the number of which is r(1-k);
[0009] (3) Accuracy test: Merge the D data blocks that have undergone intra-block pruning to obtain the compressed data point set S n , LS-SVM is used for fitting, and the overall surface model z = f(x, y) fitting the scattered point cloud data is obtained; the allowable value of the fitting error is ε, for S n Any point P in i (x i ,y i ,z i ), and calculate the fitting error e=|z i -f(x i ,y i )|, if e≤ε, the data compression is reasonable, otherwise reduce the compression ratio k and compress again.
[0010] Furthermore, the specific method of point cloud segmentation is as follows: Assume that the original measured point cloud S c There are m data points in total, and the maximum number of data points in a given block is m max , if m>m max , then project it along the Z direction to obtain the point set S in the XY plane p ; Find the boundary of the plane area along the X direction, that is, x min , x max ; Divide it into 2 pieces along the X direction, and we get: and set up The number of data points in are and like or Then or Then divide it in half along the Y direction until the number of points in each data block is less than m max , then stop segmentation, and the number of data blocks obtained by segmentation is D.
[0011] Furthermore, the plane domain triangular mesh generation includes plane rectangular domain triangular mesh generation and plane triangular mesh clipping. The clipping process is divided into boundary preprocessing and mesh clipping. The boundary preprocessing steps are as follows:
[0012] (1) At the Y-direction boundary [y min ,y max ] is the distance between the straight lines d y Generate Q straight lines L parallel to the X axis at intervals i ;
[0013] (2) Calculate the intersection points between each straight line and the initial boundary polygon: When the line segment between two adjacent points on the original boundary intersects L i When they coincide, take their endpoints as the i The intersection of
[0014] (3) Eliminate redundant points and establish the adjacency relationship between new boundary point sequences based on the principle of the shortest distance: Eliminate redundant points means that in the new boundary point sequence, when the distance between adjacent points is less than the point cloud density, the latter point is eliminated;
[0015] The mesh clipping processes each triangle according to the relative position relationship between the triangle vertices and the boundary polygons.
[0016] Furthermore, the specific method of mesh clipping is as follows: let the three vertices of the triangle be V i , i = 1, 2, 3, let the boundary polygon be L, then the following function can be used to describe V i Position relationship with L:
[0017]
[0018] Assume B ij The two vertices V of the triangle i 、V j An edge between, i,j = 1,2,3, then the following function can be used to describe B ij Position relationship with L:
[0019]
[0020] The two position relationship functions given above are used to process the triangular mesh in the following situations:
[0021] When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3,L)=0, delete the three vertices of the triangle;
[0022] When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3,L)=1, we need to combine the Intersect function to make a judgment: Let InorOut(V1,L)=1, if Intersect(B 12 ,L)=1 and Intersect(B 13 , L)=1, then the intersection points D1 and D2 replace V2 and V3 to generate a new triangle V1D1D2; if Intersect(B 12 ,L)=0orIntersect(B 13 ,L)=0, then delete the three vertices of the triangle;
[0023] When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3 L)=2, we also need to combine the Intersect function to make a judgment: Let InorOut(V1,L)=0, if Intersect(B 12 ,L)=1 and Intersect(B 13 ,L)=1, then replace the original triangle with two triangles △V2D1V3 and △D1D2V3; if Intersect(B 12 ,L)=1 and Intersect(B 13 ,L)=0, then replace the original triangle with △V2D1V3; if Intersect(B 12 ,L)=0 and Intersect(B 13 ,L)=1, then replace the original triangle with △V2D2V3; if Intersect(B 12 ,L)=0 and Intersect(B 13 ,L)=0, then delete the three vertices of the triangle;
[0024] When InorOut(V1, L)+InorOut(V2, L)+InorOut(V3 L)=3, the three vertices of the triangle are retained.
[0025] Furthermore, the specific method for generating a triangular mesh in the plane rectangular domain is as follows:
[0026] Let the original point set be S 3 = {P i 3}, P i 3=(x i ,y i ,z i ), i = 1, 2, ..., N, N is the number of measurement points, then the steps to generate a triangular mesh in a plane rectangular domain are as follows:
[0027] (1) Project it along the Z direction to obtain the point set S in the XY plane 2 = {P i 2}, P i 2 =(x i ,y i ), and find the boundary x of the plane area along the X and Y directions min 、x max ,y min ,y max ;
[0028] (2) Estimation of point cloud density ρ: From S 2 Randomly select p points, p≤N, calculate the distance between each point and the remaining N-1 points, and take the minimum value d jmin , j = 1, 2, ..., p, then the point cloud density
[0029] (3) Data resampling: In y min ,y max Between, generate Q straight lines parallel to the X-axis at equal intervals, where:
[0030] Q = int[(y max -y min ) / ρ+0.5]+1
[0031] The distance between the lines is d y =(y max -y min ) / (Q-1), the Y coordinates of each point on the i-th straight line are:
[0032] y i =y min +d y (i-1)
[0033] For each straight line, min 、x max Generate line segments for the boundary, sample data points on each line segment, and the number of data points is M:
[0034] M=int[(x max -x min ) / ρ+0.5]+1
[0035] The distance between each point is d x =(xmax -x min ) / (M-1), the X coordinate of the jth data point is:
[0036] x j =x min +d x (j-1)
[0037] (4) Generating triangular mesh: After resampling, the Q·M data points are arranged regularly along the X and Y directions. The Delaunay triangulation method is applied to generate a triangular mesh in the plane domain, which is denoted as
[0038] Further, the surface fitting method based on LS-SVM is as follows:
[0039] For m n-dimensional sample vectors where x i ∈R n ,y i ∈R, let the regression function be in the form of:
[0040]
[0041] in It is a nonlinear mapping function that can map the input sample data to the corresponding high-dimensional feature space. This regression function can be obtained by solving the following optimization model:
[0042]
[0043] In the formula, w is the weight vector, C is the penalty factor, b is the deviation, ζ i is the slack variable; by using the Lagrange multiplier method and Mercer conditions, the optimization problem expressed in equation (2) can be transformed into solving the following linear equations:
[0044]
[0045] In the formula α=(α1,α2,...,α m ) T , α is the Lagrange multiplier, I is the identity matrix, k is the kernel function, k(x i ,x j )=φ(x i ) T ·φ(x j ), i, j=1,2,…,m, y=[y1,y2,…,y m ] T ;
[0046] Solving equation (3), we can get b and α, and the regression function can be expressed as:
[0047]
[0048] When a scattered point set S is given 3 = {P i 3}(P i 3 =(x i ,y i ,z i ), i=1,2,...,m, m is the number of measurement points, X i =(x i ,y i ) as the input value of the sample vector, Y i =z i As the output value of the sample vector, the α and b values are obtained by formula (3), and the α and b values are substituted into formula (4) to obtain the LS-SVM surface fitting the scattered point data.
[0049] Furthermore, when solving equation (3), it is necessary to define the kernel function and select the radial basis kernel function
[0050] Furthermore, the specific method of generating a triangular mesh in the spatial domain by three-dimensional mapping is as follows: 2 Then, the three vertices of each triangle mesh The X and Y coordinate values (x i ,y i )、(x j ,y j )、(x k ,y k ) values are respectively substituted into formula (4) to obtain the corresponding Z coordinate value, keeping the topological connection relationship between the vertices unchanged, and the spatial domain triangular mesh can be obtained.
[0051] Furthermore, after obtaining the three-dimensional mesh in the spatial domain, in order to control the approximation accuracy of the triangular mesh to the original data, an accuracy test is required. The method is as follows:
[0052] (1) For the original point set S 3 = {P i 3 Any data point P in i 3 , determine in which triangle mesh it is located in the XY plane, when Time, remember
[0053] (2) Calculation point P i 3 to The distance e of the plane i , assuming the approximation error allowable value is e r , if e i >e r , then in Insert a vertex at the center of gravity Generate three triangles;
[0054] (3) Calculate the insertion vertex using formula (4) The Z coordinate value of the triangle mesh in the space domain is obtained;
[0055] For S 3 = {P i 3 The above judgment is performed for each point in}, and local mesh densification is performed to ensure the approximation accuracy of the triangular mesh to the original data.
[0056] The present invention proposes a method for triangulating scattered spatial point clouds with a least squares support vector machine model as a mapping function. The method uses incomplete point clouds with locally incomplete or redundant information in space as input data. Through the three-dimensional mapping technology of two-dimensional grids, a regular, uniform, high-precision, and high-quality grid can be automatically obtained. All grid shapes conform to the Delaunay principle and can be widely used in the fields of engineering data visualization and reverse engineering.
[0057] The present invention is further described below through the accompanying drawings and specific embodiments. Description of the drawings:
[0058] Figure 1 is a flow chart of the triangulation method of the present invention;
[0059] Figure 2 is a flow chart of a data compression method in a triangulation method of the present invention;
[0060] Figure 3 This is an example of generating new triangles when InorOut = 1 during mesh clipping;
[0061] Figure 4 This is an example of how new triangles are generated when InorOut = 2 during mesh clipping.
[0062] Figure 5 A schematic diagram of the original measurement points in an example of the method of the present invention;
[0063] Figure 6 This is a schematic diagram of the boundary extraction result in an example of the method of the present invention;
[0064] Figure 7 A schematic diagram of a triangular mesh after clipping in a plane domain in an example of the method of the present invention;
[0065] Figure 8 A schematic diagram of compressed data points in an example of the method of the present invention;
[0066] Fig. 9 This is a schematic diagram of the surface fitting in an example of the method of the present invention;
[0067] Fig.10 This is a schematic diagram of a spatial triangular mesh generated in an example of the method of the present invention. Specific implementation method:
[0068] This embodiment discloses a method for triangulating scattered point clouds based on a support vector machine. Figure 1 As shown in the figure, it mainly includes boundary feature extraction of single-value point cloud data in the Z direction, generation of triangular mesh in the plane domain, surface fitting based on LS-SVM, and generation of triangular mesh in the space domain through three-dimensional mapping. This method first finds the minimum rectangular bounding box of the original point cloud data in the plane, resamples the data points in this bounding box with the minimum point cloud density mean in the original data, and generates a plane triangular mesh; the triangular mesh in the plane quadrilateral domain is clipped with the original point cloud boundary polygon to obtain the triangular mesh in the actual boundary domain; then the least squares support vector machine is applied to fit the compressed original three-dimensional point cloud, and the triangular mesh in the plane domain is mapped to the space through this fitting model to obtain a triangular mesh in the three-dimensional space. The specific contents of each of the above steps will be explained in detail below.
[0069] Before introducing the core content of the present invention, the surface fitting method using LS-SVM is first introduced: LS-SVM replaces the inequality constraints in the traditional support vector machine calculation model with equality constraints, and uses the error square sum loss function as the empirical loss of the training set. Through this transformation, the quadratic programming problem in the traditional support vector machine solution process is transformed into a linear equation system solution, which reduces the computational complexity and improves the solution speed and convergence accuracy.
[0070] For m n-dimensional sample vectors where x i ∈R n ,y i ∈R, let the regression function be in the form of:
[0071]
[0072] in It is a nonlinear mapping function that can map the input sample data to the corresponding high-dimensional feature space. This regression function can be obtained by solving the following optimization model:
[0073]
[0074] In the formula, w is the weight vector, C is the penalty factor, b is the deviation, ζi is the slack variable; by using the Lagrange multiplier method and Mercer conditions, the optimization problem expressed in equation (2) can be transformed into solving the following linear equations:
[0075]
[0076] In the formula α=(α1,α2,...,α m ) T , α is the Lagrange multiplier (the parameter α and the symbols with subscripts in the present invention all represent Lagrange multipliers), I is the identity matrix, k is the kernel function, k(x i ,x j )=φ(x i ) T ·φ(x j ), i, j=1,2,…,m, y=[y1,y2,…,y m ] T ;
[0077] Solving equation (3), we can get b and α, and the regression function can be expressed as:
[0078]
[0079] When a scattered point set S is given 3 = {P i 3}(P i 3 =(x i ,y i ,z i ), i=1,2,...,m, m is the number of measurement points, X i =(x i ,y i ) as the input value of the sample vector, Y i =z i As the output value of the sample vector, the α and b values are obtained by equation (3). Substituting the α and b values into equation (4), the LS-SVM surface fitting the scattered point data can be obtained. When solving equation (3), it is necessary to define the kernel function. Generally, the radial basis kernel function is selected. A better fitting effect can be obtained.
[0080] In the data preprocessing stage, for the single-valued point cloud data in the Z direction, when extracting its boundary feature points, the following existing steps can be followed: point cloud projection to the XY plane, cell division, boundary cell extraction, actual boundary point extraction in the boundary cell, and topological sorting of boundary feature points. This part belongs to the prior art, and this embodiment will not be described in detail.
[0081] The original data points obtained by using surface data acquisition equipment are generally dense and contain more redundant information. If the original data points are directly used for surface fitting, the calculation efficiency will be reduced. Therefore, it is necessary to adopt an appropriate data compression algorithm to filter out the redundant information in the original data as much as possible while ensuring the accuracy of the point cloud in expressing the surface shape. Therefore, the present invention proposes a data compression algorithm based on LS-SVM pruning, such as Figure 2 The specific contents are as follows:
[0082] (1) Point cloud segmentation: Assume that the original measured point cloud S c There are m data points in total, and the maximum number of data points in a given block is m max , if m>m max , then project it along the Z direction to obtain the point set S in the XY plane p ; Find the boundary of the plane area along the X direction, that is, x min , x max ; Divide it into 2 pieces along the X direction, and we get: and set up The number of data points in are and like or Then or Then divide it in half along the Y direction until the number of points in each data block is less than m max , then stop segmentation, and the number of data blocks obtained by segmentation is D.
[0083] (2) Intra-block pruning: Use LS-SVM to fit each data block separately and calculate α i , and press |α i | Arrange in descending order from large to small. Suppose the compression rate is k, k<1, and the number of data points in the data block before compression is r, then the last k·r points|α i |The corresponding data points are deleted to obtain compressed data points, the number of which is r(1-k).
[0084] (3) Accuracy test: Merge the D data blocks that have undergone intra-block pruning to obtain the compressed data point set S n , LS-SVM is used for fitting, and the overall surface model z = f(x, y) fitting the scattered point cloud data is obtained; the allowable value of the fitting error is ε, for S n Any point P in i (x i ,y i ,z i ), and calculate the fitting error e=|z i -f(x i ,yi )|, if e≤ε, the data compression is reasonable, otherwise reduce the compression ratio k and compress again.
[0085] The method of generating a triangular mesh in a plane domain is as follows:
[0086] Let the original point set be S 3 = {P i 3}, P i 3 =(x i ,y i ,z i ), i = 1, 2, ..., N, N is the number of measurement points. Then the steps to generate a triangular mesh in a plane rectangular domain are as follows:
[0087] (1) Project it along the Z direction to obtain the point set S in the XY plane 2 = {P i 2}, P i 2 =(x i ,y i ), and find the boundary x of the plane area along the X and Y directions min 、x max ,y min ,y max .
[0088] (2) Estimate the point cloud density ρ. From S 2 Randomly select p (p≤N) points from the matrix, calculate the distance between each point and the remaining N-1 points, and take the minimum value d jmin (j=1,2,…,p). Then the point cloud density
[0089] (3) Data resampling. min ,y max Between, generate Q straight lines parallel to the X-axis at equal intervals, where:
[0090] Q = int[(y max -y min ) / ρ+0.5]+1
[0091] The distance between the lines is d y =(y max -y min ) / (Q-1), the Y coordinates of each point on the i-th (i=1,2,…,Q) straight line are:
[0092] y i =y min +d y (i-1).
[0093] For each straight line, min 、x max Generate line segments for the boundary. Sample data points on each line segment, the number of data points is M:
[0094] M=int[(x max -x min ) / ρ+0.5]+1
[0095] The distance between each point is d x =(x max -x min ) / (M-1). The X coordinate of the jth (j=1,2,…,M) data point is:
[0096] x j =x min +d x (j-1).
[0097] (4) Generate triangular mesh. After resampling, the Q·M data points are arranged regularly along the X and Y directions. The Delaunay triangulation method is applied to generate a triangular mesh in the plane domain, which is denoted as
[0098] For the triangular mesh in the above-mentioned plane rectangular domain, it is necessary to use the boundary polygon to clip it to obtain the triangular mesh in the actual boundary domain. The clipping process mainly includes two steps: boundary preprocessing and mesh clipping. The boundary polygon may be an arbitrarily complex curve in theory. If the original boundary is directly used for mesh clipping, the calculation process may be unstable. When the point cloud density is small, the resampling method can be used to preprocess the boundary polygon to ensure the stability of the calculation while ensuring accuracy.
[0099] The specific steps of boundary preprocessing are as follows:
[0100] (1) At the Y-direction boundary [y min ,y max ] is the distance between the straight lines d y Generate Q straight lines parallel to the X axis at intervals
[0101] (2) Calculate the intersection points between each straight line and the initial boundary polygon: When the line segment between two adjacent points on the original boundary intersects L i When they coincide, take their endpoints as the i The intersection of
[0102] (3) Eliminate redundant points and establish the adjacency relationship between new boundary point sequences based on the principle of closest distance: Eliminating redundant points means that in the new boundary point sequence, when the distance between adjacent points is less than the point cloud density, the latter point is eliminated.
[0103] According to the relative position relationship between the triangle vertices and the boundary polygons, each triangle can be processed to achieve the clipping of the triangle mesh. The specific method of mesh clipping is as follows:
[0104] Let the three vertices of the triangle be V i , i = 1, 2, 3, let the boundary polygon be L, then the following function can be used to describe V i Position relationship with L:
[0105]
[0106] Assume B ij The two vertices V of the triangle i 、V j An edge between, i,j = 1,2,3, then the following function can be used to describe B ij Position relationship with L:
[0107]
[0108] The two position relationship functions given above are used to process the triangular mesh in the following situations:
[0109] When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3,L)=0, the three vertices of the triangle are deleted.
[0110] When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3,L)=1, we need to combine the Intersect function to make a judgment: Let InorOut(V1,L)=1, if Intersect(B 12 ,L)=1 and Intersect(B 13 , L) = 1, then the intersection points D1 and D2 replace V2 and V3 to generate a new triangle V1D1D2 (such as Figure 3 shown); if Intersect(B 12 ,L)=0orIntersect(B 13 ,L)=0, then delete the three vertices of the triangle;
[0111] When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3 L)=2, we also need to combine the Intersect function to make a judgment: Let InorOut(V1,L)=0, if Intersect(B 12 ,L)=1 and Intersect(B 13,L)=1, then replace the original triangle with two triangles △V2D1V3 and △D1D2V3 (such as Figure 4 a); if Intersect(B 12 ,L)=1 and Intersect(B 13 ,L)=0, then replace the original triangle with △V2D1V3 (such as Figure 4 b); if Intersect(B 12 ,L)=0 and Intersect(B 13 ,L)=1, then replace the original triangle with △V2D2V3 (such as Figure 4 c); if Intersect(B 12 ,L)=0 and Intersect(B 13 ,L)=0, then delete the three vertices of the triangle;
[0112] When InorOut(V1, L)+InorOut(V2, L)+InorOut(V3 L)=3, the three vertices of the triangle are retained.
[0113] The triangular mesh generation method in the three-dimensional space domain is as follows: get mesh 2 Then, the three vertices of each triangle mesh The X and Y coordinate values (x i ,y i )、(x j ,y j )、(x k ,y k ) values are respectively substituted into formula (4) to obtain the corresponding Z coordinate value, keeping the topological connection relationship between the vertices unchanged, and the spatial domain triangular mesh can be obtained. After obtaining the three-dimensional mesh in the spatial domain, in order to control the approximation accuracy of the triangular mesh to the original data, an accuracy test is required. The method is as follows:
[0114] (1) For the original point set S 3 = {P i 3 Any data point P in i 3 , determine in which triangle mesh it is located in the XY plane, when Time, remember
[0115] (2) Calculation point P i 3 to The distance e of the plane i , assuming the approximation error allowable value is e r , if e i>e r , then in Insert a vertex at the center of gravity Generate three triangles;
[0116] (3) Calculate the insertion vertex using formula (4) The Z coordinate value of the triangle mesh in the space domain is obtained.
[0117] For S 3 = {P i 3 The above judgment is performed for each point in}, and local mesh densification is performed to ensure the approximation accuracy of the triangular mesh to the original data.
[0118] In order to verify the actual effect of the triangulation method of the present invention, the method disclosed in the present invention is implemented using the Matlab programming language, and a computer with an operating system of Windows XP, a CPU of Core 3.3GHz, and a memory of 2G is used for simulation verification. Figure 5 As shown, a contact type three-dimensional coordinate measuring machine is used to collect data on the surface of a free-form surface part. The sampling point spacing is 1.0 mm, the line spacing is 1.0 mm, and a total of 6370 data points are collected. The original data contains noise points and void areas. After obtaining the original data, the following operations are performed according to the method provided by the present invention:
[0119] (1) Boundary feature extraction. The boundary extraction results are as follows: Figure 6 As shown in the figure, '.' represents the original data point, '*' represents the data point in the boundary cell, and 'o' represents the boundary feature point.
[0120] (2) Generation of triangular mesh in plane domain. The clipped triangular mesh generated in plane domain is as follows: Figure 7 As shown. The original triangle side length is 1mm, and there are 6671 triangles in total.
[0121] (3) Data compression and surface fitting. The data is divided into two blocks during compression, the compression rate is set to 20%, and the maximum fitting error is less than ε = 1 × 10 -4 The actual maximum fitting error is 7.5×10 -6 The result after compression and merging is as follows Figure 8 The surface fitting results are shown in Fig. 9 shown.
[0122] (4) Generation of spatial triangular meshes. The triangular meshes in the clipped plane domain are generated by using the surface expressed by LS-SVM (e.g. Fig. 9 As shown in Figure 2, three-dimensional mapping can be performed to obtain Fig.10 The spatial triangulated mesh shown.
[0123] It can be seen from the verification results of specific examples that the mesh obtained by the triangulation method disclosed in the present invention is very regular and uniform, the accuracy of the triangulated mesh is high, and there are no singular meshes or holes.
[0124] The above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Other modifications or equivalent substitutions made to the technical solution of the present invention by ordinary technicians in this field should be included in the scope of the claims of the present invention as long as they do not depart from the spirit and scope of the technical solution of the present invention.
Claims
1. A scattered point cloud triangulation method based on support vector machine, characterized by: It includes data collection on the surface of a free-form surface part through a contact three-dimensional coordinate measuring machine, boundary feature extraction of single-value point cloud data in the Z direction, generation of triangular mesh in the plane domain, surface fitting based on LS-SVM, and generation of triangular mesh in the space domain through three-dimensional mapping; data compression and filtering of redundant information in the original data before surface fitting. The plane domain triangular mesh generation includes plane rectangular domain triangular mesh generation and plane triangular mesh clipping. The clipping process is divided into boundary preprocessing and mesh clipping. The boundary preprocessing steps are as follows: (1) At the Y-direction boundary [y min ,y max ] is the distance between the straight lines d y Generate Q straight lines L parallel to the X axis at intervals i ; (2) Calculate the intersection points between each straight line and the initial boundary polygon: When the line segment between two adjacent points on the original boundary intersects L i When they coincide, take their endpoints as the i The intersection of (3) Eliminate redundant points and establish the adjacency relationship between new boundary point sequences based on the principle of the shortest distance: Eliminate redundant points means that in the new boundary point sequence, when the distance between adjacent points is less than the point cloud density, the latter point is eliminated; The mesh clipping processes each triangle according to the relative position relationship between the triangle vertices and the boundary polygons; The specific method of mesh clipping is as follows: Let the three vertices of the triangle be V i , i = 1, 2, 3, let the boundary polygon be L, then the following function can be used to describe V i Position relationship with L: Assume B ij The two vertices V of the triangle i 、V j An edge between, i,j = 1,2,3, then the following function can be used to describe B ij Position relationship with L: The two position relationship functions given above are used to process the triangular mesh in the following situations: When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3,L)=0, delete the three vertices of the triangle; When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3,L)=1, we need to combine the Intersect function to make a judgment: Let InorOut(V1,L)=1, if Intersect(B 12 ,L)=1 and Intersect(B 13 , L)=1, then the intersection points D1 and D2 replace V2 and V3 to generate a new triangle V1D1D2; if Intersect(B 12 ,L)=0orIntersect(B 13 ,L)=0, then delete the three vertices of the triangle; When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3 L)=2, we also need to combine the Intersect function to make a judgment: Let InorOut(V1,L)=0, if Intersect(B 12 ,L)=1 and Intersect(B 13 ,L)=1, then replace the original triangle with two triangles △V2D1V3 and △D1D2V3; if Intersect(B 12 ,L)=1 and Intersect(B 13 ,L)=0, then replace the original triangle with △V2D1V3; if Intersect(B 12 ,L)=0 and Intersect(B 13 ,L)=1, then replace the original triangle with △V2D2V3; if Intersect(B 12 ,L)=0 and Intersect(B 13 ,L)=0, then delete the three vertices of the triangle; When InorOut(V1,L)+InorOut(V2,L)+InorOut(V3 L)=3, the three vertices of the triangle are retained; The data compression is performed based on the LS-SVM method, as follows: (1) Point cloud segmentation: The data points in the original data point cloud are divided into several data blocks. The number of data points in each data block is less than the maximum number of data points in a given block, and D data blocks that meet the requirements are obtained; (2) Intra-block pruning: Use LS-SVM to fit each data block separately and calculate the Lagrange multiplier α i , and press |α i | Arrange in descending order from large to small. Suppose the compression rate is k, k<1, and the number of data points in the data block before compression is r, then the last k·r points|α i |The corresponding data points are deleted to obtain compressed data points, the number of which is r(1-k); (3) Accuracy test: Merge the D data blocks that have undergone intra-block pruning to obtain the compressed data point set S n , LS-SVM is used for fitting, and the overall surface model z = f(x, y) fitting the scattered point cloud data is obtained; the allowable value of the fitting error is ε, for S n Any point P in i (x i ,y i ,z i ), and calculate the fitting error e=|z i -f(x i ,y i )|, if e≤ε, the data compression is reasonable, otherwise reduce the compression ratio k and compress again.
2. The method for triangulating scattered point clouds based on support vector machines according to claim 1, characterized in that: The specific method of point cloud segmentation is as follows: Suppose the original measured point cloud S c There are m data points in total, and the maximum number of data points in a given block is m max , if m>m max , then project it along the Z direction to obtain the point set S in the XY plane p ; Find the boundary of the plane area along the X direction, that is, x min , x max ; Divide it into 2 pieces along the X direction, and we get: and set up The number of data points in are and like or Then or Then divide it in half along the Y direction until the number of points in each data block is less than m max , then stop segmentation, and the number of data blocks obtained by segmentation is D.
3. The method for triangulating scattered point clouds based on support vector machines according to claim 1, characterized in that: The specific method for generating a triangular mesh in a plane rectangular domain is as follows: Let the original point set be S 3 = {P i 3 }, P i 3 =(x i ,y i ,z i ), i = 1, 2, ..., N, N is the number of measurement points, then the steps to generate a triangular mesh in a plane rectangular domain are as follows: (1) Project it along the Z direction to obtain the point set S in the XY plane 2 = {P i 2 }, P i 2 =(x i ,y i ), and find the boundary x of the plane area along the X and Y directions min 、x max ,y min ,y max ; (2) Estimation of point cloud density ρ: From S 2 Randomly select p points, p≤N, calculate the distance between each point and the remaining N-1 points, and take the minimum value d jmin , j = 1, 2, ..., p, then the point cloud density (3) Data resampling: In y min ,y max Between, generate Q straight lines parallel to the X-axis at equal intervals, where: Q=int[(y max -and min ) / ρ+0.5]+1 The distance between the lines is d y =(y max -y min ) / (Q-1), the Y coordinates of each point on the i-th straight line are: y i =y min +d y (i-1) For each straight line, min 、x max Generate line segments for the boundary, sample data points on each line segment, and the number of data points is M: M=int[(x max -x min ) / ρ+0.5]+1 The distance between each point is d x =(x max -x min ) / (M-1), the X coordinate of the jth data point is: x j =x min +d x (j-1) (4) Generate triangular mesh: After resampling, the Q·M data points are arranged regularly along the X and Y directions. The Delaunay triangulation method is applied to generate a triangular mesh in the plane domain, which is denoted as mesh. 2 =(P i 2 ,P j 2 ,P k 2 ).
4. The method for triangulating scattered point clouds based on support vector machines according to claim 3, characterized in that: The surface fitting method based on LS-SVM is as follows: For m n-dimensional sample vectors where x i ∈R n ,y i ∈R, let the regression function be in the form of: in It is a nonlinear mapping function that can map the input sample data to the corresponding high-dimensional feature space. This regression function can be obtained by solving the following optimization model: In the formula, w is the weight vector, C is the penalty factor, b is the deviation, ζ i is the slack variable; by using the Lagrange multiplier method and Mercer conditions, the optimization problem expressed in equation (2) can be transformed into solving the following linear equations: In the formula α=(α1,α2,...,α m ) T , α is the Lagrange multiplier, I is the identity matrix, k is the kernel function, k(x i ,x j )=φ(x i ) T ·φ(x j ), i, j=1,2,…,m, y=[y1,y2,…,y m ] T ; Solving equation (3), we can get b and α, and the regression function can be expressed as: When a scattered point set S is given 3 = {P i 3 }(P i 3 =(x i ,y i ,z i ), i=1,2,...,m, m is the number of measurement points, X i =(x i ,y i ) as the input value of the sample vector, Y i =z i As the output value of the sample vector, the α and b values are obtained by formula (3), and the α and b values are substituted into formula (4) to obtain the LS-SVM surface fitting the scattered point data.
5. The method for triangulating scattered point clouds based on support vector machines according to claim 4, characterized in that: When solving equation (3), it is necessary to define the kernel function and select the radial basis kernel function 6. The method for triangulating scattered point clouds based on support vector machines according to claim 4, characterized in that: The specific method of generating a triangular mesh in the spatial domain by three-dimensional mapping is as follows: 2 Then, the three vertices P of each triangle mesh are i 2 ,P j 2 ,P k 2 The X and Y coordinate values (x i ,y i )、(x j ,y j )、(x k ,y k ) values are respectively substituted into formula (4) to obtain the corresponding Z coordinate value, keeping the topological connection relationship between the vertices unchanged, and the spatial domain triangular mesh can be obtained. 3 =(P i 3 ,P j 3 ,P k 3 ).
7. The method for triangulating scattered point clouds based on support vector machines according to claim 6, characterized in that: After obtaining the three-dimensional mesh in the spatial domain, in order to control the approximation accuracy of the triangular mesh to the original data, an accuracy test is required. The method is as follows: (1) For the original point set S 3 = {P i 3 Any data point P in i 3 , determine in which triangle mesh it is located in the XY plane, when Time, remember (2) Calculation point P i 3 to The distance e of the plane i , assuming the approximation error allowable value is e r , if e i >e r , then in Insert a vertex P at the centroid c 2 , generate three triangles; (3) Calculate the insertion vertex using formula (4) The Z coordinate value of the triangle mesh in the space domain is obtained; For S 3 = {P i 3 The above judgment is performed for each point in}, and local mesh densification is performed to ensure the approximation accuracy of the triangular mesh to the original data.
