# Automated Tunnel Point Cloud Segmentation and Extraction Method
## 2 Materials and Methods
### Application of the GuSAC Algorithm
#### 2.1.3 Non-Tunnel Structural Point Cloud Elimination Method  
This paper proposes a GuSAC algorithm based on regional plane fitting, which is directly applied to tunnel point cloud data. Leveraging the high-density characteristics of the tunnel point cloud, the algorithm can independently fit each region of the tunnel, effectively removing redundant point cloud data without altering the tunnel's original feature information. The specific steps are as follows:  
1. The GuSAC algorithm uses a segmented axis line as the operating line and assigns different labels to the tunnel point cloud data within a specific distance and angle range from the operating line.
2. Using the labeled point cloud data, the GuSAC algorithm performs plane fitting to obtain the parameters of the plane model, denoted as a plane, whose mathematical expression is: \[ax+by+cz+d=0\] (3)
3. Since the density of tunnel lining joints is much lower than the total number of tunnel lining points, the RANSAC algorithm accurately captures the tunnel lining point cloud and treats it as a tunnel lining plane. Then, the normal vector is computed based on the inliers detected by RANSAC, and the vertical distance from each point \((x_{p},y_{p},z_{p})\) to the plane is calculated. By combining the normal vector and the vertical distance values, all non-tunnel structural point clouds within the tunnel can be removed. The formula is expressed as follows: \[DIS(P)=\frac{\left|ax_{\text{p}}+by_{\text{p}}+cz_{\text{p}}+d\right|}{\sqrt{ a^{2}+b^{2}+c^{2}}}\] (4) \[cos(\theta_{p})=\frac{\left|n\right|\cdot\left|n_{p}\right|}{\left|n\right| \left|n_{p}\right|}\] (5)
4. Create sets \(Y\) and \(N\), and define thresholds \(\lambda_{I}\) and \(\lambda_{2}\). \(\lambda_{I}\) is the actual depth of the tunnel lining joint divided by a certain normalization factor, and \(\lambda_{2}\) is defined as the mean of the local point cloud's overall normal vector minus 1.5 times the standard deviation. Using these two thresholds as denoising standards, the annular point cloud can be separated from the tunnel lining joints, tunnel pipelines, and other element point clouds. The specific process is as follows: \[Y=\left\{p\in P\middle|DIS(P)<\lambda_{1},cos(\theta_{p})<\lambda_{2}\right\}\] (6)
5. When the ring joint width H exceeds the minimum neighborhood parameter of the subsequent TMatch algorithm, the calculation is terminated. Otherwise, the parameter is reduced, and iterative calculations are performed until the condition is satisfied.  
In this experiment, the tunnel is divided into 72 smaller regions by performing a 5\({}^{\circ}\) cut along the tunnel's circumferential direction, with the central axis of the tunnel as the reference. At the same time, the track data within the tunnel are removed. For straight sections, the longitudinal width can be set according to the specific width of the ring segment, or it can be appropriately enlarged. For curved sections, the longitudinal width can be slightly reduced. The output of the tunnel is shown in Figure 4. Using this method, most of the non-tunnel structural point cloud and noise points in the tunnel can be effectively removed, resulting in a smooth tunnel cross-section.