Point cloud skeleton line extraction method and system based on automatic estimation of bifurcation number

文档序号:551868 发布日期:2021-05-14 浏览:19次 中文

阅读说明:本技术 一种基于分叉数量自动估计的点云骨架线提取方法及系统 (Point cloud skeleton line extraction method and system based on automatic estimation of bifurcation number ) 是由 刘骥 文欣 于 2021-02-05 设计创作,主要内容包括:本发明公开了一种基于分叉数量自动估计的点云骨架线提取方法及系统。包括:S1,获取点云数据,基于KD-Tree结构构造所述点云数据的K近邻图;S2,获取K近邻图的测地距离,根据K近邻图的测地距离将所有K近邻图中的点云划分为k个水平集;S3,利用分叉数量自动估计算法自动将每个水平集内的点云划分为不同分支,获取每个分支的质心,将质心作为骨架点;S4,连接所有骨架点获得骨架线。在树木点云存在噪声时,数据分布不均匀或者数据存在少量缺失时,可得到居中性良好的骨架线;使用了基于KD-Tree的点云结构来加速寻找点云点,明显提高了骨架提取的速度,加快了树木点云骨架提取的速度;优化骨架线使骨架线的居中性。(The invention discloses a point cloud skeleton line extraction method and system based on automatic bifurcation number estimation. The method comprises the following steps: s1, point cloud data are obtained, and a K neighbor map of the point cloud data is constructed based on a KD-Tree structure; s2, acquiring the geodesic distance of the K neighbor images, and dividing the point clouds in all the K neighbor images into K level sets according to the geodesic distance of the K neighbor images; s3, automatically dividing the point cloud in each level set into different branches by using a bifurcation number automatic estimation algorithm, obtaining the centroid of each branch, and taking the centroid as a skeleton point; and S4, connecting all the skeleton points to obtain skeleton lines. When noise exists in tree point cloud, and data distribution is not uniform or a small amount of data is missing, a skeleton line with good living neutrality can be obtained; a point cloud point structure based on KD-Tree is used for accelerating the searching of point cloud points, the skeleton extraction speed is obviously improved, and the Tree point cloud skeleton extraction speed is accelerated; and optimizing the skeleton line to ensure the centrality of the skeleton line.)

1. A point cloud skeleton line extraction method based on automatic estimation of bifurcation number is characterized by comprising the following steps:

step S1, point cloud data are obtained, and a K neighbor map of the point cloud data is constructed based on a KD-Tree structure;

step S2, obtaining geodesic distances of the K neighbor images, and dividing point clouds in all the K neighbor images into K level sets according to the geodesic distances of the K neighbor images, wherein K is a positive integer;

step S3, automatically dividing the point cloud in each level set into different branches by using a bifurcation number automatic estimation algorithm, obtaining the centroid of each branch, and taking the centroid as a skeleton point;

in step S4, skeleton lines are obtained by connecting all the skeleton points obtained in step S3.

2. The method for extracting point cloud skeleton lines based on automatic estimation of bifurcation number according to claim 1, wherein the process of executing the automatic estimation algorithm of bifurcation number for each level set comprises:

step S31, let the level set be expressed as: l is(f,c,p)={p|c≤f(p)≤c+ρ},f(p)Represents the level set L(f,c,p)Geodesic distance, f, of the cloud point p of the midpoint(p)∈[c,c+ρ]And c represents a level set L(f,c,p)P represents a distance increment threshold; setting a neighborhood radius epsilon;

step S32, finding out all the core object point cloud points in the horizontal set, where the process of finding the core object point cloud points is:

for a point cloud point p in the horizontal set, the distance Dist from the point cloud point p(p,q)All point cloud points not larger than the neighborhood radius epsilon form a neighborhood set n of point cloud points pε(p)={q∈L(f,c,p)|Dist(p,q)Less than or equal to epsilon, if the point cloud point p is a neighborhood set nε(p)Number of midpoint cloud points | nε(p)| is greater than or equal to a neighborhood number threshold MinPTs, i.e. | nε(p)If | ≧ MinPTs, the point cloud point p is a core object point cloud point, otherwise, the point cloud point p is not a core object point cloud point;

step S33, if the point cloud point q satisfies q e nε(p)Then, the density of the point cloud point q and the point cloud point p is considered to be up; if the cloud point o E L(f,c,p)If the density of the point cloud point o and the point cloud point p can reach, and the density of the point cloud point o and the density of the point cloud point q can reach, the point cloud point p and the point cloud point q are called to be connected;

and aggregating all point cloud points with the reachable density and the connected density in the horizontal concentration into a point cloud point set, and combining the point cloud point set into a branch.

3. The method for extracting a point cloud skeleton line based on the automatic estimation of the bifurcation number according to claim 1, wherein in the step S1, the process of obtaining the point cloud data is:

step S11, obtaining the original point cloud, finding the maximum point position coordinate (x) from the original point cloudmax,ymax,zmax) And minimum point position coordinate (x)min,ymin,zmin);

In step S12, a first bounding box lxlxlxlx, i ═ max (L) is setx,Ly,Lz),Lx=|xmax-xmin|,Ly=|ymax-ymin|,Lz=|zmax-zminI, the first enclosure box is subdivided into a plurality of second enclosure boxes L ' x L ', L ' min (L)x,Ly,Lz) The sum of the volumes of all the second bounding boxes is equal to the volume of the first bounding box;

and step S13, calculating the central points of all the second bounding boxes, and taking the central points as point cloud points in the point cloud data obtained in the step S1.

4. The point cloud skeleton line extraction method based on automatic estimation of bifurcation number according to claim 1, wherein in the step S4, the process of connecting all skeleton points obtained in the step S3 to obtain skeleton lines includes:

step S41, regarding the obtained skeleton points, taking root nodes as initial search points, using KD-Tree to perform neighbor search with radius r from the root nodes, marking the searched skeleton points as main skeleton points and adding a skeleton point linked list, taking the searched skeleton points as new search points to perform neighbor search with radius r until meeting bifurcation points, and when the number of skeleton points with Z-axis coordinates larger than that of the search points in the neighborhood with the radius r of the search points is larger than 1, taking each skeleton point with Z-axis coordinates larger than that of the search points as a bifurcation point;

