Optimized GICP registration algorithm based on principal component analysis for point cloud edge extraction

For iterative closest point (ICP) algorithm, the initial position and the number of iterations are needed in registration. At the same time, the ICP algorithm is easy to fall into local convergence and convergence speed is slow. By constructing K-D tree to search neighborhood points and artificially set threshold, plane fitting is carried out, the on-time point cloud to be deployed is separated from the complex background, and statistical analysis is used to calculate the distance between the point cloud and the neighborhood point to quickly remove the invalid point cloud. The surface equation is set to calculate the tangent plane of point cloud normal vector and each normal vector, and the local coordinate system is constructed. The angle between adjacent vectors and the local coordinate system is calculated to determine the feature point set of edge contour. According to the covariance matrix of the feature points set, the principal feature component is obtained, the principal axis direction of the two sets of point clouds is found, and the rotation matrix and the displacement vector are obtained. Finally, GICP precise registration of point cloud is carried out according to initial pose parameters and rigid body transformation matrix obtained by maximum likelihood estimation method. The results show that the optimized algorithm can effectively avoid local convergence. Compared with the traditional ICP algorithm, when the algorithm achieves the same registration accuracy in the public dataset experiment, the registration speed is on average 44.82% faster and the overlap rate is on average 15.26% higher. In the real dataset experiment, the registration speed is on average 59.04% faster, the registration accuracy is on average 30.24% higher and the overlap rate is on average 10.61% higher. This shows that the optimization algorithm is superior to the traditional ICP algorithm in registration accuracy and convergence speed.


Motivation
As the application field of three-dimensional point cloud 1 becomes more and more extensive, the processing technology related to it has also become a hot research topic, such as point cloud filtering, 2 point cloud segmentation, 3 point cloud feature extraction, 4,5 point cloud registration, [6][7][8] point cloud recognition, 9,10 surface reconstruction, 11 etc.Point cloud registration is one of the key technologies for three-dimensional measurement of large forgings. 12Due to the high requirement on the forging process and precision of large forgings the accuracy and speed of point cloud registration is particularly important for the quality control of large forgings.
So far, the most widely used registration algorithms are based on point set to point set and geometric features. 13The ICP proposed by Besl and McKay. 14elongs to the classical registration algorithm of point-set to point-set.However, this algorithm is prone to local convergence due to its heavy computation and low efficiency in the process of searching corresponding points and its dependence on initial pose. 15Over the years, researchers have worked to solve the shortcomings of ICP algorithms and improve them.The registration speed of ICP algorithm is improved by simplifying the number of matching points, improving the search speed of neighborhood points and reducing the number of iterations. 16The common methods are downsampling, 17 random sampling, 18 and feature-based sampling. 19,20ompared with the methods used in the above paper, the voxel grid downsampling algorithm 21 is popular because of its high efficiency, uniform distribution of sampling points, and indirect control of the distance of sampling points by controlling the size of voxels.To optimize the registration accuracy of the algorithm, the method of solving the rigid body transformation matrix, and eliminating the wrong matching point pairs is studied.The methods of Weighted Least Squares (WLS), 22 Total Least Squares (TLS), 23 and Iterative Reweighted Least are proposed Squares (IRLS), 24 etc.Compared with the above algorithms, Least Squares (LS) 25 is widely used because of its simple calculation and high efficiency, while the planar fitting algorithm based on Random Sample Consensus (RANSAC) 26 can not only eliminate complex backgrounds, but also eliminate complex backgrounds.It can also maintain the geometric relationship corresponding to the point cloud and remove the anomaly.To solve the problem of ICP falling into local optimal solution, the most effective method is to divide the registration process into two stages: rough registration and fine registration.The feature-based registration method is used to extract points, 27 lines, 28 and surfaces 29 for rough registration, providing good initial pose for subsequent ICP fine registration.This method effectively avoids the algorithm falling into local convergence.Among them, the feature-based registration algorithm has the widest application field.Common key point extraction is based on curvature change, 30 covariance matrix, 31 Gaussian difference, and scale space. 32Such as Intrinsic Shape Signatur (ISS), 33 Normal Aligned Radial Feature (NARF), 34 Scale-invariant feature transform (SIFT), 35,36 3D Harris, 37 and other algorithms.However, the feature point algorithm with single information has some problems, such as low robustness, easy to be affected by noise, and large time complexity.Therefore, how to add more effective information to feature points to improve the accuracy of matching point pairs is of great significance.

