# A Termination Criterion for Probabilistic Point Clouds Registration
## 3 Materials and Methods
### Termination Criteria  
When the source and the target point clouds are very close, a single iteration of the proposed probabilistic point clouds registration algorithm may be enough. However, a typical real scenario requires more than a single iteration. To obtain a good solution, most of the correspondences used to form the optimization problem need to be right. Since we use an ICP-like data association policy based on nearest neighbours, this happens only if the two point clouds are close enough. In our algorithm, two parameters control which and how many points in the target point cloud are associated to a particular point in the source point cloud--the maximum distance between neighbours and the maximum number of neighbours. Setting these parameters to very high values could help the algorithm to converge to a good solution even when the starting poses of the two point clouds are not really close. However, this solution allows more outliers, that is, wrong data associations, to get into the optimization step. Even tough the probabilistic approach has the capability to soft-filtering out outliers, thanks to the probabilistic weighting technique, using too many points will lead to a huge optimization problem which would be very slow to solve. Usually, a much more practical and fast solution is to use lower values for the maximum distance and the maximum number of neighbors, while using multiple iterations of the probabilistic approach, which implies re-estimating the data associations, in the same way it is done, for example, in ICP and G-ICP. Using this technique, our approach becomes composed of two nested loops. The outer one moves the source point cloud with the current result, estimates the point correspondences, sets up the optimization problem, and activates the solver. This process is repeated until a convergence criterion is met. The inner loop, instead, is composed of the iterations of the Levenberg-Marquard algorithm, which is used to solve the optimization problem. The multi iteration version of our algorithm provides good results, compared to other state-of-the-art algorithms [4]. Of course, in order to be of practical usefulness, such an algorithm would greatly benefit from some kind of automatic termination criterion. It would mean that the algorithm could decide by itself when it should stop, without adaptation of parameters to the specifics of each problem. The most simple termination criterion is to use a fixed predefined number of iterations. This is the technique we used in our previous work. However, this solution is far from being optimal, since the number of iterations would become a parameter of the algorithm. Most importantly, there would be no automatic way of estimating this parameter _a-priori_, so this solution is unpractical and has to be discarded. Lastly, using a fixed value for this parameter would probably mean using too many iterations in some cases and using too few in others. On the other hand, using a very large value would greatly increase the execution time, in many cases without improving the quality of the result. For these reasons, we evaluated different automatic termination criteria, to find which one works best with PPCR. Our first choice was to evaluate the Mean Squared Error (MSE) with respect to the previous iteration: we take the source point cloud and apply, separately, the rototranslations estimated during the current iteration of the algorithm and during the previous one. Therefore, we have the same point cloud in two different poses. Since applying a rototranslation, that is, a matrix multiplication, maintains the order of the points, we know that point \(x_{i}^{t}\) in \(X^{t}\) (the source point cloud aligned with the current estimate) corresponds to point \(x_{i}^{t-1}\) in \(X^{t-1}\) (the source point cloud aligned with the previous estimate). Hence, the point correspondences are known and exact. We used Equation (5), where \(N\) is the size of the point cloud, to calculate the Mean Squared Error (MSE) between two iterations.