Optimization Algorithm for Point Cloud Quality Enhancement Based on Statistical Filtering

In the process of acquiring point cloud data by a 3D laser scanner, some problems, such as outliers, mixed points, and holes, may be caused in the target point cloud due to the external environment, the discreteness of the laser beam, and the occlusion of objects. In this paper, a point cloud quality optimization and enhancement algorithm is designed. A self-adaptive octree is established to rasterize the point cloud and calculate the density of each grid, combing with the statistical filtering to remove outliers from the point cloud data. Then, a plane projection method is used for removing the confounding points from the point cloud data. Finally, the point cloud is triangulated and a priority value is set, and then, points are preferentially inserted where the priority value is the largest to repair the holes. Experiments show that while removing outliers and confounding points, the detailed features of the point cloud can be maintained, holes are effectively filled, and the quality of the point cloud is effectively improved.


Introduction
In recent years, laser 3D scanning technology has developed rapidly. As a new format of data, the three-dimensional point cloud can accurately record the three-dimensional topography, geometric features, spatial coordinates, and other information about the surface of the object, and it has many advantages that two-dimensional data does not have [1]. In the process of acquiring point cloud data by a 3D laser scanner, outliers, mixed points, holes, and other defects may be generated in the target point cloud due to the external environment, the discreteness of the laser beam, and the occlusion of objects [2][3][4][5]. These defects degrade the quality of the point cloud and affect the subsequent reconstruction accuracy of the three-dimensional surface.
Pirotti et al. [6] made some assessment with the two commonly used outlier detection methods-statistical outlier removal (SOR) filter and local outlier factor (LOF) filter. Four different filtering algorithms were well used for filtering the raw point cloud data form a UAV by Mustafa Zeybek [7], and a developed methodology contributes to the reduction of errors caused by data losses in various modelling studies [8]. Fleishman et al. [9] proposed the moving least squares algorithm, in which the noise points are projected onto an estimated plane. But it is sensitive to a large number of outliers. Based on the locally optimal projection (LOP) algorithm proposed by Lipman et al. [10], Huang et al. [11] proposed weighted locally optimal projection algorithms that can remove some noise points during the projection. But these algorithms have poor robustness and cannot keep the sharp features of the point cloud well. Rusu et al. [12] proposed an algorithm based on neighborhood statistics, which needs two iterations and takes much time to process the large-scale point cloud. Meanwhile, it is a challenge to guarantee accuracy when removing the noise. Ning et al. [13] proposed a simple and effective noisy point trimming method based on two geometric feature constraints, but it is only suitable for certain types of noise. Ester et al. [14] proposed a clustering algorithm DBSCAN, which can be used for removing the redundant points including the noise points. Leal et al. [15] presented a two-step method both for normal estimation and for point position update, measuring the sparsity of sharp features while discriminating between noise and feature, but the performance in some models with more detailed features is general. In addition to removing noisy points, the optimization and enhancement of point cloud quality also need to repair the holes caused by the object occlusion. Holes repairing algorithms based on triangular meshes could be divided into two categories: surfacebased methods and volume-based ones [16]. Generally, surface-based methods detect, repair, and refine the holes on the given triangular mesh [17,18]. Volume-based methods convert the given mesh into a function with signed distance on the volume mesh to fill the holes and then extract the complete grid from the zero-order set of the distance function [19][20][21]. The holes repairing the algorithm proposed by Leong et al. [22] directly connect the boundary of the holes, but the repair is not effective since no new triangle surfaces are added. Liu Zhenghong and Yun [23] extracted the boundary of the holes and determined the direction of contraction by calculating the direction of the triangular surface's normal vector related to the boundary point. In this way, a complete triangular patch is iteratively generated, but the number of additional points could not be controlled. The point cloud quality optimization and enhancement algorithm designed in this paper could effectively remove the outliers and confounding points while maintaining the sharp features of the point cloud. At the same time, by setting the priority value, the number of new points could be controlled when repairing holes.