Related work
In recent years, researchers have proposed many optimization algorithms for the speed and accuracy of point cloud registration, such as the point-to-point affine transformation registration algorithm proposed by Makovetskii et al., 38 which reduces the computation and iteration times and can quickly converge to a given threshold.Meng et al. 39 adopted the K-D tree data structure to speed up the search of neighborhood points.The robustness of these methods is poor, and the search efficiency decreases in the case of large data volume.Generalized Iterative Closest Point (GICP) algorithm proposed by Segal et al. 40 introduces probabilistic information and effectively eliminates incorrect correspondence through covariance matrix to improve registration accuracy.Zhan et al. 41 adopted the Random Sample Consensus (RANSAC) algorithm to search for the correct corresponding points and remove the abnormal point cloud, which appropriately improved the registration accuracy.However, in the case of noise and outliers, the registration effect would be affected.Yao et al. 42 proposed a method to complete point cloud registration by extracting feature points through principal curvature, and the registration accuracy was higher when the features at the sharp corners of the point cloud were obvious.Manish et al. 43 proposed to use SURF (speeded up robust features) algorithm to extract image feature points and obtain initial matching point pairs of point clouds by matching pixel pairs.This algorithm relies too much on the gradient direction of pixels in a local region, which is prone to large errors in feature matching.Due to the problem that the above algorithms may not be able to fully describe feature information, researchers proposed the concept of descriptors, such as Signature of Histogram of Orien Tations (SHOT), 44 Descriptors such as 3D Shape Context (3DSC), 45 and Fast Point Feature Histogram (FPFH). 46It is worth mentioning that point cloud fine registration according to the initial pose provided by rough registration has become the mainstream.For example, Yin et al. 32 extracted feature points through SIFT algorithm for rough registration, and then combined with K-D tree for ICP algorithm for fine registration.Yang et al. 47 proposed a local feature statistics histogram (LFSH) and introduced Optimized sample consistency (OSAC) to estimate the optimal transformation matrix, which realized the coarse to fine registration algorithm.However, the above method still has some problems, such as slow registration speed and incomplete description of characteristic information, resulting in low registration accuracy.

Contribution
Based on the above Analysis, this paper proposes a point cloud edge extraction based Principal Component Analysis (PCA) 48 to optimize GICP registration algorithm, which solves the problem of traditional ICP algorithm falling into local convergence and improves the accuracy, speed and robustness of point cloud registration.The main contributions are as follows.
(1) Although feature points are described in Yin et al., 32 and Yang et al., 47 there is still a problem that noise points lead to incomplete feature description information.In addition, Makovetskii et al., 38 Meng et al., 39 and Zhan et al. 41 are only optimized in terms of speed or accuracy, and the two are not combined.Therefore, the optimization algorithm in this paper segmentation interference background by plane fitting before registration.Statistical analysis is used to remove noise point, 49 voxel grid downsampling is used, and K-D tree is used to search the nearest point to improve the registration speed, and accuracy of the improved algorithm.

