1 Introduction

3D Point Cloud (PC) is essential for rendering and developing solid models of physical objects. Due to its widespread usage in research fields, including 3D reconstruction [1], environmental mapping [2], signal processing [3], object identification [4], posture estimation [5], and drainage network determination [6], PC processing is an active area of study. 3D reconstruction applications are growing in popularity as computing platform costs fall and 3D capture systems improve. Various approaches based on relatively diverse ideas have been developed to get very precise PCs from the physical structures of objects [7]. PCs are noisy due to fluctuations in ambient physical parameters and noise sources built into the 3D capture process and equipment, despite improvements in PC capture technology used to represent numerical counterparts of physical models. As a result, many noise types should be filtered to build high-accuracy digital models of physical models [8].

The most common methods for producing PCs are photogrammetric methods, RGB-D sensors, and terrestrial laser scanners (TLS) [9]. These three commonly utilized approaches for obtaining a PC have distinct technical structures. According to TLS, Measurements of three-dimensional space are made using the local coordinate system, which takes into account the measured object's direction and distance. TLS can also construct a 3D PC of large regions by collecting millions of points per second [10]. TLSs have a significant investment cost despite producing high-accuracy and precision PCs [11]. Photogrammetric approaches determine parallax between correspondence points in scene photographs and make it possible to extract the locations of landmarks associated with both external and internal characteristics of orientation [12]. Photogrammetric approaches are becoming increasingly common as imaging technology and software improve [13]. RGB-D sensors are small systems that combine the capabilities of the camera with an RGB camera [14]. As a result, RGB-D sensors enable the acquisition of texture, similar to TLS and photogrammetric approaches, depth map included. Because of their customizable architecture and low cost, the development of indoor maps often involves the use of RGB-D sensors [15].

Filtering is a widely studied topic since it is such an important part of the processing pipeline. Many strategies for filtering point clouds make use of adaptations of statistical-based filtering concepts that are appropriate for the nature of the point cloud [16].

Using an inversely proportionate repartition of the sum of distances to the mean as weighting variables, Narváez et al. [17] show a new weighted principal component analysis (PCA) method for PC noise reduction. A weighted covariance matrix may be computed after determining the components and weighted mean. Each point is associated with a fitting plane generated by an eigenanalysis of the matrix, with its axis pointing in the direction of the eigenvector that corresponds to the smallest eigenvalue, and the direction of the eigenvector is indicated by the normal vector to the plane that corresponds to the largest eigenvalue. The updates harden the algorithm against random fluctuations. To keep the form attributes intact, an operator was used to shift the mean in the direction of the normal [18].

The measures taken between a point and its neighborhood similarity in neighborhood-based filtering algorithms are what ultimately decide where a point is filtered to be located [19]. According to the methods described here, the proximity of two points, a normal or an area, can all be used to establish a degree of resemblance. A bilateral filter is a smoothing filter that has been generalized to 3D meshed denoising while keeping edges. However, these methods need a mesh creation mechanism that is very susceptible to noise. The bilateral filter is applied directly to the point cloud, considering the positions and intensities of the points, as a means for resolving this problem [20].

Projection-based approaches move individual points around to filter a point cloud by employing different projection procedures. Wang et al. [21] introduced Locally Optimal Projection (LOP), a parameterization-free projection operator motivated by the L1 median in statistics. The goal of this technique is to remove noise and outliers in which a small portion of the input point cloud is repeatedly projected onto this small portion. However, projection using LOP tends to become non-uniform if the input point cloud is considerably non-uniform, which is undesirable in shape feature preservation and normal estimation [22].

Huang et al. [23] used WLOP to create an evenly distributed points set by incorporating locally adaptable the weight of each point density into LOP. The smoothness of LOP is very sensitive to the magnitude of the weight function's support size, h. Denoising does not affect at all a small value of h, but a big value causes the point cloud to shrink. Ye et al. [24] projected just the z coordinates of the point set, enabling x and y to be obtained by re-projection, to solve this problem. This method not only eliminates irregularities while preserving the underlying geometric structure, but it also creates smoothness [25].