Theoretical Derivation
The implementation steps of the proposed method are as follows: (1) Establishing a self-adaptive octree to rasterize the point cloud and setting the thresholds for defining the outliers to delete these points (2) After removing the outliers, projecting the point cloud onto the local least squares fitting plane to remove the confounding points (3) Establishing a priority value and inserting points at the positions with higher priority values until the hole filling which is completed 2.1. Outlier Removal. Outliers are usually disorganized, far away from the main point cloud, sparse, and geometrically discontinuous with inconsistent local point density. In contrast, the main point cloud is relatively concentrated and dense. The statistical filtering algorithm is based on the characteristics that the distance between the outlier points and the neighboring points is considerable while the distance between the main points and the neighboring points is small. And the statistical analysis towards the neighborhood of each point is used for removing the outliers [24]. In this paper, density is introduced based on the statistical filtering algorithm. First, an octree is established to take the minimum enclosing cube of the point cloud as the root node, and the cube is divided into eight subcubes with equal size. If a subcube contains points, it should continue to be divided into eight cubes with equal size until each point in the point cloud obtains a unique index coordinate. Then, the density of the point cloud in each small cube is calculated, and usu-ally, the density of the subcube containing outliers is relatively small. The specific implementation steps are as follows: (1) Establishing a self-adaptive octree to rasterize the point cloud and calculating the density of the point cloud ρ n in each grid (2) For any point p i ∈ P of the point cloud in each grid, searching for the k-neighborhood point p j ðj ∈ kÞ of p i and calculating the distance between p i and p j (3) Defining the probability of a point being an outlier as (4) Establishing a threshold. If δ is greater than the threshold, p i is considered an outlier and is deleted 2.2. Confounding Point Removal. Confounding points cannot be easily distinguished from the real point cloud. It is difficult for traditional algorithms to achieve a balance between removing the confounding points and maintaining the detailed and sharp features of the point cloud. In this paper, we use the least square to fit the local plane and obtain the normal vector of the local plane. The mixed points are projected onto the local fitting plane, which not only improves the quality of the point cloud but also maintains the sharp features. The least squares method is used for fitting the local plane and obtaining the normal vector. First, we fit a local plane with a set of points composed of a point p i ∈ P and its k-neighborhood points. Suppose the local fitting plane is Z = Ax + By + C, and then, the formula of the deviation quadratic sum is as follows: It can also be written in matrix form as follows: where U = x 1 y 1 1 Journal of Sensors When d takes the minimum value, the fitting degree is the best. According to the least squares criterion, we can use the following formula to obtain B.