Method
The flowchart of the scheme for optimizing the GICP registration algorithm based on principal component analysis of point cloud edge feature extraction is shown in Figure 1.In this paper, we calculate the corresponding normal vectors and the tangent planes of each normal vector by setting the surface equation to the point cloud, project the point set onto the tangent plane, and construct a local coordinate system based on the projection of one of the points.Then the angle between the projected point set and the vector of the original point cloud and the local coordinate system is calculated, and when the angle is greater than a given threshold, it is an edge point.The PCA algorithm coarse registration is performed on the edge contour point set, and the principal eigen components and principal axis directions are obtained by calculating the covariance matrix of the two point sets, and the principal axis directions of the highly symmetric point cloud are corrected to avoid reverse registration, and then the point cloud rotation matrix and translation vector are derived to complete the coarse registration of the point cloud.The point cloud distribution is established on the Gaussian model, so that the distance between the point clouds presents a Gaussian distribution, the registration error function is obtained by calculating the covariance matrix of the edge contour point set, and the rigid body transformation matrix and the corresponding Gaussian probability are calculated by the maximum likelihood estimation method.The transformation matrix corresponding to the maximum Gaussian probability is the optimal coordinate transformation, and the fine registration is completed by the optimal transformation matrix.
The FPFH descriptor algorithm in Wu et al. 46 and the PCA algorithm in Sanchez et al. 48PCA are both popular algorithms for point cloud registration in recent years.FPFH algorithm is a feature descriptor based on the normal angle between points and their neighbors and the angle relationship between lines between points.Its essence is to find K neighborhood points of points and calculate normal vectors, construct local coordinate system, and obtain Simple Point Feature Histograms (SPFH).The overall complexity of the algorithm is low, and it is more common in practical applications.PCA algorithm can reduce the dimensionality of the sample, reduce the high-dimensional vector mapping to the low-dimensional space, and ensure that the information loss between dimensions is as small as possible, which not only alleviates the complexity of the calculation, but also has the effect of noise reduction.It is one of the algorithms widely used in point cloud coarse collocation time.
To verify the performance of this method, the public data set and the real data set of simulated forgings are tested and demonstrated, and the registration algorithms mentioned in references 14,46,48 are compared with the improved algorithm in this paper in terms of recognition accuracy, registration speed and iteration times.

Point cloud data preprocessing
Since the external environment, noise interference and point cloud density affect the speed and accuracy of the algorithm, this paper preprocesses the point cloud before registration to improve the speed and efficiency of the improved algorithm.Background removal can be achieved by point cloud plane fitting technology.And RANSAC algorithm is adopted to segment the workpiece from the background point cloud.The specific steps are as follows: (1) Three points are randomly selected from the workpiece point cloud, denoted as P 0 x 0 , y 0 , And substitute points P 0 , P 1 , and P 2 into the equation of the plane, it means that (3) The distance from point P i to the plane (4) The threshold t is set to divide the point cloud into inner points and outer points, and the condition of the inner point is d i \ t. (5) Repeat the above steps N times until the maximum number of point clouds within the search threshold, that is, the plane fitting is complete Where P is the probability of getting at least one inner point, e is the probability that the point is outside, s is the number of point clouds needed to solve the model.Efficient and convenient statistical analysis method can be used in noise point processing to quickly remove invalid point cloud from point set.The mean m and standard deviation s were calculated according to the point cloud distribution.Then all the points in the neighborhood point set and the points outside the interval where the distance between the points and their neighborhood was greater than m + mul3s could be regarded as noise points, where mul is the multiple threshold of standard deviation.
In point cloud descending sampling processing, octree is used to establish voxel and replace all points in voxel with the mean of internal points.By setting the size of voxel, the size of voxel grid is changed, so that the descending sampling can be achieved without destroying the geometric structure of point cloud.
Remark 1: Similar methods of downsampling and removal of outliers are proposed in literature. 17,41This paper fully considers the actual situation, and presents the methods of establishing voxel grid downsampling based on octree, and removing complex background based on RANSAC fitting plane.Considering the number of noise points and outliers, we choose to quickly remove the disturbance point cloud by calculating the mean and standard deviation of the point spacing.Although RANSAC algorithm is also used in Zhan et al. 41 to remove abnormal points, there are still unavoidable missing noise points, which not only affect the effect of point cloud registration, but also bring serious errors to the subsequent three-dimensional measurement of industrial forgings.

Point cloud edge contour feature extraction
By extracting the edge features of the point cloud, the contour points are regarded as feature points.The adjacent points around the edge feature points of the point cloud are almost on the same side.The extraction steps of point cloud edge feature are as follows: (1) Set search radius R, the neighborhood points within the search radius of any point A i and B i in point cloud A and B are denoted as point set (2) Set surface equation (3) Calculate the distance from M A i ð Þ and N B i ð Þ to equation ( 4) (4) The normal vector m and n corresponding to min P n j = 1 d 2 i 1 and min P n j = 1 d 2 i 2 can be obtained by equations ( 4) and ( 5). ( 5) According to the tangent plane h and g of the corresponding points of the normal vector m and n in the (4), the points in M A i ð Þ and N B i ð Þ are projected onto h and g, and the point A j 0 and B j 0 are selected in the projection point set, with A i A 0 j j j as the u 1 axis, m as the v 1 axis, u 1 3v 1 as the v 1 axis, as the u 2 axis, n as the v 2 axis, u 2 3v 2 as the v 2 axis.(6) The vectors of points A n 0 and A i , B n 0 , and B i in the projection point set are calculated respectively, and the included angles with the axes u 1 and u 2 are calculated The diagram is presented in Figure 2. (7) The difference between the adjacent angles 8) The maximum included angle u 0 A max and u 0 B max of adjacent angles of two point sets are found respectively.If they are larger than the given threshold, they are considered as edge points.