Partial Differential Equations (PDE) [26], one of the most crucial resources for 3D computer graphics and image processing, has been effectively used for a variety of application tasks, such as image or mesh denoising. Filtering point clouds with PDEs is similar to filtering triangular meshes but with more flexibility. Combining the local finite matrices generated by several tiny point neighbors into a single matrix, [27] provided a technique for manufacturing point clouds using PDEs. They performed a discretization of an anisotropic geometric diffusion equation and used that to filter point clouds. This method has the potential to reduce noise while maintaining or improving detail.

Setting up a point cloud into a 3D box in 3D space is the first step in the voxel grid (VG) filtering procedure. As a further step, a single point is picked within each voxel to stand in for all the other points within it. In practice, we often make do with an estimate based on the centering of these sites or the center of this voxel [28]. Despite being slower overall, the former has a more precise surface depiction. In many cases, geometric information is lost while using the VG method [29].

In recent advancements in point cloud filtering, researchers have focused on addressing the challenge of removing undesired or outlier data to enhance the quality and accuracy of point cloud analysis. Fan et al. [30] proposed a novel filtering approach specifically designed to eliminate outdoor points from point cloud data captured in urban environments. Their method effectively identifies and removes points belonging to building facades, resulting in cleaner and more focused point clouds for further analysis. Li et al. [31] presented automated techniques for preprocessing indoor point cloud data. Their approach includes coordinate frame reorientation and removal of building exteriors, enabling more accurate and efficient indoor mapping and reconstruction. By considering these recent advancements, our research aims to contribute to the field by further improving the filtering techniques for enhancing the quality and utility of point cloud data analysis.

Although several techniques for filtering 3D point clouds have been developed in recent years, the vast majority are geared toward meshes. Only a select handful work directly with point clouds themselves. This study introduces a novel filtering approach based on the Maximum likelihood (ML) algorithm, which provides a deep analysis for filtering and classifying 3D point clouds. The remaining sections of the paper are structured as follows. The "Data collection and site description" section explains where the tests will be conducted and what kinds of information will be collected. The “Methodology" and "Results and Discussions" sections provide a thorough presentation and analysis of the gathered data. The last section of the article is titled "Conclusions."

2 Data collection and site description

The 3D PC for the test area has been collected for about 4840 m2, including a mosque which consists of 2 floors with 544 m2 total area, open and green areas, and trees. The buildings have a wide range of natural features and textured structures, as shown in Fig. 1. The 3D data set has been collected by using the TLS technique Fig. 2.

Fig. 1
figure 1

The test area used for the study

Fig. 2
figure 2

The 3D PC data set and TLS scanning positions

2.1 Terrestrial laser scanner

To survey the 3D PC for the selected area, a middle-range TLS, TOPCON GLS-2000, was used, as shown in Fig. 3. This laser scanner uses the pulse time of flight technique for its measurements. The GLS-2000 is a fast and simple technique to get 3D PC data, and it also satisfies the research experts with its occupation and rear viewing method, which only requires one contact from a non-specialist. Table 1 displays the Topcon GLS-2000 terrestrial laser scanner's detailed technical specifications.

Fig. 3
figure 3

The TLS TOPCON GLS-2000

Table 1 Summary of the employed Topcon GLS-2000 TLS specification

TOPCON GLS-2000 3D TLS has been used to collect the 3D PC data set, as shown in Fig. 4. The laser scanning system has a scanning rate of over 120,000 points per second, with a scanning range of 360º horizontally and 270º vertically. The scan range is up to 350 m. About 30 m apart from the study site, the TLS TOPCON GLS-2000 was installed. It took about 7 min to obtain 1,847,176 scanned 3D PCs with a 6 s angular resolution [32]. Scanning results were recorded on a memory card before being uploaded to a computer for analysis. ScanMaster has been utilized to geo-reference data to survey control tie points (3 fixed prisms) after the field operation, as well as to import, analyze, and filter obtained cloud information Fig. 2 [33].

