2.4.1. Preliminary Segmentation Using 3D Region Growing
The 3D RG typically starts from one or more points (seed points) featuring specific characteristics and then gathers the nearest neighbors in the seed area on the basis of certain constraints such as similar surface orientations or curvatures [
26]. Constraints of surface normal vectors and curvatures were widely used to find the smoothly connected areas that would be clustered as specific regions [
23,
25,
41,
42]. The detailed process of the 3D RG algorithm adopted in this work is described in [
23,
25]. Vo et al. [
27] found that the method requires a considerable amount of time for parameter tuning, especially for curved surface or sphere segmentation.
The influence factors in the standard 3D RG algorithm include the neighborhood size for normal vector and curvature estimation, the threshold of angle difference (TAD) between normal vectors of each nearest neighbor point and current seed point, the threshold of local curvature (TLC) for each point, the neighborhood size for RG searching, and the threshold of point number as a clustered region, etc. There are two ways to define the size of neighborhood: the point number of k-nearest neighbors or the radius of the nearest neighbor (RNN). Herein, RNN is adopted to calculate the normal vector, local curvature and growing neighborhood, which enables an optimal neighborhood under different point densities.
In this contribution, principal component analysis (PCA) is applied to estimate the normal vector and curvature of each point (cf. [
43,
44]). In consideration of the computational complexity and the insensitivity to the noise, the ratio between the smallest eigenvalue and the sum of eigenvalues (derived from the covariance matrix of the neighboring point set for the query point) is used to approximate the surface variation, and to indicate the local curvature around the query point indirectly [
43].
To verify the feasibility of 3D RG algorithm for multiple sphere segmentation and to investigate the optimal selection of critical parameters, a setup of eight plastic spheres with a radius of 74 mm was used to simulate the layout of hollow spheres.
Figure 5 shows the placement of spheres and the point cloud of this setup. Part of the background was retained to show the process of the sphere being detected from a complex scenario.
The calculations of normal vector and curvature for each point are the basis of the RG-based segmentation, while the size of the corresponding neighborhood will influence the PCA-based normal estimation directly.
Figure 6 shows part of the segmentation results under different normal and curvature calculations, where RNN was set to different sizes (from 10 mm to 50 mm) while other parameters are fixed with empirical values. The segmented clusters are labeled with random colors, and the red parts are not considered as a cluster because of too few points (less than the minimum point number as a region). The bad or wrong segmentations are marked by black dotted rectangles according to the visual comparison with the ground truth.
Figure 6 shows that smaller neighborhood selection caused over-segmentation (see
Figure 6a) while a large RNN setting led to under-segmentation (see
Figure 6c). For this multiple-sphere test, the optimal RNN is empirically from 20 mm to 30 mm according to the segmentation effects within the investigated range of RNN.
In addition to the neighborhood size in normal and curvature calculations, TAD and TLC also influence the effect of 3D RG-based segmentation.
Figure 7 and
Figure 8 show part of segmentation results under different settings of TAD (from 2.00° to 4.00°) and TLC (from 0.01 to 20.0).
Figure 7 indicates that the segmentation result was sensitive to the change of TAD. Similar to the results under different RNN, a small TAD setting caused over-segmentation on the spheres (see
Figure 7a), while a large TAD setting led to under-segmentation to a certain extent (see
Figure 7c). If only concerning whether the spherical points can be segmented independently and completely, the range from 2.75° to 3.75° of TAD is suggested for the sphere with the given radius.
Compared to TAD, TLC has not such a significant influence on the segmentation effects (see
Figure 8). For a TLC between 0.05 and 10, all obvious geometric primitives could be segmented and clustered almost perfectly. There was a slight under-segmentation when TLC reached 20 (see
Figure 8c). This is because TLC only determines the generation of seed points rather than region points, while the clustering of region points depends on TAD merely. However, too small TLC may hinder the generation of seed points and stop the process of region growing in the large-curvature regions, like edges and spheres. These regions would be independently clustered from the point cloud and were labeled as red due to less points to be treated as a cluster (see
Figure 8a), which caused discontinuity on the spherical surfaces. Therefore, TLC from 0.05 to 10 is suggested for this scanning test. As for the point number of the searching neighborhood for 3D RG, an empirical value from 10 to 30 is chosen taking into account the point density, since the result of RG is also not sensitive to this parameter.
2.4.2. Screening Conditions for Spherical Clusters
Spherical clusters are supposed to be extracted from the preliminary segmentation results completely and quickly. In this contribution, two simple screening conditions based on the spatial ranges and the medians of sorted curvatures of segmented clusters are proposed to extract the spherical clusters from RG-based segmentation. The extraction steps can be summarized as follows:
The spatial ranges in the direction of three axes of each cluster whose number of points is greater than a threshold will be calculated.
The curvature of each cluster within the threshold of spatial ranges (TSR) will be calculated and sorted.
The cluster of which the median of sorted curvatures is within a specific threshold (TCM) will be regarded as a sphere and extracted into the dataset storing spherical points.
The determination of TSR ought to refer to the radius of the sphere and the proportion of visible part. When scanning with a single station, normally less than 50% of the surface of a sphere is exposed, and it may be even less under the occlusion of other spheres. Considering the radius of these spheres is 74 mm in this multiple-sphere scanning test, the range of TSR is set from 0.05 m to 0.16 m in the direction of X and Y axes and from 0.02 m to 0.16 m in the direction of Z-axis empirically.
The curvature estimations of spherical clusters may be not consistent because of the errors at some edge points.
Figure 9 shows the curvature distributions of two extracted spherical clusters in the scanning test (results of other spheres are offered in
Figure A1 in
Appendix A). The mean and median of point curvatures are also displayed. The average curvatures of these spherical clusters are between 0.014 to 0.017, while the median is slightly higher than the mean of curvatures. To weaken the influence of outlier curvatures at some edge points and make a more stable threshold setting, the median of sorted curvatures of a cluster is adopted as the second screening condition for the extraction of spherical clusters. According to
Figure 9, the range of TCM was set from 0.014 to 0.018 in this scanning test.
The extracted spherical clusters from the RG-based segmentation result by the two screening conditions are shown in
Figure 10. These eight spheres were extracted from the segmented point cloud respectively and completely. However, these spherical clusters may still contain some outliers or noise which could be further eliminated by RANSAC-based segmentation (see
Section 2.5.2). Then the center coordinates and radii of spheres are estimated by LS fitting (see
Section 2.5.3) after obtaining the finely segmented spherical points. In addition, for an unorganized point cloud, the extracted clusters will be sorted by their number of points in RG-based segmentation, resulting in that the actual sequences are disordered in the horizontal direction. It is thus crucial to reorder these spherical clusters according to their center positions and number these spheres in accordance with the
X-axis or
Y-axis direction.