step S42, setting the search point as p ', storing all branch points of the search point p' into the collection S to be searched(p')Respectively connecting the search point p' with the set S to be searched(p')Each branch point in the two branches is connected to obtain a plurality of branch vectors, and the sum of all the branch vectors is used as a skeleton growth direction vectorConnecting the previous historical search point with the current search point to obtain a vector as a first vector, and solving a vector of the growth direction of the skeletonAn acute included angle theta with the first vector;

step S43, let the bifurcation point be q ', the bifurcation vector corresponding to the bifurcation point q' beIf it isTaking the bifurcation point q' as the main skeleton point ifTaking the bifurcation point q' as a branch skeleton point, and adding the main skeleton point and the branch skeleton point into a skeleton point linked list;expression findingThe direction vector of (a) is,expression findingThe direction vector of (a);

and step S44, taking the main branch skeleton point as a new search point to continue main branch neighbor search, taking the branch skeleton point as a root node of the branch where the branch is located to start branch neighbor search until all skeleton point searches are completed, and sequentially connecting the main branch skeleton point in the skeleton point linked list and the branch skeleton points of all branches to obtain skeleton lines.

5. The point cloud skeleton line extraction method based on automatic estimation of bifurcation number according to one of claims 1 to 4, further comprising a skeleton line optimization step;

the skeleton line optimization step comprises the following steps:

step A, taking the skeleton line obtained in the step S4 as an initial skeleton line, dividing the point cloud data into a plurality of local point cloud sets along the growth direction of the initial skeleton line, wherein the local point cloud sets only comprise point clouds of a main branch or point clouds of one branch;

step B, approximating the skeleton line in each local point cloud set as a three-dimensional space straight line, wherein the three-dimensional space straight line is expressed as:

wherein a1 represents a first x-axis parameter, B1 represents a first y-axis parameter, C1 represents a first z-axis parameter, D1 represents a first planar constant, a2 represents a second x-axis parameter, B2 represents a second y-axis parameter, C2 represents a second z-axis parameter, and D2 represents a second planar constant;

obtaining initial values of A1, B1, C1, D1, A2, B2, C2 and D2 according to the initial skeleton lines in the local point cloud set;

setting the value intervals of A1, B1, C1, A2, B2 and C2 respectively, wherein the value interval of each parameter comprises an initial value of the parameter, the values of the D1 and D2 are obtained in the value intervals of A1, B1, C1, A2, B2 and C2 respectively, and the values of the D1 and D2 are obtained according to the values of A1, B1, C1, A2, B2 and C2, and when the three-dimensional space straight lines corresponding to the values of A1, B1, C1, D1, A2, B2, C2 and D2 meet the objective function, the three-dimensional space straight lines corresponding to the values of the A2, B2, C2, D2, A2, B2 and C2 are used as the optimization line of the local set;

the objective function is:wherein argmin (·) represents a function that minimizes the value of the expression; djRepresenting the distance from the j point cloud point in the local point cloud set to the three-dimensional space straight line in the local point cloud set, setting that the local point cloud set comprises m point cloud points, wherein j belongs to [1, m ∈];dmeanRepresenting the average value of the distances from the point cloud points in the local point cloud set to the three-dimensional straight line in the local point cloud set,

and step C, connecting all the optimized skeleton lines of the local point cloud sets according to the growth direction of the skeleton lines.

6. The point cloud skeleton line extraction method based on automatic estimation of bifurcation number according to claim 5, wherein the optimized skeleton line of each local point cloud set is obtained in step B by:

step B1, setting n particles, wherein n is a positive integer, taking 6-dimensional variables (A1, B1, C1, A2, B2 and C2) as position variables of the particles, taking speed variables of the particles as 6 dimensions, initializing the position and the speed of each particle, and initializing the historical optimal position and the current optimal position to (A1)0,B10,C10,A20,B20,C20),A10、B10、C10、D10、A20、B20、C20、D20Respectively representing initial values of A1, B1, C1, D1, A2, B2, C2 and D2 obtained according to initial skeleton lines in the local point cloud set;

and step B2, updating the position and the speed of each particle in the value intervals of A1, B1, C1, A2, B2 and C2 according to the following formulas:

vi(t+1)=vi(t)+c1×rand()×(pbest-xi(t))+c2×rand()×(gbest-xi(t));

xi(t+1)=xi(t)+vi(t+1);

wherein v isi(t)、vi(t +1) represents the velocity of the ith particle in the t-th iteration and the t + 1-th iteration, respectively, xi(t)、xi(t +1) represents the position of the ith particle in the t iteration and t +1 iteration, respectively, i ∈ [1, n ∈]Pbest is the current optimal position, pbest is the historical optimal position, rand () is a random setting value, and t is the iteration number; c. C1Denotes a first learning factor, c2Represents a second learning factor;

step B3, calculating the fitness value of each particle, wherein the calculation formula of the fitness value isUpdating the current optimal position pbest to a particle position with the minimum fitness value, and if the current minimum fitness value is smaller than the fitness value corresponding to the historical optimal position, updating the historical optimal position gbest to the particle position with the minimum fitness value;

and step B4, if the current iteration time T +1 does not reach the preset maximum iteration time T, making T equal to T +1, returning to execute the step B2, the step B3 and the step B4, if the current iteration time T +1 reaches the preset maximum iteration time T, T belongs to [1, T-1], stopping iteration, and taking a three-dimensional space straight line obtained according to the historical optimal position as an optimized skeleton line of the local point cloud set.

7. The method for extracting point cloud skeleton lines based on automatic estimation of bifurcation number according to claim 5 or 6, further comprising:

and step S5, smoothing the skeleton line by adopting a cubic B-spline interpolation algorithm.

8. A point cloud skeleton line extraction system based on automatic estimation of bifurcation number, which is characterized by comprising a point cloud data acquisition module and a processing module, wherein the point cloud data acquisition module acquires point cloud data and transmits the point cloud data to the processing module, and the processing module executes the steps of the point cloud skeleton line extraction method based on automatic estimation of bifurcation number according to any one of claims 1 to 7 to obtain skeleton lines.

Technical Field

The invention relates to the technical field of point cloud skeleton line extraction, in particular to a point cloud skeleton line extraction method and system based on automatic bifurcation number estimation.

Background

In the prior art, the outer surface of an object is usually scanned to obtain a large amount of point clouds, skeleton lines are extracted based on the point clouds, model reconstruction is performed by using the skeleton lines, such as human skeleton reconstruction, human blood vessel reconstruction, tree reconstruction and the like, and the accuracy of the model reconstruction depends on the extraction accuracy of the skeleton lines. Due to the complex bifurcations of the skeleton, blood vessel, tree and other structures of the human body, the frame extraction is usually performed after the bifurcation number is preset, the bifurcation number cannot be automatically estimated, and the extraction of the high-quality frame still faces a lot of difficulties at present.

Taking tree skeleton extraction as an example, most of the current original tree point clouds are point cloud data obtained by scanning with a laser scanner, most of the data are not perfect and have some defects, most of the laser-scanned point clouds are uneven in density and have noise points and outliers, in addition, most of the tree point clouds are often shielded by tree crowns and the like, the tree shape, the complex geometric structure and incomplete scanning result in serious point cloud data loss, and the problems bring great challenges to skeleton extraction of the tree point clouds, and particularly, accurate extraction of bifurcations from the point cloud data is very difficult.

The current extraction method of the point cloud skeleton mainly comprises common methods such as clustering, graph theory, Laplacian and the like. Clustering is mainly to gather point clouds with the same or similar distances together, then to use the center of the clustering point as the skeleton point of the tree, for example, the level set is one kind of clustering, and the method of using the level set extracts the point cloud skeleton with more correct skeleton model, but the method is very sensitive to the density of the point clouds, and the method can not solve the problem well for the condition of the point clouds being too sparse. The graph theory method extracts the skeleton, and retains the data characteristics of the original point cloud, but the method has poor effect on a more complex model. Although the laplacian operator can obtain good skeleton points theoretically, the complexity of the algorithm is continuously increased along with the increase of the number of the point clouds, so that the laplacian operator is not suitable for the condition of overlarge number of the point clouds. The existing methods cannot automatically and accurately identify branches when noise exists in point cloud, data distribution is not uniform, data is missing, and the structure is complex, so that skeleton lines cannot be extracted quickly and accurately.

Disclosure of Invention

The invention aims to at least solve the technical problems in the prior art, and particularly provides a point cloud skeleton line extraction method and system based on automatic bifurcation number estimation.

In order to achieve the above object, according to a first aspect of the present invention, there is provided a point cloud skeleton line extraction method based on automatic estimation of a bifurcation number, comprising: step S1, point cloud data are obtained, and a K neighbor map of the point cloud data is constructed based on a KD-Tree structure; step S2, obtaining geodesic distances of the K neighbor images, and dividing point clouds in all the K neighbor images into K level sets according to the geodesic distances of the K neighbor images, wherein K is a positive integer; step S3, automatically dividing the point cloud in each level set into different branches by using a bifurcation number automatic estimation algorithm, obtaining the centroid of each branch, and taking the centroid as a skeleton point; in step S4, skeleton lines are obtained by connecting all the skeleton points obtained in step S3.

The technical scheme is as follows: the K neighbor graph and the skeleton point extraction speed of point cloud data can be accelerated by adopting a KD-Tree structure, level sets are further established, a plurality of Tree branches may exist in each level set, branches in each level set are automatically estimated and divided by adopting a bifurcation number automatic estimation algorithm, the number of branches does not need to be preset, the method can be applied to a branch complex scene, skeleton points are extracted from different branch point clouds, and the skeleton points are connected to obtain skeleton lines.

In a preferred embodiment of the present invention, the process of executing the automatic estimation algorithm of the number of forks per level set comprises: step S31, let the level set be expressed as: l is(f,c,p)={p|c≤f(p)≤c+ρ},f(p)Represents the level set L(f,c,p)Geodesic distance, f, of the cloud point p of the midpoint(p)∈[c,c+ρ]And c represents a level set L(f,c,p)P represents a distance increment threshold; setting a neighborhood radius epsilon; step S32, finding out all the core object point cloud points in the horizontal set, where the process of finding the core object point cloud points is: for point cloud point p in horizontal concentration, and pointDistance Dist of cloud point p(p,q)All point cloud points not larger than the neighborhood radius epsilon form a neighborhood set n of point cloud points pε(p)={q∈L(f,c,p)|Dist(p,q)Less than or equal to epsilon, if the point cloud point p is a neighborhood set nε(p)Number of midpoint cloud points | nε(p)| is greater than or equal to a neighborhood number threshold MinPTs, i.e. | nε(p)If | ≧ MinPTs, the point cloud point p is a core object point cloud point, otherwise, the point cloud point p is not a core object point cloud point; step S33, if the point cloud point q satisfies q e nε(p)Then, the density of the point cloud point q and the point cloud point p is considered to be up; if the cloud point o E L(f,c,p)If the density of the point cloud point o and the point cloud point p can reach, and the density of the point cloud point o and the density of the point cloud point q can reach, the point cloud point p and the point cloud point q are called to be connected; and aggregating all point cloud points with the reachable density and the connected density in the horizontal concentration into a point cloud point set, and combining the point cloud point set into a branch.

The technical scheme is as follows: the method has good robustness to noise, can divide the region with the density reaching a certain degree (the density can reach and is connected with the density) into a corresponding branch, has the capability of finding any branch, determines whether each level set has a branch or belongs to different branches, does not need to know the number of branches needing to be clustered in advance, and can automatically cluster all the branches.

In a preferred embodiment of the present invention, in step S1, the process of acquiring the point cloud data is: step S11, obtaining the original point cloud, finding the maximum point position coordinate (x) from the original point cloudmax,ymax,zmax) And minimum point position coordinate (x)min,ymin,zmin) (ii) a In step S12, a first bounding box L' L, L ═ max (L) is setx,Ly,Lz),Lx=|xmax-xmin|,Ly=|ymax-ymin|,Lz=|zmax-zminSubdividing the first bounding box into a plurality of second bounding boxes L ″, L ═ min (L)x,Ly,Lz) The sum of the volumes of all the second bounding boxes is equal to the volume of the first bounding box; step S13, all the data are obtainedAnd a center point of the second bounding box, which is used as a point cloud point in the point cloud data obtained in the step S1.