Journal of Sensors
In this way, the fitting plane can be obtained, and the normal vector of a certain point can also be got by substituting the coordinates of the point into the fitting plane.     The specific implementation steps are as follows: (1) For a point p i ∈ P in the target point cloud P, searching for its k-neighborhood points and calculating the mean value p mi of the neighborhood points (2) Using the least squares method to fit a local plane L i and calculating the normal vector n i of p mi (3) Calculating the projection of the vector p i p mi in the normal direction to obtain the distance d from the point p i ∈ P to the local fitting plane L i (4) Projecting p i ∈ P onto the local fitting plane L i and obtaining a projection point p i ′   Journal of Sensors there is a hole by the area of the triangle. In this paper, a priority value is established preferentially to repair the part with a larger hole area in the point cloud. A higher priority value means that a specific part in the point cloud has a larger area of the hole. Then, a point is inserted firstly in the part with the largest priority value. Next, the inserted point is merged with the original point, and the above operations are repeated until the holes are repaired.
The specific implementation steps are as follows: (1) Triangulating the target point cloud using triangulation algorithm (2) Getting the corresponding three edges a i , b i , c i from the vertices of each triangular patch; and using Heron's formula to calculate the area s i of each triangular patch; then getting the priority value corresponding to each triangular patch (3) Getting the largest priority value, that is, finding the triangular patch with the largest area and its vertices (4) Inserting a point P hi at the center of gravity of the triangle with the largest priority value and getting a new point set The denoising accuracy and denoising recall rate [25] are adopted to evaluate the effect of the algorithm on the outlier removal so as to verify the effectiveness of the proposed algorithm. Since the denoising accuracy and the denoising recall rate are inversely proportional, the F-score is introduced as the harmonic mean of the two parameters. A higher F-score means a better performance of the algorithm. The chamfer distance [26] is used for measuring the average nearest squared distance between the point cloud S 1 and S 2 . The denoising accuracy can be calculated as follows: where P d is the denoising accuracy, N q is the number of noisy points removed, and N s means the whole number of noisy points. The denoising recall rate is defined by the following formula:     Journal of Sensors where R d is the denoising recall and N y is the number of points that should be removed. So the F-score can be obtained by where F 1 is the F-score. We defined d CD ðS 1 , S 2 Þ as the chamfer distance between the point cloud S 1 and S 2 , and it can be calculated as follows: where x is the point in S 1 and y is the point in S 2 .
In the experiments, we added 10%, 20%, and 30% random noise to the point cloud, respectively. The method of adding noise points in this paper is as follows: some points are selected randomly in the origin point cloud; then, the coordinates of these points are changed within a range; here, we used the 2 to 8 times of mesh resolution, so the confounding points and outliers could be obtained, adding these points into the origin point cloud so that we can get the noisy point cloud finally.
For enhancing the quality of the point cloud, first, we removed the outliers using the proposed algorithm and compared it with the statistical filtering and the radius filtering. As shown from Figures 1-3 and Tables 1-3, four neighborhood points are selected in the four algorithms, and the highest F-score value of each algorithm and the corresponding P d and R d are recorded. In the second part, we removed the confounding points using the proposed method. After processing the noisy point cloud by the proposed method, we calculated the d cd in each part. Finally, the point cloud was triangulated, and a priority value was set. Points are preferentially inserted to where the priority value was the largest so as to repair the holes. Figure 1 and Table 1 show that after the Bunny point cloud with 10% noise is processed by the proposed method, the surface of the point cloud is smooth, uniform, and almost without noise; meanwhile, the outliers and confounding points are removed. The denoising recall rate of the radius filtering is higher than that of the statistical filtering and the proposed outlier removal algorithm. But the denoising accuracy rate and F-score of the outlier removal algorithm are better than those of the statistical filtering and the radius filtering. Figure 2 and Table 2 demonstrate that after the Bunny point cloud with 20% noise is processed by the proposed method, no noticeable noise points appear on the surface of the point cloud, together with the outliers and confounding points removed. The denoising recall rate of the radius filtering is better than that of the statistical filtering and the outlier removal algorithm. Yet the denoising accuracy rate     and F-score of our outlier removal algorithm are better than those of the statistical filter and radius filtering.
In experiment 3, Figure 3 and Table 3 show that after in the Bunny point cloud with 30% noise is processed by the proposed method, no obvious noise points exist on the surface of the point cloud, together with the outliers and confounding points removed. The denoising recall rate of the radius filtering is better than that of the statistical filtering and the proposed outlier removal algorithm. But the denoising accuracy rate and F-score of our outlier removal algorithm are better than those of the statistical filter and radius filtering.
The effect comparison of the three algorithms in removing outliers with different noise degrees is shown in Figure 4.
The proposed outlier removal algorithm shows an upward trend with the increase of noise level, the radius filtering tends to be stable, and the statistical filtering shows a downward trend. The algorithm in this paper has always been better than the other two algorithms.
The s 0 is the original Bunny point cloud, s 1 is the noisy point cloud, s 2 is the point cloud after the outliers removed by the proposed outlier removal algorithm, and s 3 is the point cloud after the confounding points removed by the proposed confounding point removal algorithm. From the evaluation indicators in Table 4, we can see that d CD ðs 0 , s 3 Þ is smaller than d CD ðs 0 , s 2 Þ and d CD ðs 0 , s 1 Þ, indicating that the proposed algorithm can effectively remove outliers and confounding points.
The Bunny point cloud with 20% noise added is taken as an example to verify the effect of hole filling. Both the Bunny point cloud with noise and that has been processed by the proposed algorithm are triangulated, as shown in Figures 5(a)