Fig. 4
figure 4

Data collection using the TLS in the field

The ScanMaster software provides simple access to tools for making and modifying meshes, polylines, flats, and corners. The surface selector device is very useful for deciding on surfaces like roads, building blocks, floors, and ceilings. It is easy to export the observation characteristics using the laser scanner technique after the coordinate’s transformation. The software simplifies the export of observation characteristics obtained through laser scanning. After transforming the captured coordinates to the desired coordinate system or reference frame, users can conveniently export the relevant data. This capability facilitates seamless integration with other software or workflows, allowing for further analysis, visualization, or sharing of the observed features and measurements.

A few steps involved consist of data checking, data registration, georeferencing, data coloring, data filtering, and until it is done with editing [10]. Figure 5 shows the processing steps of 3D point cloud data from the beginning of the project until it was done with editing.

Fig. 5
figure 5

Data processing steps using ScanMaster software

3 Methodology

The proposed approach for training and evaluating the 3D PC filtering by using the ML algorithm is presented in Fig. 6. The process of generating training and reference PCs is shown in Sect. 3.1, and the specifications of the proposed 3D classified and filtered PC are presented in Sect. 3.2. Schemes of the mosque, land, and tree PCs are shown in Sect. 3.3.

Fig. 6
figure 6

The framework for filtering of 3D PC obtained by TLS based on ML algorithm

3.1 Generating training and reference PCs

The proportion of data allocated to each class may vary based on the specific objectives of the study or the distribution of classes in the dataset. the specific criteria for inclusion and the proportion of data allocated to each set are as follows:

  1. i.

    Mosque: Points that exhibit characteristics such as specific geometric shapes, architectural features, or patterns associated with mosques.

  2. ii.

    Land: Points representing flat or uneven terrain, excluding points that correspond to buildings, vegetation, or other specific classes.

  3. iii.

    Tree: Points showing vegetation patterns, high verticality, or characteristics typical of trees, such as point density or color variations.

To classify the total PC into alternative classes, the first step is to stratify pixels as either mosque, land, or trees. In this regard, a group of points has been selected from the total PC Fig. 2 for the mosque, land, and trees pixels (No. of points = 972) to input as training data in the MATLAB file, as shown in Table 2:

Table 2 Training data statistics

3.2 Maximum likelihood classifier

The ML classifier makes the conservative assumption that pixel values within a particular cover class tend to cluster around the cover class's mean. Most mosque pixels are predicted to have a value of 8.7982, most land pixels are predicted to have a value of − 1.3144, and most tree pixels are predicted to have a value of 0.5201 by the ML classifier. As stated in Eq. 1, probability estimates may be calculated for each pixel value using the standard deviation (SD) as an indication of variability. Example results for a set of PCs representing the land, mosque, and tree classes using Eq. 1 may be seen in Table 3 [34].

$${\text{ML}}\;{\text{classifier}} = \left[ {1/\left( {{\text{SD}}_{{\text{Z}}} *{\text{sqrt}}\left( {2*{\text{pi}}} \right)} \right)} \right]*\exp \left[ {\left( { - \left( {{\text{Z}}({\text{i}}) - {\text{mean}}_{{\text{Z}}} } \right)^{2} } \right)/\left( {2*{\text{SD}}_{{\text{Z}}}^{2} } \right)} \right]$$
(1)

where Zi is the length of training PCs coordinates for land, mosque, and trees, std and mean is the standard division and the average of the training data.

Table 3 Likelihood values for a given coordinates being from a mosque or land or tree classes

The Z-coordinate represents the vertical dimension or height information of points in a 3D point cloud. In many scenarios, such as environmental mapping, building analysis, or terrain modeling, the vertical component carries significant information about the objects or features of interest. By relying on the Z-coordinate, it becomes possible to classify and filter points based on their vertical position relative to a reference plane or height threshold. In 3D point clouds, noise often manifests as random fluctuations in the point positions. By focusing on the Z-coordinate, which represents the vertical axis, it is easier to distinguish outliers or noise points that deviate significantly from the expected height distribution. This allows for effective noise separation and removal during the filtering process.

