Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method for generating a vectorized road model from point cloud data, aiming at solving the problem of difficulty in generating a road model in the prior art.
The technical scheme adopted by the invention for solving the technical problem is as follows:
a method of generating a vectorized road model from point cloud data, comprising the steps of:
acquiring road point cloud data;
determining lane line data corresponding to the road point cloud data according to the road point cloud data;
determining the main direction of a lane line corresponding to the lane line data according to the lane line data;
obtaining connected lane line data according to the main direction of the lane line and the lane line data;
and determining a vectorization road model according to the connected lane line data.
The method for generating the vectorized road model from the point cloud data, wherein the determining of the lane line data corresponding to the road point cloud data according to the road point cloud data, comprises:
preprocessing the road point cloud data to obtain a point cloud block set;
and removing the point cloud blocks which are not lane lines in the point cloud block set to obtain lane line data corresponding to the road point cloud data.
The method for generating the vectorized road model from the point cloud data, where the removing of the point cloud blocks other than the lane line in the point cloud block set to obtain the lane line data corresponding to the road point cloud data, includes:
performing linear matching on each point cloud block in the point cloud block set, and removing the point cloud block when the ratio of the number of matched internal points in the point cloud block to the number of all points in the point cloud block is less than a first preset threshold value;
and carrying out bounding box calculation on each point cloud block in the point cloud block set, and removing the point cloud block when the length-width ratio of the bounding box of the point cloud block is smaller than a second preset threshold and larger than the reciprocal of the second preset threshold so as to obtain lane line data corresponding to the road point cloud data.
The method for generating a vectorized road model from point cloud data, where the performing linear matching on each point cloud block in the point cloud block set, includes:
performing linear matching on each point cloud block in the point cloud block set by using a RANSAC method;
the bounding box calculation of each point cloud block in the point cloud block set comprises:
and carrying out bounding box calculation on each point cloud block in the point cloud block set by an OBB method.
The method for generating the vectorized road model from the point cloud data, wherein the determining the main direction of the lane line corresponding to the lane line data according to the lane line data includes:
determining a covariance matrix of coordinates of each point in the point cloud block aiming at each point cloud block in the lane line data;
and determining an eigenvector corresponding to the covariance matrix according to the covariance matrix, and taking the eigenvector as the main direction of a lane line corresponding to the lane line data.
The method for generating the vectorized road model from the point cloud data, wherein the obtaining of the connected lane line data according to the main direction of the lane line and the lane line data includes:
storing any point cloud block in the lane line data into an empty bidirectional linked list, and taking the point cloud block as an original point cloud block of the bidirectional linked list;
determining seed points of the original point cloud blocks;
determining an expansion point corresponding to the seed point according to the main direction of the lane line and the seed point; the expansion point is a point which is a preset distance away from the seed point along the main direction of the lane line;
when the number of points in the neighborhood of the expansion point in the lane line data is greater than or equal to a preset number, verifying the original point cloud block according to the point cloud block to which the point belongs;
when the cloud block of the original point passes the verification, storing the point cloud block to which the point belongs into the bidirectional linked list; the neighborhood of the expansion point is an area which takes the expansion point as a circle center and takes a preset length as a radius; wherein the preset number is greater than 1.
The method for generating a vectorized road model from point cloud data, which obtains connected lane line data according to the main direction of the lane line and the lane line data, further includes:
and when the original point cloud block is not verified, continuing to execute the step of determining an expansion point corresponding to the seed point according to the main direction of the lane line and the seed point.
The method for generating a vectorized road model from point cloud data, which obtains connected lane line data according to the main direction of the lane line and the lane line data, further includes:
and when the number of the points in the neighborhood of the expansion points in the lane line data is smaller than the preset number, increasing the preset distance, continuously executing the step of determining the expansion points corresponding to the seed points according to the main direction of the lane line and the seed points, continuously executing the step of storing any point cloud block in the lane line data into an empty bidirectional linked list until the preset distance is larger than or equal to a distance threshold value, and taking the point cloud block as an original point cloud block of the bidirectional linked list until all the point cloud blocks in the lane line data are stored into the bidirectional linked list, and taking each bidirectional linked list as connected lane line data.
The method for generating the vectorized road model from the point cloud data, wherein the determining the vectorized road model according to the connected lane line data includes:
fitting the cloud blocks of each point in each linked list of the connected lane line data to obtain a straight line corresponding to the linked list;
and connecting the respectively corresponding straight lines of the two-way linked lists to obtain the vectoring road model.
The method for generating the vectorized road model from the point cloud data comprises the following steps of (1) generating a vectorized road model from the point cloud data, wherein the road point cloud data is road scene point cloud data collected and generated by Lidar equipment;
the preprocessing is carried out on the road point cloud data to obtain a point cloud block set, and the method comprises the following steps:
extracting road marking line data in the road line point cloud data;
and segmenting the road marking line data to obtain a point cloud block set.
Has the advantages that: the lane line data is determined according to the road point cloud data; determining the main direction of the lane line according to the lane line data; combining the main direction of the lane line with the lane line data to obtain connected lane line data; and finally, determining a vectorization road model according to the connected lane line data. The recombination and vectorization of the lane lines are realized, and the difficulty in generating the vectorized road model is reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1-2, the present invention provides some embodiments of a method for generating a vectorized road model from point cloud data. The method for generating the vectorized road model from the point cloud data is applied to equipment such as computers and servers, and can realize lane line recombination of urban high-speed and express roads by comprehensively considering the extraction process of the point cloud data, obtain a better vectorized road model result and reduce the difficulty of generating the vectorized road model.
As shown in fig. 1-2, a method for generating a vectorized road model from point cloud data according to the present invention includes the following steps:
and S100, acquiring road point cloud data.
Specifically, the road point cloud data is road scene point cloud data collected And generated by a lidar (light Detection And ranging) device. For example, a Lidar device may be employed to collect urban highway and expressway scene point cloud data. The Lidar device is a laser detection and measurement device. The Lidar device utilizes gps (global Position system) and IMU (Inertial Measurement Unit) onboard laser scanning. The data measured by the Lidar device is represented by discrete points of a Digital Surface Model (DSM), and the data contains spatial three-dimensional information and laser intensity information.
And S200, determining lane line data corresponding to the road point cloud data according to the road point cloud data.
Specifically, after the road point cloud data is obtained, since the road marking lines are mainly linear ground objects, and the noise and other marks are not, extraction and denoising are required to obtain the lane line data.
Specifically, step S200, determining lane line data corresponding to the road point cloud data according to the road point cloud data, includes:
and S210, preprocessing the road point cloud data to obtain a point cloud block set.
Specifically, the pretreatment comprises: extracting roads and extracting and segmenting identification lines.
Specifically, step S210 is to pre-process the road point cloud data to obtain a point cloud block set, including:
and S211, extracting road identification line data in the road route point cloud data.
And S212, segmenting the road marking line data to obtain a point cloud block set.
Specifically, the preprocessing is a basic step in the field of point cloud data extraction, and includes, but is not limited to, Z-coordinate gradient value screening to extract the ground, intensity value screening, SOR (statistical outlier remover), region growing extraction, and the like. The road point cloud can be finally divided into a block of point cloud blocks similar to straight line segments through preprocessing.
And S220, removing the point cloud blocks which are not the lane lines in the point cloud block set to obtain lane line data corresponding to the road point cloud data.
Specifically, the point cloud block set obtained by the road marking line data includes point cloud blocks of a lane line and point cloud blocks of a non-lane line. Therefore, it is necessary to remove point cloud blocks other than the lane line from the point cloud block set.
Specifically, step S230 is to remove the point cloud blocks other than the lane line in the point cloud block set to obtain lane line data corresponding to the road point cloud data, and includes:
step S231, performing linear matching on each point cloud block in the point cloud block set, and removing the point cloud block when a ratio of the number of matched interior points in the point cloud block to the number of all points in the point cloud block is less than a first preset threshold.
Specifically, each point cloud block in the point cloud block set is subjected to straight line matching through a RANSAC method. Random sample consensus (RANSAC) is a random parameter estimation algorithm. RANSAC randomly selects a subset of samples from the samples, calculates model parameters for the subset using a least square error estimation algorithm, then calculates the deviation of all samples in the model, and then compares the deviation with a preset threshold. When the deviation is greater than the threshold, the sample point belongs to an outlier. By repeating this process, the model is the best model when the number of values in the cluster is the greatest.
In particular, each point cloud tile in the set of point cloud tiles is matched using a line model. A ratio is used to distinguish:
wherein n is
inliersThe number of matched interior points in the point cloud block, namely the number of points which can be matched with the straight line model in the point cloud block is represented, and n represents the number of all the points in the point cloud block. If the ratio k is larger than or equal to a first preset threshold value, the point cloud block is reserved in the point cloud set, and if the ratio k is smaller than the first preset threshold value, the point cloud block is removed from the point cloud set.
And step S232, carrying out bounding box calculation on each point cloud block in the point cloud block set, and removing the point cloud block when the length-width ratio of the bounding box of the point cloud block is smaller than a second preset threshold and larger than the reciprocal of the second preset threshold so as to obtain lane line data corresponding to the road point cloud data.
Specifically, Bounding box calculation is performed on each point cloud block in the point cloud block set by an obb (organized Bounding box) method. The bounding box algorithm is a method of solving the optimal bounding space of a discrete point set. The basic idea is to approximate complex geometric objects with slightly larger and simpler geometric shapes (called bounding boxes). OBB is a common bounding box type, which is the smallest cuboid containing an object. The most characteristic of an OBB is its arbitrary orientation, which makes it possible to enclose the object as much as possible according to the shape characteristics of the closed object. For a straight line segment model, its OBB should be a long and narrow rectangle.
Specifically, a ratio s is used to distinguish:
wherein p is
1And p
2Is the coordinate of a pair of diagonal vertices of the rectangle and has p
1·x>p
2·x,p
1·y>p
2·y。p
1X represents the x-axis coordinate value of the first vertex, p
1Y represents a y-axis coordinate value of the first vertex, p
2X represents the x-axis coordinate value of the second vertex, p
2Y represents a y-axis coordinate value of the second vertex, and the ratio s represents an aspect ratio of the bounding box, and since the direction of the length and width of the bounding box cannot be specified, the determination is made using the second preset threshold and the inverse of the second preset threshold. If the ratio s is larger than a second preset threshold or smaller than the reciprocal of the second preset threshold, the point cloud block is reserved in the point cloud set; and if the ratio s is smaller than a second preset threshold and larger than the reciprocal of the second preset threshold, removing the point cloud block. And obtaining lane line data corresponding to the road point cloud data in a mode of combining RANSAC and OBB.
And step S300, determining the main direction of the lane line corresponding to the lane line data according to the lane line data.
Specifically, since long solid lines and dotted lines of the road route are extracted and divided into point cloud blocks, it is necessary to connect these point cloud blocks to form the road route when forming the road model. Firstly, determining the main direction of the lane line data, and then connecting adjacent point cloud blocks on the same main direction and position of the lane line to form the lane line. The principal direction is calculated here using PCA (principal component analysis). PCA (principal component analysis) is a technique for analyzing and simplifying data sets, where PCA is used to calculate eigenvalues and eigenvectors for principal direction analysis.
Specifically, step S300, determining the main direction of the lane line corresponding to the lane line data according to the lane line data includes:
and S310, determining a covariance matrix of coordinates of each point in the point cloud block aiming at each point cloud block in the lane line data.
Step S320, determining an eigenvector corresponding to the covariance matrix according to the covariance matrix, and taking the eigenvector as a main direction of a lane corresponding to the lane data.
And setting the X, Y and Z coordinates of the middle point of the point cloud as random variables X, Y and Z, and then setting the covariance matrix as:
where cov represents the covariance of the two variables.
For this matrix a, if there is a number λ and a non-zero three-dimensional column vector u, such that: if Au is λ u, the number λ is referred to as a feature value, and the column vector u is referred to as a feature vector.
The local direction of the point cloud can be represented through the feature vector by PCA, so that the aim of reconstructing the lane line subsequently is fulfilled.
And S400, obtaining connected lane line data according to the main direction of the lane line and the lane line data.
Specifically, after the main direction of the lane line is determined, the connected lane line data is obtained according to the main direction of the lane line and the lane line data, that is, the main direction of the connected lane line is the same, and the connected lane line data is formed by adjacent point cloud blocks at the positions.
Specifically, step S400, obtaining connected lane line data according to the main direction of the lane line and the lane line data, includes:
and S410, storing any point cloud block in the lane line data into an empty bidirectional linked list, and taking the point cloud block as an original point cloud block of the bidirectional linked list.
Specifically, an empty doubly linked list P is created, and a random point cloud block a is selected from the line segment point cloud block set Q and pushed into the doubly linked list P. The point cloud block a can thus be used as the original point cloud block of the doubly linked list P. Each doubly linked list P has an origin cloud chunk. The doubly linked list P is a vector, and the original cloud block is the first element or the last element of the doubly linked list P.
And step S420, determining the seed point of the original point cloud block.
Specifically, the seed point of the original point cloud block is determined according to the original point cloud block, for example, the gravity center of the original point cloud block can be used as the seed point, and the coordinate of the seed point is (x)o,yo,zo)。
Step S430, determining an expansion point corresponding to the seed point according to the main direction of the lane line and the seed point; the expansion point is a point which is a preset distance away from the seed point along the main direction of the lane line.
Specifically, if the original point cloud block is the first element of the doubly linked list P, the main direction of the lane line is (a, b, c), and if the original point cloud block is the last element of the doubly linked list P, the main direction of the lane line is reverse (-a, -b, -c), for example, the preset distance may be i (the initial value of i is 1) unit lengths. Extending the seed point along the main direction of the lane line of the original point cloud block by a preset distance to obtain an extension point (x)o+ia,yo+ib,zo+ ic) or (xo-ia,yo-ib,zo-ic)。
Step S440, when the number of points in the neighborhood of the expansion point in the lane line data is greater than or equal to a preset number, verifying the original point cloud block according to the point cloud block to which the point belongs; wherein the preset number is greater than 1.
Specifically, when the number of points in the neighborhood of the expansion point in the lane line data is greater than or equal to the preset number, the original point cloud block needs to be verified according to the point cloud block to which the point belongs (it needs to be pointed out that the points in the neighborhood of the expansion point in the lane line data belong to the same point cloud block), and when the verification passes, the point cloud block is stored in the doubly linked list. This can avoid the inaccuracy problem that the direction of lane line squints and brings.
And during verification, determining a reference expansion point corresponding to the point cloud block to which a point in the neighborhood of the expansion point belongs according to the opposite direction of the main direction of the lane line of the point cloud block to which the point belongs in lane line data, and if at least K points in the original point cloud block are located in the neighborhood of the reference expansion point, namely the distance between the at least K points in the original point cloud block and the reference expansion point is less than or equal to a preset distance and the original point cloud block is located in the opposite direction of the main direction of the point cloud block to which the point belongs, the original point cloud block passes verification. And if the original point cloud block is positioned outside the neighborhood of the reference expansion point, namely, the distances between all the points in the original point cloud block and the reference expansion point are greater than the preset distance, the original point cloud block is not verified.
Specifically, a reference seed point of the point cloud block to which the point belongs is determined according to the point cloud block to which the point in the neighborhood of the expansion point belongs in the lane line data, for example, the center of gravity of the point cloud block to which the point belongs may be used as the reference seed point, and the coordinate of the reference seed point is (x) x1,y1,z1). And determining a reference expansion point corresponding to the seed point according to the main direction of the lane line and the reference seed point of the point cloud block to which the point in the neighborhood of the expansion point belongs in the lane line data.
Step S450, when the cloud block of the original point passes the verification, storing the point cloud block to which the point belongs into the bidirectional linked list; the neighborhood of the expansion point is an area which takes the expansion point as a circle center and takes a preset length as a radius.
Specifically, a point cloud block to which a point belongs within a neighborhood of the expansion point is determined, and the point cloud block to which the point belongs is stored in a doubly linked list. The preset length is R, the neighborhood of the expansion point is a region with the radius of R, and the expansion point is located at the center of the region. Specifically, a point cloud block with an extension point adjacent to the lane line data can be selected by adopting a K-nearest neighbor algorithm.
And step S460, when the original point cloud block is not verified, continuing to execute the step of determining the expansion point corresponding to the seed point according to the main direction of the lane line and the seed point.
Specifically, if the original point cloud block fails to be verified, the expansion point needs to be determined again, that is, the process returns to step S430.
Step S470, when the number of points in the neighborhood of the expansion point in the lane line data is smaller than a preset number, increasing the preset distance, and continuing to execute the step of determining the expansion point corresponding to the seed point according to the main direction of the lane line and the seed point, until the preset distance is greater than or equal to a distance threshold or the number of point cloud blocks in the neighborhood of the expansion point in the lane line data is smaller than the preset number, continuing to execute the step of storing any point cloud block in the lane line data into an empty doubly linked list, and using the point cloud block as an original point cloud block of the doubly linked list, until all point cloud blocks in the lane line data are stored into the doubly linked list, and using each doubly linked list as connected lane line data.
Specifically, when the number of points in the neighborhood of the expansion point in the lane line data is smaller than the preset number K, the preset distance is increased, for example, the value of i may be increased by 1, the preset distance is i +1 unit length, and the step of determining the expansion point corresponding to the seed point according to the main direction of the lane line and the seed point is continuously performed, that is, returning to step S430, since the preset distance is increased, that is, the distance between the expansion point and the seed point is increased. And increasing the preset distance until the preset distance is greater than or equal to a distance threshold value, continuing to store any point cloud block in the lane line data into an empty bidirectional linked list and using the point cloud block as an original point cloud block of the bidirectional linked list, and returning to the step S410 when the preset distance is greater than or equal to a distance threshold value I, namely recreating the empty bidirectional linked list and continuing to store the point cloud block until all point cloud blocks in the lane line data are stored into the bidirectional linked list and using each bidirectional linked list as connected lane line data.
And S500, determining a vectorization road model according to the connected lane line data.
Specifically, step S500, determining a vectorized road model according to the connected lane line data, includes:
and step S510, fitting the cloud blocks of each point in each linked list of the connected lane line data to obtain a straight line corresponding to the linked list.
And S520, connecting the corresponding straight lines of the two-way linked lists respectively to obtain the vectorization road model.
Specifically, the point cloud blocks of the connected lane lines in each two-way linked list P are fitted by using a least square algorithm, the line segment point cloud blocks in each lane line can be fitted into a straight line, and the straight lines are connected according to the positions of the point cloud blocks in the two-way linked list P, so that the final vectorized lane line data can be obtained.
Tables 1 and 2 show the key indices of the process, respectively. Wherein tp (true Positive points) represents the number of true class points, which is specifically represented by the number of points detected as Positive samples whose true values are also Positive samples; fp (false Positive points) represents the number of false Positive points, which is specifically represented by the number of points of which the true value is a negative sample among the detected values of the Positive samples; fn (false Negative points) indicates the number of false Negative type points, which is expressed as the number of points in which a true value is a positive sample among values in which a Negative sample is detected. In addition, some related parameter calculation formulas are as follows:
table 1 key index table of lane line data in step S200
| Index (I)
|
Value of
|
| TP
|
2,765,585
|
| TP+FP
|
2,811,337
|
| TP+FN
|
2,838,729
|
| Rate of accuracy
|
0.984
|
| Recall rate
|
0.974
|
| F1-score
|
0.979 |
Table 2 key index table of lane line data connected in step S400
| Index (I)
|
Value of
|
| TP
|
2,613,492
|
| TP+FP
|
2,765,585
|
| Rate of accuracy
|
0.945 |
In conclusion, the method carries out preprocessing on the road point cloud data (including extraction of roads and extraction and segmentation of identification lines); according to the preprocessed point cloud data, further extracting and denoising from all the identification line data in a RANSAC and OBB combined mode to be used as lane line data; respectively carrying out Principal Component Analysis (PCA) on all the lane line data to obtain the principal directions of all the lane lines; judging the lane lines adjacent to the similar main direction according to the main direction of the lane lines and connecting the lane lines; and then obtaining a final vectorization road model result by a straight line extraction method in the point cloud. The invention comprehensively considers the space geometric characteristics of the lane marking lines in the road: a lane marking line connection and vectorization method based on PCA is provided, which has better effect on the automatic extraction and recombination of the road marking line.
Compared with the existing road extraction and point cloud vectorization technology, the embodiment of the invention comprehensively considers the space geometric characteristics of the lane identification lines in the road:
1) on the basis of comprehensively analyzing the existing road point cloud lane line extraction algorithm, an effective extraction method for the lane lines of the expressway and the urban expressway is provided: and extracting lane lines by only depending on unstructured point cloud data through lane line space features, and extracting and screening by using point cloud strength values and space structure features to finally obtain segmented point cloud blocks of all lane lines.
2) By the PCA-based method, the directions of the point cloud blocks are judged and the adjacent point cloud blocks are selected, so that the purpose of connecting the point cloud blocks in the dotted line section in the dotted line lane line is achieved, and finally the recombination and vectorization of the lane line can be realized.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.