The technical scheme is as follows: the method realizes the downsampling of the original point cloud data, and can solve the problems that the number of the original point clouds is too large, the calculation time is too long, and the influence of the noise and the uneven density on the tree point cloud extraction skeleton line is caused.

In a preferred embodiment of the present invention, in the step S4, the process of connecting all the skeleton points obtained in the step S3 to obtain skeleton lines includes: step S41, regarding the obtained skeleton points, taking root nodes as initial search points, using KD-Tree to perform neighbor search with radius r from the root nodes, marking the searched skeleton points as main skeleton points and adding a skeleton point linked list, taking the searched skeleton points as new search points to perform neighbor search with radius r until meeting bifurcation points, and when the number of skeleton points with Z-axis coordinates larger than that of the search points in the neighborhood with the radius r of the search points is larger than 1, taking each skeleton point with Z-axis coordinates larger than that of the search points as a bifurcation point; step S42, setting the search point as p ', storing all branch points of the search point p' into the collection S to be searched(p')Respectively connecting the search point p' with the set S to be searched(p')Each branch point in the two branches is connected to obtain a plurality of branch vectors, and the sum of all the branch vectors is used as a skeleton growth direction vectorConnecting the previous historical search point with the current search point to obtain a vector as a first vector, and solving a vector of the growth direction of the skeletonAn acute included angle theta with the first vector; step S43, let the bifurcation point be q ', the bifurcation vector corresponding to the bifurcation point q' beIf it isTaking the bifurcation point q' as the main skeleton point ifTaking the bifurcation point q' as a branch skeleton point, and adding the main skeleton point and the branch skeleton point into a skeleton point linked list;expression findingThe direction vector of (a) is,expression findingThe direction vector of (a); and step S44, taking the main branch skeleton point as a new search point to continue main branch neighbor search, taking the branch skeleton point as a root node of the branch where the branch is located to start branch neighbor search until all skeleton point searches are completed, and sequentially connecting the main branch skeleton point in the skeleton point linked list and the branch skeleton points of all branches to obtain skeleton lines.

The technical scheme is as follows: the method can solve the problem that unreasonable branches or wrong-connection branches appear on the framework line.

In a preferred embodiment of the present invention, the method further comprises a skeleton line optimization step, wherein the skeleton line optimization step comprises: the skeleton line optimization step comprises the following steps: step A, taking the skeleton line obtained in the step S4 as an initial skeleton line, dividing the point cloud data into a plurality of local point cloud sets along the growth direction of the initial skeleton line, wherein the local point cloud sets only comprise point clouds of a main branch or point clouds of one branch; step B, approximating the skeleton line in each local point cloud set as a three-dimensional space straight line, wherein the three-dimensional space straight line is expressed as:wherein A1 represents a first x-axis parameter, B1 represents a first y-axis parameter, and C1 represents a first z-axis parameterNumber, D1 first planar constant, a2 second x-axis parameter, B2 second y-axis parameter, C2 second z-axis parameter, D2 second planar constant; obtaining initial values of A1, B1, C1, D1, A2, B2, C2 and D2 according to the initial skeleton lines in the local point cloud set; setting the value intervals of A1, B1, C1, A2, B2 and C2 respectively, wherein the value interval of each parameter comprises an initial value of the parameter, the values of the D1 and D2 are obtained in the value intervals of A1, B1, C1, A2, B2 and C2 respectively, and the values of the D1 and D2 are obtained according to the values of A1, B1, C1, A2, B2 and C2, and when the three-dimensional space straight lines corresponding to the values of A1, B1, C1, D1, A2, B2, C2 and D2 meet the objective function, the three-dimensional space straight lines corresponding to the values of the A2, B2, C2, D2, A2, B2 and C2 are used as the optimization line of the local set; the objective function is:wherein argmin (·) represents a function that minimizes the value of the expression; djRepresenting the distance from the j point cloud point in the local point cloud set to the three-dimensional space straight line in the local point cloud set, setting that the local point cloud set comprises m point cloud points, wherein j belongs to [1, m ∈];dmeanRepresenting the average value of the distances from the point cloud points in the local point cloud set to the three-dimensional straight line in the local point cloud set,and step C, connecting all the optimized skeleton lines of the local point cloud sets according to the growth direction of the skeleton lines.

The technical scheme is as follows: the optimization method can minimize the variance of the distances from the cloud points to the skeleton line on the cylindrical section, so that the skeleton line has good centering performance.

In a preferred embodiment of the present invention, in step B, the optimized skeleton line of each local point cloud set is obtained by: step B1, setting n particles, wherein n is a positive integer, taking 6-dimensional variables (A1, B1, C1, A2, B2 and C2) as position variables of the particles, taking speed variables of the particles as 6 dimensions, initializing the position and the speed of each particle, and initializing the historical optimal position and the current optimal position to (A1)0,B10,C10,A20,B20,C20),A10、B10、C10、D10、A20、B20、C20、D20Respectively representing initial values of A1, B1, C1, D1, A2, B2, C2 and D2 obtained according to initial skeleton lines in the local point cloud set; and step B2, updating the position and the speed of each particle in the value intervals of A1, B1, C1, A2, B2 and C2 according to the following formulas: v. ofi(t+1)=vi(t)+c1′rand()′(pbest-xi(t))+c2′rand()′(gbest-xi(t));xi(t+1)=xi(t)+vi(t + 1); wherein v isi(t)、vi(t +1) represents the velocity of the ith particle in the t-th iteration and the t + 1-th iteration, respectively, xi(t)、xi(t +1) represents the position of the ith particle in the t iteration and t +1 iteration, respectively, i ∈ [1, n ∈]Pbest is the current optimal position, pbest is the historical optimal position, rand () is a random setting value, and t is the iteration number; c. C1Denotes a first learning factor, c2Represents a second learning factor; step B3, calculating the fitness value of each particle, wherein the calculation formula of the fitness value isUpdating the current optimal position pbest to a particle position with the minimum fitness value, and if the current minimum fitness value is smaller than the fitness value corresponding to the historical optimal position, updating the historical optimal position gbest to the particle position with the minimum fitness value; step B4, if the current iteration time T +1 does not reach the preset maximum iteration time T, making T equal to T +1, returning to execute step B2, step B3 and step B4, if the current iteration time T +1 reaches the preset maximum iteration time T, T belongs to [1, T-1 ∈ [1, T-1]]And stopping iteration, and taking a three-dimensional space straight line obtained according to the historical optimal position as an optimized skeleton line of the local point cloud set.

The technical scheme is as follows: the method can accelerate the speed of finding the optimal value from A1, B1, C1, D1, A2, B2, C2 and D2.

In a preferred embodiment of the present invention, the method further comprises: and step S5, smoothing the skeleton line by adopting a cubic B-spline interpolation algorithm.

The technical scheme is as follows: the smoothness of the skeleton line can be improved.

In order to achieve the above object, according to a second aspect of the present invention, the present invention provides a point cloud skeleton line extraction system based on automatic estimation of the number of branches, including a point cloud data acquisition module and a processing module, where the point cloud data acquisition module acquires point cloud data and transmits the point cloud data to the processing module, and the processing module executes the steps of the point cloud skeleton line extraction method based on automatic estimation of the number of branches to obtain skeleton lines.

The technical scheme is as follows: when noise exists in tree point cloud, data distribution is not uniform or a small amount of data is missing, a skeleton line with good centering performance can be well extracted; point cloud points are searched in an accelerated mode by using a point cloud structure based on KD-Tree, the speed of a point cloud framework extraction algorithm for automatically estimating the number of branches is obviously increased, and the speed of Tree point cloud framework extraction is increased; and the framework line is optimized, and the neutrality of the framework line is ensured.

Drawings

FIG. 1 is a schematic flow chart of a method for extracting a skeleton line of a point cloud based on the automatic estimation of the number of branches according to an embodiment of the present invention;

FIG. 2 is a K-neighbor graph of a point cloud graph in accordance with an embodiment of the present invention;

FIG. 3 is a schematic diagram of a level set partitioning process for a point cloud graph according to an embodiment of the present invention;

FIG. 4 is a schematic diagram of the dot cloud of FIG. 3 after level set partitioning;

FIG. 5 is a schematic diagram of a skeletal point connection in accordance with an embodiment of the present invention;

FIG. 6 is a schematic diagram of skeleton growth direction vector acquisition;

FIG. 7 is a diagram illustrating an optimized framework line in accordance with an embodiment of the present invention;

FIG. 8 is a graph of comparative experimental results of extraction of a tree point cloud skeleton line with data loss in an application scenario of the present invention;

FIG. 9 is a graph of a comparison experiment result of extraction of tree point cloud skeleton lines with uneven density in an application scenario;

FIG. 10 is a graph of the results of a comparison experiment for noisy tree point cloud skeleton line extraction in an application scenario of the present invention.

Detailed Description

Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.

In the description of the present invention, it is to be understood that the terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used merely for convenience of description and for simplicity of description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed in a particular orientation, and be operated, and thus, are not to be construed as limiting the present invention.

In the description of the present invention, unless otherwise specified and limited, it is to be noted that the terms "mounted," "connected," and "connected" are to be interpreted broadly, and may be, for example, a mechanical connection or an electrical connection, a communication between two elements, a direct connection, or an indirect connection via an intermediate medium, and specific meanings of the terms may be understood by those skilled in the art according to specific situations.

The invention discloses a point cloud skeleton line extraction method based on automatic estimation of bifurcation number, which comprises the following steps in a preferred embodiment as shown in figure 1: step S1, point cloud data are obtained, and a K neighbor map of the point cloud data is constructed based on a KD-Tree structure; step S2, obtaining the geodesic distance of the K neighbor graph, and dividing the point clouds in all the K neighbor graphs into K level sets according to the geodesic distance of the K neighbor graph, wherein K is a positive integer; step S3, automatically dividing the point cloud in each level set into different branches by using a bifurcation number automatic estimation algorithm, obtaining the centroid of each branch, and taking the centroid as a skeleton point; in step S4, skeleton lines are obtained by connecting all the skeleton points obtained in step S3.

The point cloud skeleton line extraction method based on the automatic estimation of the bifurcation number disclosed by the invention is preferably but not limited to be applied to skeleton line extraction in scenes such as human skeleton reconstruction, human blood vessel reconstruction, tree reconstruction and the like.

In the embodiment, because the laser scanner is used for scanning trees, the number of scanned points is generally large, generally, the number of point clouds of one tree can reach hundreds of thousands, if a test is directly carried out on the tree original point clouds, the tree skeleton extraction is affected by noise points due to too many tree sampling points and long calculation time, meanwhile, the original point clouds have a large amount of noise, the extracted tree skeleton is directly extracted on the tree point clouds which are not processed, the skeleton line effect is not good, the extracted skeleton line has a large difference from the real topological shape of the tree, in addition, because the density of the original point clouds is uneven, the extracted tree skeleton generally deviates to one side with the large density of the point clouds, in order to reduce the influence of the too large original number and the existing noise and uneven density on the tree point cloud extraction skeleton line, the method first down-samples the original point cloud.

In this embodiment, as shown in fig. 1, in step S1, the process of acquiring the point cloud data is preferably a process of down-sampling the original point cloud, and the specific process includes:

step S11, obtaining the original point cloud, finding the maximum point position coordinate (x) from the original point cloudmax,ymax,zmax) And minimum point position coordinate (x)min,ymin,zmin);