Experimental Verification of Algorithm Performance.
To further verify the effect of the proposed algorithm, the actual point cloud data of the locomotive pantograph slide, obtained by the laser line structured light three-dimensional scanner, is set as the experimental object. In the data collection, the camera type is Ranger3, the laser model is Lingyun (808 nm, 15 W), and the effective accuracy of the 3D scanner is 0.5 mm. The collected pantograph data contains 632,718 points with some obvious defects on the surface. The results are shown from Figures 6-8 and Tables 5-7. Figure 6 and Table 5 show that after the pantograph point cloud with 10% noise is processed by the proposed method, no obvious noise points exist on the surface of the point cloud, together with the outliers and confounding points removed. Radius filtering has the highest denoising accuracy. The denoising recall rate of the statistical filtering is better than that of the radius filtering and the proposed outlier removal algorithm. However, the denoising accuracy of the proposed outlier removal algorithm is close to that of the radius filtering, and the denoising recall rate is close to that of the statistical filtering. The F-score of the proposed outlier removal algorithm is better than that of the statistical filtering and radius filtering. So the comprehensive performance of the proposed method is the best. Figure 7 and Table 6 show that after the pantograph point cloud with 20% noise is processed by the proposed method, no noticeable noise points appear on the surface of the point cloud, together with outliers and confounding points removed. The denoising accuracy rate, the denoising recall rate, and F-score of the proposed outlier removal algorithm are better than those of the statistical filtering and radius filtering. Figure 8 and Table 7 illustrate that after the pantograph point cloud with 30% noise is processed by the proposed method, no evident noise points remain on the surface of the point cloud together with the outliers and confounding points removed. The denoising recall rate of the radius filtering is better than that of the statistical filtering and the proposed outlier removal algorithm, but the denoising accuracy rate and F-score of the proposed outlier removal algorithm are better than those of the statistical filter and radius filtering.
The effect comparison of the three algorithms in removing outliers with different noise degrees is shown in Figure 9. The proposed outlier removal algorithm and the radius filtering show an upward trend with the increase of noise level, and the statistical filtering shows a downward tread. The proposed algorithm always performs better than the other two algorithms. 8

Journal of Sensors
The s 0 is the original pantograph point cloud, s 1 is the noisy point cloud, s 2 is the point cloud after the outliers removed by the proposed outlier removal algorithm, and s 3 is the point cloud after the confounding points removed by the proposed confounding point removal algorithm. From the evaluation indicators in Table 8, the proposed algorithm can remove both the outliers the confounding points.
To show the hole filling effects, we compared the original pantograph point cloud with that after the hole filling, as shown in Figure 10. Figures 10(a) and 10(c) illustrate the original pantograph point cloud and that after the hole filling, respectively. Figures 10(b) and 10(d) demonstrate the original pantograph point cloud with the local hole and that after the hole filling. The results show that the algorithm proposed in this paper effectively fills the hole.

Conclusions
In this paper, an algorithm for point cloud quality optimization and enhancement is designed and verified. Firstly, an adaptive octree is established to rasterize the point cloud and to calculate the density of each grid. Then, the statistical filtering is combined to remove the outliers from the point cloud data. And the method of plane projection is used for removing the confounding points. Finally, the point cloud is triangulated, and a priority value is set up to insert the point to the place where the priority value is the largest, so as to repair the holes. To verify the effectiveness of the proposed algorithm, we, respectively, added 10%, 20%, and 30% noise to the Bunny point cloud and used the actual point cloud data of the locomotive pantograph slider to test. Then, the proposed algorithm was compared with the statistical filtering algorithm and the radius filtering algorithm. Experimental results show that the proposed algorithm can decently keep the sharp and detailed features from the original point cloud surface while removing noise. It can also effectively fill the holes and comprehensively perform better than the algorithms of statistical filtering and radius filtering.

Data Availability
Data will be available on request.

Conflicts of Interest
The authors declare no competing financial interests.