PCA rough registration process
Set the two groups of point sets for edge extraction as X = X f g m i = 1 and Y = Y f g n i = 1 , and the specific steps based on PCA registration algorithm are as follows: (1) The two sets of point cloud coordinates are barycentric (2) Calculate the covariance matrix Cov According to equations ( 8) and ( 9) where x m , y m , z m ð Þ is the coordinate of point cloud, X x , X y , X z À Á is the central coordinate of point cloud, and C Y can be obtained.
(3) The covariance matrix C X and C Y are decomposed by SVD singular values, and corresponding eigenvectors are obtained where Z X and Z Y are orthogonal matrices composed of three identity column vectors, which are the main directions of X and Y point clouds.
(4) Calculate the initial rotation matrix R 0 and the translation vector

GICP registration algorithm based on PCA fusion
It is assumed that the point cloud determines the correspondence relationship through the nearest neighbor domain search, namely, A = a i f g i = 1, :::, N and B = b i f g i = 1, :::, N , and a i and b i correspond to each other.A and B point sets are generated according to the Gaussian model and s B i È É are covariance matrices.Theoretically, there exists a correct transformation matrix T Ã that makes point cloud A and B match each other, namely bi = T Ã âi .For an arbitrary rigid body transformation matrix, define the registration error , where a i and b i are obtained from the independent Gaussian model.Substitute the definition to calculate the registration error under the standard transformation matrix T Ã : After rough registration based on PCA, rotation matrix R 0 = Z X Z À1 Y and translation vector T 0 = X À R 0 Ã Y calculated by spindle orientation parameters are used as initial pose parameters of the improved GICP registration algorithm: At this time, the registration error The rigid body transformation matrix T is calculated by maximum likelihood estimation method, and the maximum probability of T occurrence is calculated Take the logarithm of formula ( 17) and simplify Remark 2: In the precision matching time, this paper does not directly use ICP algorithm, but the generalized algorithm of ICP algorithm GICP, by using covariance matrix to play a similar role of weight, weaken the influence of irrelevant point cloud, improve the accuracy of registration.In the scope of application, the applicability of GICP algorithm is stronger than ICP algorithm, that is, GICP can be degraded into standard ICP algorithm under certain conditions.

Evaluation index
To verify the registration effect of the optimization algorithm, the mean MSE of the sum of squares between corresponding points was used as the evaluation index of point cloud registration accuracy for the iterative error analysis.The smaller the MSE value, the higher the registration accuracy.That is: where N is the number of point clouds, p i is the coordinates of reference points, and q i is the coordinates of point clouds to be updated by the timing points.
To further verify the registration accuracy of the improved algorithm, this paper analyzes the overlap degree of the two groups of point clouds after registration, and introduces the centroid deviation of the two groups of point clouds after registration as the index to evaluate the registration accuracy of point clouds, namely: Overlap rate P o : where N c is the matching logarithm of the origin cloud and the target point cloud.Only the nearest neighbor points of each other can form a matching pair.Centroid deviation P c : where x Fi , y Fi , z Fi ð Þis the coordinate of point cloud after registration, and x Ti , y Ti , z Ti ð Þis the coordinate of target point cloud.Under the same experimental conditions, the registration results of FPFH algorithm are shown in Figures 4(c), 5(c), and 6(c).The accuracy index MSE is 0.32, 0.20, and 6.44e-03, and the overlap rate is 87.72%, 20.07%, and 33.08%, respectively.Although the FPFH algorithm meets the registration accuracy requirements, it improves the computational efficiency by not calculating the triples between neighboring points in the neighborhood, which inevitably reduces the complete description of the local neighborhood.To make up for this defect, FPFH expands the consideration range when performing statistical analysis, that is, the neighboring points of neighboring points are also taken into account, so the accuracy of the corresponding matching point pair is reduced.The overlap rate will go down.Similarly, the registration results of PCA algorithm are shown in Figures 4(d), 5(d), and 6(d).The accuracy index MSE is 1.28e-04, 3.01e-05, and 1.33e-03, respectively, and the overlap rate is 100%, 15.04%, and 38.00%, respectively.The registration overlap rate of the algorithm is also affected by the low precision of the corresponding points.