In step S12, a first bounding box L' L, L ═ max (L) is setx,Ly,Lz),Lx=|xmax-xmin|,Ly=|ymax-ymin|,Lz=|zmax-zminSubdividing the first bounding box into a plurality of second bounding boxes L ″, L ═ min (L)x,Ly,Lz) If n', the sum of the volumes of all the second bounding boxes is equal to the volume of the first bounding boxWherein i 'is from [1, n'],Vi'Representing the volume of the ith ' second bounding box, each of which has a certain number of point clouds, for the ith ' second bounding box containing n ' original point cloud points.

And step S13, calculating the central points of all the second bounding boxes, and taking the central points as point cloud points in the point cloud data obtained in the step S1. Using the formulaCalculating the center point Q of the ith' second bounding boxi'Therefore, the down sampling is realized, the ith ' second bounding box contains n ' original point cloud points, i ' belongs to the [1, n ] "]。

In the embodiment, as the points of the Tree point cloud have no rules, and the points are not connected with each other, in order to solve the non-correlation between the Tree point cloud, a K neighbor map of the point cloud data is established according to KD-Tree, the non-correlation between the Tree point cloud is solved by using the K neighbor map (K is preferably but not limited to 4), and a KD-Tree structure is used for accelerating the construction of the K neighbor map of the Tree point cloud. Compared with the common K-nearest neighbor algorithm, the Tree point cloud needs to be traversed for multiple times, the time complexity is high, the K-nearest neighbor graph of the Tree point cloud is constructed based on the KD-Tree, the time complexity is much lower than that of the traversal of an original construction method, the method for constructing the domain graph is as follows, an original data set of the Tree point cloud needing to be constructed is given, and the KD-Tree structure defined in the text is shown in the following table.