Limiting the classification to the Z-coordinate simplifies the filtering algorithm and reduces computational complexity. Instead of considering multiple dimensions or features, focusing on a single coordinate streamlines the process and allows for efficient implementation.

The obtained likelihood values for land and tree classes have been plotted as a bell-shaped curve, as shown in Fig. 7, with the total area under each class curve summing to 1.

Fig. 7
figure 7

The obtained likelihood values for a trees, b mosque, and c land are plotted as a bell-shaped curve

3.3 Implementation using MATLAB software

The noise identification process aims to identify and distinguish noise points from the actual data points. It involves analyzing the characteristics of the point cloud, such as density, spatial distribution, or geometric properties, to differentiate noise points from the desired data points. The position information of the points in the training point cloud and the filtered point cloud is linked, and a nonlinear model is derived using MATLAB. This step involves processing and analyzing the point cloud data to create a model that represents the desired features and finer details while filtering out the noise.

To estimate the likelihood of buildings, land, and trees, an ML classifier has been implemented in MATLAB as shown in Fig. 8, a collection of data points characterizing the object may be used to calculate the optimal function of three independent variables (SD, mean, and Z coordinate). Similarity measures between a point and its training hood are then used to filter the points, significantly impacting the filtering method's effectiveness. Details of the ML filtering and classification algorithm are mentioned as follows:

Fig. 8
figure 8

Data filtering and classification steps using MATLAB software

Algorithm
figure a

Maximum likelihood algorithm

Figure 9 shows the total 3D PCs (1,194,487) after denoising the out-layer PCs using ScanMaster software. Figure 10 presents the filtered and classified PC for (a) mosque, (b) trees, and (c) land using ScanMaster software. Figure 11 presents the filtered and classified PC for (a) mosque, (b) trees, and (c) land using the ML algorithm by CloudCompare software.

Fig. 9
figure 9

Total 3D PC (1,194,487) using ScanMaster software

Fig. 10
figure 10

Filtered and classified point clouds for a mosque, b trees, and c land

Fig. 11
figure 11

Filtered and classified PCs for a mosque, b trees, and d land using ML algorithm by CloudCompare software

4 Results and discussions

After a detailed analysis of the 3D PC filtering and classification algorithm, experiments have been conducted aiming at comparing and evaluating the performance of the proposed approach and other PC filtering methods. The proposed ML approach has been coded and programmed using MATLAB R2014a; experiments are performed on a PC with Intel (R) Core (TM) i7-7600U CPU @ 2.90 GHz and 16 GB of RAM. To evaluate the classification performance of the proposed filtering and classification technique, standard metrics were employed, including True Positives (TP), False Positives (FP), False Negatives (FN), and True Negatives (TN). TP represents the correctly classified points belonging to the target class, while FP indicates the points wrongly classified as the target class. FN represents the points of the target class that were mistakenly classified as another class, and TN represents the correctly classified points belonging to other classes. These metrics were calculated based on a ground truth dataset and the resulting classified point cloud. By comparing the classification results with the ground truth, the following metrics were obtained:

Accuracy (ACC): The overall accuracy of the classification, calculated as (TP + TN)/(TP + TN + FP + FN). Precision: The proportion of correctly classified positive points out of all points classified as positive, calculated as TP/(TP + FP). The obtained results are presented in Table 4.

Table 4 The overall accuracy and class accuracy estimated for the obtained results

The accuracies obtained for filtered and classified point clouds (No. = 1,194,487) are shown in Table 4. The overall accuracy = 0.8041 with valid point removal = 201,229 points and class accuracy for building = 0.9704, land = 0.9633, and green area = 0.9344. When taking feature preservation into account, it is clear that the suggested ML technique can provide a more refined output while also properly maintaining the forms of features. As can be shown in Fig. 10, the suggested ML method also works well on a real-world 3D PC. Overall, the suggested ML filtering technique may provide more satisfying results than existing filtering algorithms for PCs with a large number of points. The suggested ML method may be more suited for subsequent processing due to the rather accurate models it generates.