Public dataset registration experiment
The improved algorithm in this paper is superior to the above registration algorithms in terms of registration time and accuracy.Figures 4(e), 5(e), and 6(e) show the registration effect under the extraction of point cloud edge contour features, and Figures 4(f), 5(f), and 6(f) show the complete registration effect of optimized GICP algorithm based on edge contour features.The accuracy index MSE is 7.08e-12, 8.16e-13, and 1.98e-08 respectively, and the overlap rate is 100%, 99.92%, and 91.12% respectively.The specific experimental data are shown in Table 1 (in the table, Time represents the shortest time required to complete registration with the least number of iterations.Iteration times represents the minimum number of iterations to complete registration, Overlap rate represents the overlap rate of the two sets of point clouds after full registration, Offset represents the centroid offset of the two sets of point clouds after full registration.)

Workpiece data set registration experiment
In the experiment, binocular camera system was used to collect 10 sets of point cloud data of forging workpiece, and 4 sets of data were taken as examples.Since the obtained point cloud background noise is large and difficult to register, on the premise of retaining the complete characteristics, the RANSAC algorithm is applied to the point cloud data to remove the interference background, and other noise points, and outliers are removed through statistical analysis.The efficiency of the algorithm is improved by using Octree based voxel grid downsampling and K-D tree fast searching for the nearest point.2, the accuracy index MSE of the algorithm is 6.50e-10, 7.73e-06, 5.03e-06, and 2.28, respectively, and the point cloud overlap rate is 100%, 100%, 100%, and 80.43%, respectively.In addition, the traditional ICP algorithm needs 127 iterations, 105 iterations, 54 iterations, and 122 iterations respectively to complete the registration, while the algorithm only needs 4 iterations, 17 iterations, 5 iterations, and 3 iterations to complete the registration.After registration, the centroid offset of the two groups of point clouds is lower than that of the traditional ICP algorithm, FPFH descriptor algorithm, and PCA algorithm.It effectively shows that the overall registration degree of the optimization algorithm is high.
Figure 12 shows the bar chart of the time required by the traditional ICP algorithm, FPFH-based descriptor subalgorithm, PCA algorithm and the improved algorithm for the registration of work pieces A, B, C, and D. In the figure, the time required by the improved algorithm is significantly faster than that of the traditional ICP algorithm and FPFH algorithm, greatly improving the registration speed of point cloud, while the time required by PCA algorithm for work pieces B and C is slightly shorter.However, it can be seen from Figure 11 and Table 2 that the registration accuracy is lower than that of the improved GICP algorithm.After registration, the accuracy index MSE, point cloud overlap rate, point cloud centroid deviation, the improved algorithm is superior to the traditional ICP algorithm, FPFH-based descriptor algorithm, and PCA algorithm.
Through experiments and data analysis, the improved algorithm is 59.04% faster than the traditional ICP algorithm and 93.48% faster than the FPFH descriptor algorithm.The registration accuracy is 30.24%higher than that of the traditional ICP algorithm and 85.35% higher than that of the FPFH descriptor algorithm, which not only improves the registration speed and accuracy, but also avoids the local convergence of the algorithm.

Conclusion
Point cloud registration technology is very important in the three-dimensional measurement of large forgings, and it is one of the important links to judge whether the size of forgings meets the industrial requirements.The traditional ICP registration algorithm has problems such as slow speed, low precision and easy to fall into local convergence, which cannot meet the requirements of forgings measurement.Therefore, this paper proposes an optimized GICP fine registration algorithm based on point cloud edge extraction by principal component analysis.
Our method removes the disturbing background by plane fitting to the matching point cloud, and refines the other noise and outliers.Because the voxel grid downsampling method has high efficiency, uniform distribution of sampling points, and can control the distance of sampling points, we choose to use voxel grid downsampling and K-D tree to quickly search the nearest point to improve the efficiency of the algorithm.The extraction of feature points in this paper is different from the previous single feature algorithm.We carry out multi-information description of feature points, and determine whether the point is an edge feature