TABLE-KD-Tree Structure

The pseudo code of the construction process is:

after the KD-Tree is built, 4 points of the nearest neighbor of each point cloud can be selected through dimension information, and a built K-neighbor graph is shown in fig. 2.

In the embodiment, after the K neighbor map is established, the point cloud with close distance on the K neighbor map needs to be found out to facilitate the subsequent skeleton extraction, a level set method is adopted to find the points with close distance on the K neighbor map, and a level set algorithm is an implicit expression curve method, namely, a low-dimensional target is expressed by the zero level of a level set function which is one-dimensional higher than the low-dimensional target. The level set may be expressed as a level set of a real-valued function f having n variables, which may be generally formulatedWhere c is a level set constant, and is called a level curve when n is 2, a level surface when n is 3, and a level set is called a level hypersurface when n > 3. And aggregateReferred to as the sub-level set of f. For the text, different level sets are divided according to different geodesic distances, and the point cloud data is divided into k different level sets according to the geodesic distances, wherein the geodesic distances are expressed as the distances from root nodes of trees (in the cases of human skeleton line or blood vessel reconstruction and the like, the root nodes can be used as height minimum points, namely points with the minimum Z-axis coordinate) to k adjacent maps of cloud points of each pointCan be expressed as L by formula as shown in FIG. 3(f,c,p)={p|c≤f(p)≤c+ρ},f(p)Represents the level set L(f,c,p)Geodesic distance, f, of the cloud point p of the midpoint(p)∈[c,c+ρ](ii) a c represents a level set L(f,c,p)The distance constant of (2) can be preset, and each level set corresponds to one distance constant; rho represents a distance increment threshold value which can be preset; setting neighborhood radius ε, L(f,c,p)A level set is represented. The resulting level set is shown in fig. 4.

