Research Article

A Multilevel Point Cloud Classification Method for Underground Tunnels Based on Three-Dimensional Moving LiDAR Measurements

Table 2

Pseudocode of KT-DBSCAN secondary clustering algorithm.

Step 1Read the point cloud data, judge the core points, and temporarily classify the noncore points as noise points.
float x, y, z, r, , b, scalar;
while (input >> x >> y >> z >> r >>  >> b >> scalar)
{pointCloud.emplace_back (x, y, z);}
DBSCAN <float> dbscan (0.3f, 5, pointCloud);
Step 2If the point is the core point, create a new cluster.
if (neighbourPoints [i].size () ≥ MinPts)
{kernelObj.push_back (i);}
else
{pointCloud [i].cluster = NOISE;}
Step 3Establish kd-tree index, search neighborhood points, and classify the surrounding neighborhood points into the cluster.
pcl :: KdTreeFLANN < pcl :: PointXYZ>
kdtree; kdtree.setInputCloud (cloud);
Step 4If there are also core points in the neighborhood searched in the previous step, create a new cluster and judge the relationship.
for (int j = 0; j < neighbourPoints [index].size (); j++)
{if (k = = pointCloud [neighbourPoints [index] [j] ].cluster)
{continue;}
queue.push_back (neighbourPoints [index] [j]);
pointCloud[neighbourPoints [index] [j]].cluster = k;}
Step 5The points in the neighborhood around the core points are divided according to different clusters.
Step 6And so on, until no points can be classified, the remaining points are classified as noise points.