Figure 2 .
Figure 2. Angle between vector and coordinate axis.
Binocular structured light system was used in the experiment to acquire point cloud data.The acA1920-150uc array camera of Basler company was used in the system, as shown in Figure 3.The frame rate of the camera reached 150 fps and the resolution reached 2.3 million pixels.It has an ON Semiconductor PYTHON 2000 CMOS chip.This paper takes public data set and real object data set as examples to carry out experimental analysis.All experiments were carried out using Windows10 operating system based on PCL 1.8.1 and Visual Studio 2015 software framework, and completed with C ++ language.

Firstly, the
optimization algorithm in this paper is applied to the public data set, and Stanford 3D rabbit point cloud, automobile point cloud, and aircraft point cloud are selected.The initial relative position relationship between the reference point cloud and the point cloud to be matched is shown in Figures 4(a), 5(a), and 6(a), in which the green point cloud is the source point cloud, the blue point cloud is the target point cloud, and the red point cloud is the post-registration point cloud.The traditional ICP algorithm, FPFH-based descriptor subalgorithm, PCA algorithm, and the improved algorithm in this paper were respectively used to test the above point cloud model.Figures 4 to 6 are the registration effect diagrams of 30 iteration experiments.It can be concluded from the combination of the chart that under the condition of no noise interference and smooth point cloud data, traditional ICP is still prone to fall into the local minimum, leading to registration failure.Through 30 iterations, the traditional ICP registration results of the three types of public point clouds are shown in Figures 4(b), 5(b), and 6(b), in which the on-time point clouds to be installed in Figures 4(b) and 5(b) roughly coincide with each other, and the accuracy index MSE is 0.02 and 0.06, respectively, but the overlap rate is only 76.69% and 69.40%.This is because the traditional ICP algorithm only considers the distance between the point and the point, and does not use the structural information of the point cloud, and when the algorithm is looking for the corresponding point, resulting in a certain number of wrong corresponding points.In Figure 6(b), the registration of aircraft point cloud has local convergence problem.The accuracy index MSE is 8.13 and the overlap rate is only 1.22%, so the registration fails.The point cloud model has the characteristics of sparse distribution of point clouds on both wings and dense distribution of point clouds on fuselage.The point clouds only have good matching point pairs at the fuselage, which greatly affects the registration result and causes mismatching.
Now the traditional ICP algorithm, FPFH-based descriptor algorithm, PCA algorithm and the improved algorithm in this paper are used for experimental analysis of the above collected point cloud data, and the data are also analyzed from the aspects of registration accuracy index MSE, point cloud overlap rate, registration time and the minimum number of iterations required for registration.Figures 7 to 10 are the registration effect diagrams of 50 iterative experiments.It can be concluded from the combination of the charts that Figures 7(b), 8(b), 9(b), and 10(b) show the registration effect of the traditional ICP algorithm.The accuracy index MSE is 0.36, 1.08, 3.18, and 11.36, respectively, and the point cloud overlap rate is

21 .
17%%, 86.64%, 66.90%, and 61.89%, respectively.The registration errors of parts A and B are relatively large, and only parts C and D are successfully registered, indicating that although ICP algorithm performs well in public data sets, in the face of complex workpiece point clouds with a large number of noise points in reality, the registration accuracy of the algorithm is related to the initial pose, point cloud data and shape, and the success rate is somewhat random.Figures7(c), 8(c), 9(c), and 10(c) show the registration effect diagram of FPFH algorithm.The accuracy index MSE is 0.36, 1.61, 1.16, and 3.89, respectively, and the overlap rate of point cloud is 77.81%, 71.79%, 88.17%, and 60.96% respectively, which is higher in accuracy than the traditional ICP algorithm.And the workpiece A, B, C, D are successfully registered, but FPFH algorithm to extract feature points need to calculate a large number of normal, so the speed still can not meet the industrial requirements.Figures 7(d), 9(d), and 10(d) are the

Figure 11 .
Figure 11.Registration accuracy evaluation index: (a) MSE error comparison and (b) comparison of overlap rate of point cloud.

Table 1 .
Public data set experiment results.

Table 2 .
Experimental results of real forged workpiece data set.