4.1 Methods and measures for comparison

In this paper, four commonly used methods in related literature have been applied for comparison. These methods include (1) Voxel Grid filter (VG), (2) Normal-based Bilateral filter (NBF), (3) Moving Least Square (MLS), and (4) Weighted local projection (WLOP) [23]. VG and NBF are available in the PC library (PCL) [35]. WLOP was implemented in C++, while MLS was programmed by MATLAB software.

Due to the large number of points often found in PC, which has a considerable effect on the performance of filtering methods, an experiment has been carried out to provide a thorough evaluation of the filtering algorithms under consideration in comparison to the suggested one. As well, two error metrics, δ and Dmean, have been used to rate the quality of the denoising results. The ground truth points of the office chair model used in this paper are assigned as the occupation points of the TLS. δ represents the averaged angle over all angles between the ground truth point normals and the resulting point normals. Dmean the average distance from the resulting points to the corresponding ground truth points [16]. These metrics provided quantitative measures to rate the quality of the filtering outcomes. Here's a brief explanation of the two error metrics as shown in Eqs. 2 and 3:

$$\delta = \Sigma \left( {\Delta \theta_{{\text{i}}} } \right)/{\text{N}}$$
(2)
$${\text{D}}_{{{\text{mean}}}} = \Sigma \left( {{\text{d}}_{{\text{i}}} } \right)/{\text{N}}$$
(3)

where θi represents the angle between the ground truth point normal vector ni and the resulting point normal vector ri for each point i in the point cloud and di represents the distance between the resulting point position qi and the corresponding ground truth point position pi. Where N represents the total number of points in the point cloud and Δθi represents the absolute difference in angles for each point.

4.2 Comparison with the selected methods

For a comprehensive comparison with the selected methods, a noisy point cloud of an office chair (No. of points = 29,148) as shown in Fig. 12 is cited from the PC library (PCL) [35]. The PC has been filtered using the ML technique as shown in section 3.2. to compare with the other methods that have been identified for determining efficiency.

Fig. 12
figure 12

a noisy office chair model; b Filtering results with NBF; c MLS; and d filtering result with the proposed ML algorithm

Due to the linear filtering mechanism, a guided point cloud filter has the benefit of reducing time spent. Table 5 shows an overview of operational timings for the proposed ML method compared to other different methods as applied using the office chair point cloud. It is claimed that the suggested guided point cloud filter accomplishes effective outcomes. As can be observed from the error metrics in Table 6, the proposed approach has achieved better filtering performance on point cloud models as compared to other methods.

Table 5 The processing time obtained for the proposed approach compared to other filtering approaches implemented on the office chair model in sec
Table 6 Error metrics obtained for the proposed approach compared to other filtering approaches

5 Conclusion

PCs are plagued with a wide variety of noise forms and amplitudes that are beyond human control. This occurs as a result of the inherent fallibility of both the technology and the situations in which data is captured. To improve PC performance, noise must be filtered out using strategies like the spatial filtering approaches discussed in this study and others like them. In a setting where physical constraints make it difficult to eliminate noise, producing measures based on repeated observations or filtering the existing measurements is the most effective strategy for ensuring the integrity of the data being collected. Tested models of PCs in this paper were collected using TLS and photogrammetric methods. An effective and efficient filtering method has been proposed based on the well-known ML algorithm. Considering the location of a place of interest as essential data, this method can be seen as an expansion of guided PC filtering. In the suggested method, the training data is used to derive a nonlinear model between the filtered output points and the related PCs for guiding. The suggested method not only accomplishes feature-preserving filtering but also shows high efficiency and accuracy in its application, as shown by experimental results evaluated on various point clouds. Additionally, it is conceptually simple and easy to implement on a real-world 3D PC. In future work, the proposed approach will be further investigated, taking into account geometrical characteristics such as normal and curvature to increase the performance of the filtering scheme.