In a preferred embodiment, the process of executing the automatic estimation of the number of forks per level set algorithm comprises:

step S31, let the level set be expressed as: l is(f,c,p)={p|c≤f(p)≤c+ρ},f(p)Represents the level set L(f,c,p)Geodesic distance, f, of the cloud point p of the midpoint(p)∈[c,c+ρ](ii) a Setting a neighborhood radius epsilon;

step S32, finding out all the cloud points of the core object point in the horizontal set, where the process of finding the cloud points of the core object point is:

for a point cloud point p in the horizontal set, the distance Dist from the point cloud point p(p,q)All point cloud points not larger than the neighborhood radius epsilon form a neighborhood set n of point cloud points pε(p)={q∈L(f,c,p)|Dist(p,q)Less than or equal to epsilon, if the point cloud point p is a neighborhood set nε(p)Number of midpoint cloud points | nε(p)| is greater than or equal to a neighborhood number threshold MinPTs, i.e. | nε(p)If | ≧ MinPTs, the point cloud point p is a core object point cloud point, otherwise, the point cloud point p is not a core object point cloud point;

step S33, if the point cloud point q satisfies q e nε(p)Then, the density of the point cloud point q and the point cloud point p is considered to be up; if the cloud point o E L(f,c,p)If the density of the point cloud point o and the point cloud point p can reach, and the density of the point cloud point o and the density of the point cloud point q can reach, the point cloud point p and the point cloud point q are called to be connected;

all point cloud points with the density reaching and connected with the density in the horizontal set are gathered into a point cloud point set, the point cloud point set is combined into a branch, at least one point cloud point set can be obtained from one horizontal set, and each point cloud point set is used as a branch.

In this embodiment, starting from any core object point cloud point, finding out all the point cloud points whose density is up to and connected with the density of the core object point cloud point as a branch, determining whether all the point cloud points are branched, if not, starting from any core object point cloud point without branches, repeating the previous steps and clustering as branches until all the point cloud points are branched, thereby realizing automatic branching.

In the present embodiment, the automatic estimation algorithm of the number of branches is an algorithm for dividing branches according to density, and the algorithm is an algorithm having good robustness against noise, and is capable of dividing a region having a density up to a certain degree (including density up and density down) into a corresponding one of branches, and has an ability to find any branch. The greatest advantage of the automatic branch number estimation algorithm is that when branch point cloud clustering is carried out, the number of branches to be clustered is not required to be known in advance, and all branches can be automatically clustered by the algorithm by selecting appropriate clustering parameters (including neighborhood radius epsilon and neighborhood number threshold MinPTs). The density threshold formula can be defined as:where Den is a density threshold, and adjustment of Den can cluster different branches. The algorithm is described as follows:

in a preferred embodiment, in step S4, the process of connecting all the skeleton points obtained in step S3 to obtain skeleton lines includes:

step S41, regarding the obtained skeleton point, using the root node as the initial search point, using KD-Tree to perform neighbor search with radius r from the root node, marking the searched skeleton point as the main skeleton point and adding the main skeleton point into the skeleton point linked list, using the searched skeleton point as the new search point to perform neighbor search with radius r until the branching point is encountered,as shown in fig. 5, when the number of skeleton points whose Z-axis coordinates are larger than the Z-axis coordinates of the search point in the neighborhood of the search point radius r is larger than 1, each skeleton point whose Z-axis coordinates are larger than the Z-axis coordinates of the search point is taken as a bifurcation point. Step S42, setting the search point as p ', storing all branch points of the search point p' into the collection S to be searched(p')Respectively connecting the search point p' with the set S to be searched(p')Each branch point in the two branches is connected to obtain a plurality of branch vectors, and the sum of all the branch vectors is used as a skeleton growth direction vectorAs shown in fig. 6, a previous historical search point is connected to a current search point to obtain a vector as a first vector, and a skeleton growth direction vector is obtainedAn acute angle theta to the first vector.

Step S43, let the bifurcation point be q ', the bifurcation vector corresponding to the bifurcation point q' beIf it isTaking the bifurcation point q' as the main skeleton point ifTaking the bifurcation point q' as a branch skeleton point, and adding the main skeleton point and the branch skeleton point into a skeleton point linked list;expression findingThe direction vector of (a) is,expression findingThe direction vector of (2).

And step S44, taking the main branch skeleton point as a new search point to continue main branch neighbor search, taking the branch skeleton point as a root node of the branch where the branch is located to start branch neighbor search until all skeleton point searches are completed, and sequentially connecting the main branch skeleton point in the skeleton point linked list and the branch skeleton points of all branches to obtain skeleton lines. The main branch skeleton points in the skeleton point chain table can be stored according to the searched sequence, the branch skeleton points serving as the cross points can be stored in association with the main branch skeleton points with smaller Z-axis coordinates adjacent to the main branch skeleton points, and the branch skeleton points of each branch can be stored according to the searched sequence.

In a preferred embodiment, the method further comprises a skeleton line optimization step; the skeleton line optimization step comprises the following steps:

step A, taking the skeleton line obtained in the step S4 as an initial skeleton line, dividing the point cloud data into a plurality of local point cloud sets along the growth direction of the initial skeleton line, wherein the local point cloud sets only comprise point clouds of a main branch or point clouds of one branch;

step B, approximating the skeleton line in each local point cloud set as a three-dimensional space straight line, wherein the three-dimensional space straight line is expressed as:

wherein a1 represents a first x-axis parameter, B1 represents a first y-axis parameter, C1 represents a first z-axis parameter, D1 represents a first planar constant, a2 represents a second x-axis parameter, B2 represents a second y-axis parameter, C2 represents a second z-axis parameter, and D2 represents a second planar constant;

obtaining initial values of A1, B1, C1, D1, A2, B2, C2 and D2 according to the initial skeleton lines in the local point cloud set;

setting the value intervals of A1, B1, C1, A2, B2 and C2 respectively, wherein the value interval of each parameter comprises an initial value of the parameter, the values of the D1 and D2 are obtained in the value intervals of A1, B1, C1, A2, B2 and C2 respectively, and the values of the D1 and D2 are obtained according to the values of A1, B1, C1, A2, B2 and C2, and when the three-dimensional space straight lines corresponding to the values of A1, B1, C1, D1, A2, B2, C2 and D2 meet the objective function, the three-dimensional space straight lines corresponding to the values of the A2, B2, C2, D2, A2, B2 and C2 are used as the optimization line of the local set;

the objective function is:wherein argmin (·) represents a function that minimizes the value of the expression; djRepresenting the distance from the j point cloud point in the local point cloud set to the three-dimensional space straight line in the local point cloud set, setting that the local point cloud set comprises m point cloud points, wherein j belongs to [1, m ∈];dmeanRepresenting the average value of the distances from the point cloud points in the local point cloud set to the three-dimensional straight line in the local point cloud set,

and step C, connecting the optimized skeleton lines of all the local point cloud sets according to the growth direction of the skeleton lines, and connecting the optimized skeleton lines of all the local point cloud sets to obtain the whole optimized skeleton line, as shown in FIG. 7.

In this embodiment, after values of a1, B1, C1, a2, B2, and C2 are determined, D1 and D2 can be obtained by solving according to a three-dimensional linear equation and the coordinates of point cloud points in the local point cloud set.

In this embodiment, preferably, the value ranges of a1, B1, C1, a2, B2 and C2 are respectively fluctuated up and down from the initial values by taking the respective initial values as center points, and the specific fluctuation range may be set according to actual conditions, such as plus or minus 20% of the initial values. Preferably, a step value can be set, each parameter is sequentially or simultaneously valued according to the step value, a three-dimensional space curve is obtained after each value is taken, whether the target function is met or not is judged, if yes, stepping is stopped, and if not, stepping value is continued until the target function is met.

In this embodiment, preferably, in step B, the optimized skeleton line of each local point cloud set is obtained by:

step B1, setting n particles, wherein n is a positive integer, taking 6-dimensional variables (A1, B1, C1, A2, B2 and C2) as position variables of the particles, the speed variables of the particles are 6-dimensional, initializing the position and the speed of each particle, initializing the speed of each particle to 0, and respectively initializing the position of each particle to randomly select values in the value intervals of A1, B1, C1, A2, B2 and C2; initializing the historical optimum position and the current optimum position to (A1)0,B10,C10,A20,B20,C20),A10、B10、C10、D10、A20、B20、C20、D20Respectively representing initial values of A1, B1, C1, D1, A2, B2, C2 and D2 obtained according to initial skeleton lines in the local point cloud set;

and step B2, updating the position and the speed of each particle in the value intervals of A1, B1, C1, A2, B2 and C2 according to the following formulas:

vi(t+1)=vi(t)+c1′rand()′(pbest-xi(t))+c2′rand()′(gbest-xi(t));

xi(t+1)=xi(t)+vi(t+1);

wherein v isi(t)、vi(t +1) represents the velocity of the ith particle in the t-th iteration and the t + 1-th iteration, respectively, xi(t)、xi(t +1) represents the position of the ith particle in the t iteration and t +1 iteration, respectively, i ∈ [1, n ∈]Pbest is the current optimal position, pbest is the historical optimal position, rand () is a random setting value, and t is the iteration number; c. C1Denotes a first learning factor, c2Represents a second learning factor; the positions of the particles must be updated in the value intervals of A1, B1, C1, A2, B2 and C2;

step B3, calculating the fitness value of each particle, wherein the calculation formula of the fitness value isWherein the current optimal position pbest is updated to fitnessIf the current minimum fitness value is smaller than the fitness value corresponding to the historical optimal position, updating the historical optimal position gbest into the particle position with the minimum fitness value;

and step B4, if the current iteration time T +1 does not reach the preset maximum iteration time T, making T equal to T +1, returning to execute the step B2, the step B3 and the step B4, if the current iteration time T +1 reaches the preset maximum iteration time T, T belongs to [1, T-1], stopping iteration, and taking a three-dimensional space straight line obtained according to the historical optimal position as an optimized skeleton line of the local point cloud set.

In an application scenario of the embodiment, since in nature, tree growth or bones or blood vessels have a certain generation rule, and most of the tree growth or bones or blood vessels are approximately cylindrical, and since it is known that distances from points on a cylindrical surface to axes are equal, a PSO algorithm is adopted in this document to optimize initially connected skeleton lines, and only when the skeleton lines are central axes of the cylinders, variances from points on the cylindrical surface to the skeleton lines can be minimized. Therefore, the parameters of the skeleton line can be continuously optimized by adopting a space point cloud particle swarm algorithm, so that the variance of the distance is minimized as much as possible, namely:by reducing loss, the true skeleton line can be continuously approached, and the particle swarm algorithm process is described as follows: firstly, the position and the speed of the tree point cloud in a three-dimensional space can be respectively expressed as vectors, each tree point cloud has an adaptive value determined by a target function, and each tree point cloud point knows the best position found by the point cloud point and the position x of the point cloud point at presentiMeanwhile, each tree point cloud also knows the best position found by one point cloud cluster point cloud at present, namely the flight experience of a fellow, and each point cloud point xiThe next step of movement is determined by the experience of the user and the fellow. Cloud point particleThe subgroup algorithm first initializes a group of random particles and then obtains the optimal solution through continuous iterative optimization. In each iteration process, each point cloud point updates the position and the speed of the point cloud point according to the best position found by the point cloud point at present and the best positions found by all particles. The following can be described by the formula:

vi(t+1)=vi(t)+c1′rand()′(pbest-xi(t))+c2′rand()′(gbest-xi(t));

xi(t+1)=xi(t)+vi(t+1);

wherein v isi(t) refers to a memory term representing the last speed magnitude and direction; c. C1′rand()′(pbest-xi(t)) is a self-recognition item, and is the best position and speed found by the current point cloud point by self through experience; c. C2′rand()′(gbest-xi(t)) is a group recognition term, referring to the best position and velocity in the tree point cloud cluster.

In a preferred embodiment, the method further comprises: and step S5, smoothing the skeleton line by adopting a cubic B-spline interpolation algorithm. B-spline interpolation is defined as the interpolation at a known n1+1 control points wo(o=0,1,2,3,...,n1) Then, the expression of k' degree B-spline curve can be defined as:wherein N iso,w(μ)For a basis function for each control point pair, μ is an argument, o is the o-th node, woIs the number of nodes.

In an application scenario of the invention, in order to verify the correctness and validity of the algorithm of the text, the text selects several different tree point clouds for algorithm testing, wherein the several point clouds are respectively point clouds with noise points in point cloud data, point clouds with missing point cloud data and point clouds with uneven density distribution. The tree point cloud framework extraction method comprises the following steps that ubuntu16.04 is used in an experimental platform, a CPU (central processing unit) uses i 7-6700 HQ, a memory is 12G, PCL1.8 and C + +, are used in an algorithm, point cloud data used in the experiment are point clouds obtained by a laser scanner, and a visual evaluation method is adopted for evaluating the accuracy of the extracted framework structure of a tree point cloud framework extraction result.

In the application scene, in order to test the correctness and the validity of the skeleton extraction algorithm, the test is carried out on the tree point cloud with data missing, the tree point cloud with noise and the tree point cloud with non-uniform data distribution. The method of the application and the mentioned algorithm are compared with other skeleton extraction algorithms: FIG. 8 is a comparison graph of skeleton lines extracted from a tree point cloud with data missing by the method of the present application and skeleton lines extracted from other existing skeleton extraction algorithms, where the first column is the tree point cloud with data missing, the second column is the skeleton lines extracted from other existing skeleton extraction algorithms, and the third column is the skeleton lines extracted by the method of the present application; fig. 9 is a comparison graph of skeleton lines extracted by the tree point clouds with uneven density by the method and skeleton lines extracted by other existing skeleton extraction algorithms, wherein the first column is the original tree point clouds with uneven density, the second column is the skeleton lines extracted by other existing skeleton extraction algorithms, and the third column is the skeleton lines extracted by the method; fig. 10 is a comparison graph of skeleton lines extracted from noisy tree point clouds by the method of the present application and skeleton lines extracted from other existing skeleton extraction algorithms, where the first column is original noisy tree point clouds, the second column is skeleton lines extracted from other existing skeleton extraction algorithms, and the third column is skeleton lines extracted by the method of the present application. As can be seen from FIGS. 8 to 10, in most cases, the tree skeleton extracted by the method has good neutrality and better effect.

In the application scenario, the method firstly uses a point cloud framework extraction algorithm for automatically estimating the level set and the bifurcation number to obtain an initial framework, then uses a PSO algorithm to optimize the obtained initial framework, and then obtains a tree point cloud framework line with good centrality. The method has the following advantages:

1. when the tree point cloud has noise, the data distribution is not uniform or a small amount of data is missing, the skeleton line with good centering performance can be well extracted.

2. A point cloud point structure based on KD-Tree is used for accelerating the searching of point cloud points, the speed of the point cloud framework extraction algorithm for automatically estimating the bifurcation number is obviously improved, and the speed of Tree point cloud framework extraction is accelerated.

3. The PSO algorithm is used for optimizing the initial skeleton line, and the centering property of the tree skeleton line is guaranteed. The invention also discloses a point cloud skeleton line extraction system based on the automatic estimation of the bifurcation number, which comprises a point cloud data acquisition module and a processing module, wherein the point cloud data acquisition module acquires point cloud data and transmits the point cloud data to the processing module, and the processing module executes the steps of the point cloud skeleton line extraction method based on the automatic estimation of the bifurcation number to obtain skeleton lines.

In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

While embodiments of the invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

23页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种单目视觉测距的处理方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!