# Point set registration

Point set registration is the process of aligning two point sets. Here, the blue fish is being registered to the red fish.

In computer vision and pattern recognition, point set registration, also known as point matching, is the process of finding a spatial transformation that aligns two point sets. The purpose of finding such a transformation includes merging multiple data sets into a globally consistent model, and mapping a new measurement to a known data set to identify features or to estimate its pose. A point set may be raw data from 3D scanning or an array of rangefinders. For use in image processing and feature-based image registration, a point set may be a set of features obtained by feature extraction from an image, for example corner detection. Point set registration is used in optical character recognition,[1][2] augmented reality[3] and aligning data from magnetic resonance imaging with computer aided tomography scans.[4][5]

## Overview of problem

Data from two 3D scans of the same environment need to be aligned using point set registration.
Data from above, registered successfully using a variant of iterative closest point.

The problem may be summarized as follows:[6] Let ${\displaystyle \lbrace {\mathcal {M}},{\mathcal {S}}\rbrace }$ be two finite size point sets in a finite-dimensional real vector space ${\displaystyle \mathbb {R} ^{d}}$, which contain ${\displaystyle M}$ and ${\displaystyle N}$ points respectively. The problem is to find a transformation to be applied to the moving "model" point set ${\displaystyle {\mathcal {M}}}$ such that the difference between ${\displaystyle {\mathcal {M}}}$ and the static "scene" set ${\displaystyle {\mathcal {S}}}$ is minimized. In other words, a mapping from ${\displaystyle \mathbb {R} ^{d}}$ to ${\displaystyle \mathbb {R} ^{d}}$ is desired which yields the best alignment between the transformed "model" set and the "scene" set. The mapping may consist of a rigid or non-rigid transformation. The transformation model may be written as ${\displaystyle T}$ where the transformed, registered model point set is:

${\displaystyle T({\mathcal {M}})}$

(1)

It is useful to define an optimization parameter ${\displaystyle \theta }$:

${\displaystyle T({\mathcal {M}},\theta )}$

(2)

such that it is clear that the optimizing algorithm adjusts ${\displaystyle \theta }$. Depending on the problem and number of dimensions, there may be more such parameters. The output of a point set registration algorithm is therefore the transformation parameter ${\displaystyle \theta }$ of model ${\displaystyle T}$ so that ${\displaystyle {\mathcal {M}}}$ is optimally aligned to ${\displaystyle {\mathcal {S}}}$.

In convergence, it is desired for the distance between the two point sets to reach a global minimum. This is difficult without exhausting all possible transformations, so a local minimum suffices. The distance function between a transformed model point set ${\displaystyle T({\mathcal {M}})}$ and the scene point set ${\displaystyle {\mathcal {S}}}$ is given by some function ${\displaystyle \operatorname {dist} }$. A simple approach is to take the square of the Euclidean distance for every pair of points:

${\displaystyle \operatorname {dist} (T({\mathcal {M}}),{\mathcal {S}})=\sum _{m\in T({\mathcal {M}})}\sum _{s\in {\mathcal {S}}}(m-s)^{2}}$

(3)

Minimizing such a function in rigid registration is equivalent to solving a least squares problem. However, this function is sensitive to outlier data and consequently algorithms based on this function tend to be less robust against noisy data. A more robust formulation of the cost function uses some robust function ${\displaystyle g}$:

${\displaystyle \operatorname {dist} _{\operatorname {robust} }(T({\mathcal {M}}),{\mathcal {S}})=\sum _{m\in T({\mathcal {M}})}\sum _{s\in {\mathcal {S}}}g((m-s)^{2})}$

(4)

Such a formulation is known as an M-estimator. The robust function ${\displaystyle g}$ is chosen such that the local configuration of the point set is insensitive to distant points, hence making it robust against outliers and noise.[7]

### Rigid registration

Given two point sets, rigid registration yields a rigid transformation which maps one point set to the other. A rigid transformation is defined as a transformation that does not change the distance between any two points. Typically such a transformation consists of translation and rotation.[2] In rare cases, the point set may also be mirrored.

### Non-rigid registration

Given two point sets, non-rigid registration yields a non-rigid transformation which maps one point set to the other. Non-rigid transformations include affine transformations such as scaling and shear mapping. However, in the context of point set registration, non-rigid registration typically involves nonlinear transformation. If the eigenmodes of variation of the point set are known, the nonlinear transformation may be parametrized by the eigenvalues.[8] A nonlinear transformation may also be parametrized as a thin plate spline.[1][8]

## Point set registration algorithms

Some approaches to point set registration use algorithms that solve the more general graph matching problem.[6] However, the computational complexity of such methods tend to be high and they are limited to rigid registrations. Algorithms specific to the point set registration problem are described in the following sections. The PCL (Point Cloud Library) is an open-source framework for n-dimensional point cloud and 3D geometry processing. It includes several point registration algorithms.[9]

### Iterative closest point

The iterative closest point (ICP) algorithm was introduced by Besl and McKay.[10] The algorithm performs rigid registration in an iterative fashion by assuming that every point in ${\displaystyle {\mathcal {M}}}$ corresponds with the closest point to it in ${\displaystyle {\mathcal {S}}}$, and then finding the least squares rigid transformation. As such, it works best if the initial pose of ${\displaystyle {\mathcal {M}}}$ is sufficiently close to ${\displaystyle {\mathcal {S}}}$. In pseudocode, the basic algorithm is implemented as follows:

   Algorithm ICP(${\displaystyle {\mathcal {M}},{\mathcal {S}}}$)
${\displaystyle \theta :=\theta _{0}}$
while not registered:
X := ∅
for ${\displaystyle m_{i}\in T({\mathcal {M}},\theta )}$:
${\displaystyle {\hat {s}}_{j}:={\text{closest point in }}{\mathcal {S}}{\text{ to }}m_{i}}$
${\displaystyle X:=X+\langle m_{i},{\hat {s}}_{j}\rangle }$
θ := least squares(X)
return θ


Here, the function least_squares performs least squares regression to minimize the distance in each of the ${\displaystyle \langle m_{i},{\hat {s}}_{j}\rangle }$ pairs, i.e. minimizing the distance function in Equation (3).

Because the cost function of registration depends on finding the closest point in ${\displaystyle {\mathcal {S}}}$ to every point in ${\displaystyle {\mathcal {M}}}$, it can change as the algorithm is running. As such, it is difficult to prove that ICP will in fact converge exactly to the local optimum.[7] In fact, empirically, ICP and EM-ICP do not converge to the local minimum of the cost function.[7] Nonetheless, because ICP is intuitive to understand and straightforward to implement, it remains the most commonly used point set registration algorithm.[7] Many variants of ICP have been proposed, affecting all phases of the algorithm from the selection and matching of points to the minimization strategy.[8][11] For example, the expectation maximization algorithm is applied to the ICP algorithm to form the EM-ICP method, and the Levenberg-Marquardt algorithm is applied to the ICP algorithm to form the LM-ICP method.[2]

### Robust point matching

Robust point matching (RPM) was introduced by Gold et al.[12] The method performs registration using deterministic annealing and soft assignment of correspondences between point sets. Whereas in ICP the correspondence generated by the nearest-neighbour heuristic is binary, RPM uses a soft correspondence where the correspondence between any two points can be anywhere from 0 to 1, although it ultimately converges to either 0 or 1. The correspondences found in RPM is always one-to-one, which is not always the case in ICP.[1] Let ${\displaystyle m_{i}}$ be the ${\displaystyle i}$th point in ${\displaystyle {\mathcal {M}}}$ and ${\displaystyle s_{j}}$ be the ${\displaystyle j}$th point in ${\displaystyle {\mathcal {S}}}$. The match matrix ${\displaystyle \mathbf {\mu } }$ is defined as such:

${\displaystyle \mu _{ij}=\left\lbrace {\begin{matrix}1&{\text{if point }}m_{i}{\text{ corresponds to point }}s_{j}\\0&{\text{otherwise}}\end{matrix}}\right.}$

(rpm.1)

The problem is then defined as: Given two point sets ${\displaystyle {\mathcal {M}}}$ and ${\displaystyle {\mathcal {S}}}$ find the Affine transformation ${\displaystyle T}$ and the match matrix ${\displaystyle \mathbf {\mu } }$ that best relates them.[12] Knowing the optimal transformation makes it easy to determine the match matrix, and vice versa. However, the RPM algorithm determines both simultaneously. The transformation may be decomposed into a translation vector and a transformation matrix:

${\displaystyle T(m)=\mathbf {A} m+\mathbf {t} }$

The matrix ${\displaystyle \mathbf {A} }$ in 2D is composed of four separate parameters ${\displaystyle \lbrace a,\theta ,b,c\rbrace }$, which are scale, rotation, and the vertical and horizontal shear components respectively. The cost function is then:

${\displaystyle \operatorname {cost} =\sum _{j=1}^{N}\sum _{i=1}^{M}\mu _{ij}\lVert s_{j}-\mathbf {t} -\mathbf {A} m_{i}\rVert ^{2}+g(\mathbf {A} )-\alpha \sum _{j=1}^{N}\sum _{i=1}^{M}\mu _{ij}}$

(rpm.2)

subject to ${\displaystyle \forall j~\sum _{i=1}^{M}\mu _{ij}\leq 1}$, ${\displaystyle \forall i~\sum _{j=1}^{N}\mu _{ij}\leq 1}$, ${\displaystyle \forall ij~\mu _{ij}\in \lbrace 0,1\rbrace }$. The ${\displaystyle \alpha }$ term biases the objective towards stronger correlation by decreasing the cost if the match matrix has more ones in it. The function ${\displaystyle g(\mathbf {A} )}$ serves to regularize the Affine transformation by penalizing large values of the scale and shear components:

${\displaystyle g(\mathbf {A} (a,\theta ,b,c))=\gamma (a^{2}+b^{2}+c^{2})}$

for some regularization parameter ${\displaystyle \gamma }$.

The RPM method optimizes the cost function using the Softassign algorithm. The 1D case will be derived here. Given a set of variables ${\displaystyle \lbrace Q_{j}\rbrace }$ where ${\displaystyle Q_{j}\in \mathbb {R} ^{1}}$. A variable ${\displaystyle \mu _{j}}$ is associated with each ${\displaystyle Q_{j}}$ such that ${\displaystyle \sum _{j=1}^{J}\mu _{j}=1}$. The goal is to find ${\displaystyle \mathbf {\mu } }$ that maximizes ${\displaystyle \sum _{j=1}^{J}\mu _{j}Q_{j}}$. This can be formulated as a continuous problem by introducing a control parameter ${\displaystyle \beta >0}$. In the deterministic annealing method, the control parameter ${\displaystyle \beta }$ is slowly increased as the algorithm runs. Let ${\displaystyle \mathbf {\mu } }$ be:

${\displaystyle \mu _{\hat {j}}={\frac {\exp {(\beta Q_{\hat {j}})}}{\sum _{j=1}^{J}\exp {(\beta Q_{j})}}}}$

(rpm.3)

this is known as the softmax function. As ${\displaystyle \beta }$ increases, it approaches a binary value as desired in Equation (rpm.1). The problem may now be generalized to the 2D case, where instead of maximizing ${\displaystyle \sum _{j=1}^{J}\mu _{j}Q_{j}}$, the following is maximized:

${\displaystyle E(\mu )=\sum _{j=1}^{N}\sum _{i=0}^{M}\mu _{ij}Q_{ij}}$

(rpm.4)

where

${\displaystyle Q_{ij}=-(\lVert s_{j}-\mathbf {t} -\mathbf {A} m_{i}\rVert ^{2}-\alpha )=-{\frac {\partial \operatorname {cost} }{\partial \mu _{ij}}}}$

This is straightforward, except that now the constraints on ${\displaystyle \mu }$ are doubly stochastic matrix constraints: ${\displaystyle \forall j~\sum _{i=1}^{M}\mu _{ij}=1}$ and ${\displaystyle \forall i~\sum _{j=1}^{N}\mu _{ij}=1}$. As such the denominator from Equation (rpm.3) cannot be expressed for the 2D case simply. To satisfy the constraints, it is possible to use a result due to Sinkhorn,[12] which states that a doubly stochastic matrix is obtained from any square matrix with all positive entries by the iterative process of alternating row and column normalizations. Thus the algorithm is written as such:[12]

   Algorithm RPM2D${\displaystyle ({\mathcal {M}},{\mathcal {S}})}$
t := 0
${\displaystyle a,\theta ,b,c:=0}$
${\displaystyle \beta :=\beta _{0}}$
${\displaystyle {\hat {\mu }}_{ij}:=1+\epsilon }$
while ${\displaystyle \beta <\beta _{f}}$:
while μ has not converged:
// update correspondence parameters by softassign
${\displaystyle Q_{ij}:=-{\frac {\partial \operatorname {cost} }{\partial \mu _{ij}}}}$
${\displaystyle \mu _{ij}^{0}:=\exp(\beta Q_{ij})}$
// apply Sinkhorn's method
while ${\displaystyle {\hat {\mu }}}$ has not converged:
// update ${\displaystyle {\hat {\mu }}}$ by normalizing across all rows:
${\displaystyle {\hat {\mu }}_{ij}^{1}:={\frac {{\hat {\mu }}_{ij}^{0}}{\sum _{i=1}^{M+1}{\hat {\mu }}_{ij}^{0}}}}$
// update ${\displaystyle {\hat {\mu }}}$ by normalizing across all columns:
${\displaystyle {\hat {\mu }}_{ij}^{0}:={\frac {{\hat {\mu }}_{ij}^{1}}{\sum _{j=1}^{N+1}{\hat {\mu }}_{ij}^{1}}}}$
// update pose parameters by coordinate descent
update θ using analytical solution
update t using analytical solution
update a, b, c using Newton's method
${\displaystyle \beta :=\beta _{r}\beta }$
${\displaystyle \gamma :={\frac {\gamma }{\beta _{r}}}}$
return a, b, c, θ and t


where the deterministic annealing control parameter ${\displaystyle \beta }$ is initially set to ${\displaystyle \beta _{0}}$ and increases by factor ${\displaystyle \beta _{r}}$ until it reaches the maximum value ${\displaystyle \beta _{f}}$. The summations in the normalization steps sum to ${\displaystyle M+1}$ and ${\displaystyle N+1}$ instead of just ${\displaystyle M}$ and ${\displaystyle N}$ because the constraints on ${\displaystyle \mu }$ are inequalities. As such the ${\displaystyle M+1}$th and ${\displaystyle N+1}$th elements are slack variables.

The algorithm can also be extended for point sets in 3D or higher dimensions. The constraints on the correspondence matrix ${\displaystyle \mathbf {\mu } }$ are the same in the 3D case as in the 2D case. Hence the structure of the algorithm remains unchanged, with the main difference being how the rotation and translation matrices are solved.[12]

#### Thin plate spline robust point matching

Animation of 2D non-rigid registration of the green point set ${\displaystyle {\mathcal {M}}}$ to the magenta point set ${\displaystyle {\mathcal {S}}}$ corrupted with noisy outliers. The size of the blue circles is inversely related to the control parameter ${\displaystyle \beta }$. The yellow lines indicate correspondence.

The thin plate spline robust point matching (TPS-RPM) algorithm by Chui and Rangarajan augments the RPM method to perform non-rigid registration by parametrizing the transformation as a thin plate spline.[1] However, because the thin plate spline parametrization only exists in three dimensions, the method cannot be extended to problems involving four or more dimensions.

### Kernel correlation

The kernel correlation (KC) approach of point set registration was introduced by Tsin and Kanade.[7] Compared with ICP, the KC algorithm is more robust against noisy data. Unlike ICP, where, for every model point, only the closest scene point is considered, here every scene point affects every model point.[7] As such this is a multiply-linked registration algorithm. For some kernel function ${\displaystyle K}$, the kernel correlation ${\displaystyle KC}$ of two points ${\displaystyle x_{i},x_{j}}$ is defined thus:[7]

${\displaystyle KC(x_{i},x_{j})=\int K(x,x_{i})\cdot K(x,x_{j})dx}$

(kc.1)

The kernel function ${\displaystyle K}$ chosen for point set registration is typically symmetric and non-negative kernel, similar to the ones used in the Parzen window density estimation. The Gaussian kernel typically used for its simplicity, although other ones like the Epanechnikov kernel and the tricube kernel may be substituted.[7] The kernel correlation of an entire point set ${\displaystyle {\mathcal {\chi }}}$ is defined as the sum of the kernel correlations of every point in the set to every other point in the set:[7]

${\displaystyle KC({\mathcal {X}})=\sum _{i\neq j}KC(x_{i},x_{j})=2\sum _{i

(kc.2)

The KC of a point set is proportional, within a constant factor, to the logarithm of the information entropy. Observe that the KC is a measure of a "compactness" of the point set—trivially, if all points in the point set were at the same location, the KC would evaluate to a large value. The cost function of the point set registration algorithm for some transformation parameter ${\displaystyle \theta }$ is defined thus:

${\displaystyle \operatorname {cost} ({\mathcal {S}},{\mathcal {M}},\theta )=-\sum _{m\in {\mathcal {M}}}\sum _{s\in {\mathcal {S}}}KC(s,T(m,\theta ))}$

(kc.3)

Some algebraic manipulation yields:

${\displaystyle KC({\mathcal {S}}\cup T({\mathcal {M}},\theta ))=KC({\mathcal {S}})+KC(T({\mathcal {M}},\theta ))-2\operatorname {cost} ({\mathcal {S}},{\mathcal {M}},\theta )}$

(kc.4)

The expression is simplified by observing that ${\displaystyle KC({\mathcal {S}})}$ is independent of ${\displaystyle \theta }$. Furthermore, assuming rigid registration, ${\displaystyle KC(T({\mathcal {M}},\theta ))}$ is invariant when ${\displaystyle \theta }$ is changed because the Euclidean distance between every pair of points stays the same under rigid transformation. So the above equation may be rewritten as:

${\displaystyle KC({\mathcal {S}}\cup T({\mathcal {M}},\theta ))=C-2\operatorname {cost} ({\mathcal {S}},{\mathcal {M}},\theta )}$

(kc.5)

The kernel density estimates are defined as:

${\displaystyle P_{\mathcal {M}}(x,\theta )={\frac {1}{M}}\sum _{m\in {\mathcal {M}}}K(x,T(m,\theta ))}$
${\displaystyle P_{\mathcal {S}}(x)={\frac {1}{N}}\sum _{s\in {\mathcal {S}}}K(x,s)}$

The cost function can then be shown to be the correlation of the two kernel density estimates:

${\displaystyle \operatorname {cost} ({\mathcal {S}},{\mathcal {M}},\theta )=-N^{2}\int _{x}P_{\mathcal {M}}\cdot P_{\mathcal {S}}~dx}$

(kc.6)

Having established the cost function, the algorithm simply uses gradient descent to find the optimal transformation. It is computationally expensive to compute the cost function from scratch on every iteration, so a discrete version of the cost function Equation (kc.6) is used. The kernel density estimates ${\displaystyle P_{\mathcal {M}},P_{\mathcal {S}}}$ can be evaluated at grid points and stored in a lookup table. Unlike the ICP and related methods, it is not necessary to find the nearest neighbour, which allows the KC algorithm to be comparatively simple in implementation.

Compared to ICP and EM-ICP for noisy 2D and 3D point sets, the KC algorithm is less sensitive to noise and results in correct registration more often.[7]

#### Gaussian mixture model

The kernel density estimates are sums of Gaussians and may therefore be represented as Gaussian mixture models (GMM).[13] Jian and Vemuri use the GMM version of the KC registration algorithm to perform non-rigid registration parametrized by thin plate splines.

### Coherent point drift

Rigid (with the addition of scaling) registration of a blue point set ${\displaystyle {\mathcal {M}}}$ to the red point set ${\displaystyle {\mathcal {S}}}$ using the Coherent Point Drift algorithm. Both point sets have been corrupted with removed points and random spurious outlier points.
Affine registration of a blue point set ${\displaystyle {\mathcal {M}}}$ to the red point set ${\displaystyle {\mathcal {S}}}$ using the Coherent Point Drift algorithm.
Non-rigid registration of a blue point set ${\displaystyle {\mathcal {M}}}$ to the red point set ${\displaystyle {\mathcal {S}}}$ using the Coherent Point Drift algorithm. Both point sets have been corrupted with removed points and random spurious outlier points.

Coherent point drift (CPD) was introduced by Myronenko and Song.[8][14] The algorithm takes a probabilistic approach to aligning point sets, similar to the GMM KC method. Unlike earlier approaches to non-rigid registration which assume a thin plate spline transformation model, CPD is agnostic with regard to the transformation model used. The point set ${\displaystyle {\mathcal {M}}}$ represents the Gaussian mixture model (GMM) centroids. When the two point sets are optimally aligned, the correspondence is the maximum of the GMM posterior probability for a given data point. To preserve the topological structure of the point sets, the GMM centroids are forced to move coherently as a group. The expectation maximization algorithm is used to optimize the cost function.[8]

Let there be M points in ${\displaystyle {\mathcal {M}}}$ and N points in ${\displaystyle {\mathcal {S}}}$. The GMM probability density function for a point s is:

${\displaystyle p(s)=\sum _{i=1}^{M+1}P(i)p(s|i)}$

(cpd.1)

where, in D dimensions, ${\displaystyle p(s|i)}$ is the Gaussian distribution centered on point ${\displaystyle m_{i}\in {\mathcal {M}}}$.

${\displaystyle p(s|i)={\frac {1}{(2\pi \sigma ^{2})^{D/2}}}\exp {\left(-{\frac {\lVert s-m_{i}\rVert ^{2}}{2\sigma ^{2}}}\right)}}$

The membership probabilities ${\displaystyle P(i)={\frac {1}{M}}}$ is equal for all GMM components. The weight of the uniform distribution is denoted as ${\displaystyle w\in [0,1]}$. The mixture model is then:

${\displaystyle p(s)=w{\frac {1}{N}}+(1-w)\sum _{i=1}^{M}{\frac {1}{M}}p(s|i)}$

(cpd.2)

The GMM centroids are re-parametrized by a set of parameters ${\displaystyle \theta }$ estimated by maximizing the likelihood. This is equivalent to minimizing the negative log-likelihood function:

${\displaystyle E(\theta ,\sigma ^{2})=-\sum _{j=1}^{N}\log \sum _{i=1}^{M+1}P(i)p(s|i)}$

(cpd.3)

where it is assumed that the data is independent and identically distributed. The correspondence probability between two points ${\displaystyle m_{i}}$ and ${\displaystyle s_{j}}$ is defined as the posterior probability of the GMM centroid given the data point:

${\displaystyle P(i|s_{j})={\frac {P(i)p(s_{j}|i)}{p(s_{j})}}}$

The expectation maximization (EM) algorithm is used to find ${\displaystyle \theta }$ and ${\displaystyle \sigma ^{2}}$. The EM algorithm consists of two steps. First, in the E-step or estimation step, it guesses the values of parameters ("old" parameter values) and then uses Bayes' theorem to compute the posterior probability distributions ${\displaystyle P^{\text{old}}(i,s_{j})}$ of mixture components. Second, in the M-step or maximization step, the "new" parameter values are then found by minimizing the expectation of the complete negative log-likelihood function, i.e. the cost function:

${\displaystyle \operatorname {cost} =-\sum _{j=1}^{N}\sum _{i=1}^{M+1}P^{\text{old}}(i|s_{j})\log(P^{\text{new}}(i)p^{\text{new}}(s_{j}|i))}$

(cpd.4)

Ignoring constants independent of ${\displaystyle \theta }$ and ${\displaystyle \sigma }$, Equation (cpd.4) can be expressed thus:

${\displaystyle \operatorname {cost} (\theta ,\sigma ^{2})={\frac {1}{2\sigma ^{2}}}\sum _{j=1}^{N}\sum _{i=1}^{M+1}P^{\text{old}}(i|s_{j})\lVert s_{j}-T(m_{i},\theta )\rVert ^{2}+{\frac {N_{\mathbf {P} }D}{2}}\log {\sigma ^{2}}}$

(cpd.5)

where

${\displaystyle N_{\mathbf {P} }=\sum _{j=0}^{N}\sum _{i=0}^{M}P^{\text{old}}(i|s_{j})\leq N}$

with ${\displaystyle N=N_{\mathbf {P} }}$ only if ${\displaystyle w=0}$. The posterior probabilities of GMM components computed using previous parameter values ${\displaystyle P^{\text{old}}}$ is:

${\displaystyle P^{\text{old}}(i|s_{j})={\frac {\exp \left(-{\frac {1}{2\sigma ^{{\text{old}}2}}}\lVert s_{j}-T(m_{i},\theta ^{\text{old}})\rVert ^{2}\right)}{\sum _{k=1}^{M}\exp \left(-{\frac {1}{2\sigma ^{{\text{old}}2}}}\lVert s_{j}-T(m_{k},\theta ^{\text{old}})\rVert ^{2}\right)+(2\pi \sigma ^{2})^{\frac {D}{2}}{\frac {w}{1-w}}{\frac {M}{N}}}}}$

(cpd.6)

Minimizing the cost function in Equation (cpd.5) necessarily decreases the negative log-likelihood function E in Equation (cpd.3) unless it is already at a local minimum.[8] Thus, the algorithm can be expressed using the following pseudocode, where the point sets ${\displaystyle {\mathcal {M}}}$ and ${\displaystyle {\mathcal {S}}}$ are represented as ${\displaystyle M\times D}$ and ${\displaystyle N\times D}$ matrices ${\displaystyle \mathbf {M} }$ and ${\displaystyle \mathbf {S} }$ respectively:[8]

   Algorithm CPD${\displaystyle ({\mathcal {M}},{\mathcal {S}})}$
${\displaystyle \theta :=\theta _{0}}$
initialize ${\displaystyle 0\leq w\leq 1}$
${\displaystyle \sigma ^{2}:={\frac {1}{DNM}}\sum _{j=1}^{N}\sum _{i=1}^{M}\lVert s_{j}-m_{i}\rVert ^{2}}$
while not registered:
// E-step, compute P
for ${\displaystyle i\in [1,M]}$ and ${\displaystyle j\in [1,N]}$:
${\displaystyle p_{ij}:={\frac {\exp \left(-{\frac {1}{2\sigma ^{2}}}\lVert s_{j}-T(m_{i},\theta )\rVert ^{2}\right)}{\sum _{k=1}^{M}\exp \left(-{\frac {1}{2\sigma ^{2}}}\lVert s_{j}-T(m_{k},\theta )\rVert ^{2}\right)+(2\pi \sigma ^{2})^{\frac {D}{2}}{\frac {w}{1-w}}{\frac {M}{N}}}}}$
// M-step, solve for optimal transformation
${\displaystyle \lbrace \theta ,\sigma ^{2}\rbrace :=\mathbf {solve} (\mathbf {S} ,\mathbf {M} ,\mathbf {P} )}$
return θ


where the vector ${\displaystyle \mathbf {1} }$ is a column vector of ones. The solve function differs by the type of registration performed. For example, in rigid registration, the output is a scale a, a rotation matrix ${\displaystyle \mathbf {R} }$, and a translation vector ${\displaystyle \mathbf {t} }$. The parameter ${\displaystyle \theta }$ can be written as a tuple of these:

${\displaystyle \theta =\lbrace a,\mathbf {R} ,\mathbf {t} \rbrace }$

which is initialized to one, the identity matrix, and a column vector of zeroes:

${\displaystyle \theta _{0}=\lbrace 1,\mathbf {I} ,\mathbf {0} \rbrace }$

The aligned point set is:

${\displaystyle T(\mathbf {M} )=a\mathbf {M} \mathbf {R} ^{T}+\mathbf {1} \mathbf {t} ^{T}}$

The solve_rigid function for rigid registration can then be written as follows, with derivation of the algebra explained in Myronenko's 2010 paper.[8]

   solve_rigid${\displaystyle (\mathbf {S} ,\mathbf {M} ,\mathbf {P} )}$
${\displaystyle N_{\mathbf {P} }:=\mathbf {1} ^{T}\mathbf {P} \mathbf {1} }$
${\displaystyle \mu _{s}:={\frac {1}{N_{\mathbf {P} }}}\mathbf {S} ^{T}\mathbf {P} ^{T}\mathbf {1} }$
${\displaystyle \mu _{m}:={\frac {1}{N_{\mathbf {P} }}}\mathbf {M} ^{T}\mathbf {P} \mathbf {1} }$
${\displaystyle {\hat {\mathbf {S} }}:=\mathbf {S} -\mathbf {1} \mu _{s}^{T}}$
${\displaystyle {\hat {\mathbf {M} }}:=\mathbf {M} -\mathbf {1} \mu _{m}^{T}}$
${\displaystyle \mathbf {A} :={\hat {\mathbf {S} ^{T}}}\mathbf {P} ^{T}{\hat {\mathbf {M} }}}$
${\displaystyle \mathbf {U} ,\mathbf {V} :=\mathbf {svd} (\mathbf {A} )}$ // the singular value decomposition of ${\displaystyle \mathbf {A} =\mathbf {U} \Sigma \mathbf {V} ^{T}}$
${\displaystyle \mathbf {C} :=\operatorname {diag} (1,...,1,\det(\mathbf {UV} ^{T}))}$ // diag(ξ) is the diagonal matrix formed from vector ξ
${\displaystyle \mathbf {R} :=\mathbf {UCV} ^{T}}$
${\displaystyle a:={\frac {\operatorname {tr} (\mathbf {A} ^{T}\mathbf {R} )}{\operatorname {tr} (\mathbf {{\hat {\mathbf {M} }}^{T}\operatorname {diag} (\mathbf {P} \mathbf {1} ){\hat {\mathbf {M} }}} )}}}$ // tr is the trace of a matrix
${\displaystyle \mathbf {t} :=\mu _{s}-a\mathbf {R} \mu _{m}}$
${\displaystyle \sigma ^{2}:={\frac {1}{N_{\mathbf {P} }D}}(\operatorname {tr} (\mathbf {{\hat {\mathbf {S} }}^{T}\operatorname {diag} (\mathbf {P} ^{T}\mathbf {1} ){\hat {\mathbf {S} }}} )-a\operatorname {tr} (\mathbf {A} ^{T}\mathbf {R} ))}$
return ${\displaystyle \lbrace a,\mathbf {R} ,\mathbf {t} \rbrace ,\sigma ^{2}}$


For affine registration, where the goal is to find an affine transformation instead of a rigid one, the output is an affine transformation matrix ${\displaystyle \mathbf {B} }$ and a translation ${\displaystyle \mathbf {t} }$ such that the aligned point set is:

${\displaystyle T(\mathbf {M} )=\mathbf {M} \mathbf {B} ^{T}+\mathbf {1} \mathbf {t} ^{T}}$

The solve_affine function for rigid registration can then be written as follows, with derivation of the algebra explained in Myronenko's 2010 paper.[8]

   solve_affine${\displaystyle (\mathbf {S} ,\mathbf {M} ,\mathbf {P} )}$
${\displaystyle N_{\mathbf {P} }:=\mathbf {1} ^{T}\mathbf {P} \mathbf {1} }$
${\displaystyle \mu _{s}:={\frac {1}{N_{\mathbf {P} }}}\mathbf {S} ^{T}\mathbf {P} ^{T}\mathbf {1} }$
${\displaystyle \mu _{m}:={\frac {1}{N_{\mathbf {P} }}}\mathbf {M} ^{T}\mathbf {P} \mathbf {1} }$
${\displaystyle {\hat {\mathbf {S} }}:=\mathbf {S} -\mathbf {1} \mu _{s}^{T}}$
${\displaystyle {\hat {\mathbf {M} }}:=\mathbf {M} -\mathbf {1} \mu _{s}^{T}}$
${\displaystyle \mathbf {B} :=({\hat {\mathbf {S} ^{T}}}\mathbf {P} ^{T}{\hat {\mathbf {M} }})({\hat {\mathbf {M} ^{T}}}\operatorname {diag} (\mathbf {P} \mathbf {1} ){\hat {\mathbf {M} }})^{-1}}$
${\displaystyle \mathbf {t} :=\mu _{s}-\mathbf {B} \mu _{m}}$
${\displaystyle \sigma ^{2}:={\frac {1}{N_{\mathbf {P} }D}}(\operatorname {tr} (\mathbf {{\hat {\mathbf {S} }}\operatorname {diag} (\mathbf {P} ^{T}\mathbf {1} ){\hat {\mathbf {S} }}} )-\operatorname {tr} ({\hat {\mathbf {S} ^{T}}}\mathbf {P} ^{T}{\hat {\mathbf {M} }}\mathbf {B} ^{T}))}$
return ${\displaystyle \{\mathbf {B} ,\mathbf {t} \},\sigma ^{2}}$


It is also possible to use CPD with non-rigid registration using a parametrization derived using calculus of variations.[8]

Sums of Gaussian distributions can be computed in linear time using the fast Gauss transform (FGT).[8] Consequently, the time complexity of CPD is ${\displaystyle O(M+N)}$, which is asymptotically much faster than ${\displaystyle O(MN)}$ methods.[8]

### Sorting the Correspondence Space (SCS)

This algorithm was introduced in 2013 by H. Assalih to accommodate sonar image registration.[15] These kinds of images tend to have high amounts of noise, so it is expected to have lots of outliers in the point sets to match. SCS delivers high robustness against outliers and can surpass ICP and CPD performance in the presence of outliers. SCS doesn’t use iterative optimization in high dimensional space and is neither probabilistic nor spectral. SCS can match rigid and non-rigid transformations, and performs best when the target transformation is between three and six degrees of freedom.

## References

1. ^ a b c d Chui, Haili; Rangarajan, Anand (2003). "A new point matching algorithm for non-rigid registration". Computer Vision and Image Understanding. 89 (2): 114–141. CiteSeerX 10.1.1.7.4365. doi:10.1016/S1077-3142(03)00009-2.
2. ^ a b c Fitzgibbon, Andrew W. (2003). "Robust registration of 2D and 3D point sets". Image and Vision Computing. 21 (13): 1145–1153. CiteSeerX 10.1.1.335.116. doi:10.1016/j.imavis.2003.09.004.
3. ^ Allan, Max; Kapoor, Ankur; Mewes, Philip; Mountney, Peter (2015-01-01). Non Rigid Registration of 3D Images to Laparoscopic Video for Image Guided Surgery. International Workshop on Computer-Assisted and Robotic Endoscopy. Lecture Notes in Computer Science. 9515. Springer International Publishing. pp. 109–116. doi:10.1007/978-3-319-29965-5_11. ISBN 978-3-319-29964-8.
4. ^ Hill, Derek LG; Hawkes, D. J.; Crossman, J. E.; Gleeson, M. J.; Cox, T. C. S.; Bracey, E. E. C. M. L.; Strong, A. J.; Graves, P. (1991). "Registration of MR and CT images for skull base surgery using point-like anatomical features". British Journal of Radiology. 64 (767): 1030–1035. doi:10.1259/0007-1285-64-767-1030. PMID 1742584.
5. ^ Studholme, C.; Hill, D. L.; Hawkes, D. J. (1995). Automated 3D Registration of Truncated MR and CT Images of the Head. Proceedings of the Sixth British Machine Vision Conference. pp. 27–36.
6. ^ a b Jian, Bing; Vemuri, Baba C. (2011). "Robust Point Set Registration Using Gaussian Mixture Models". IEEE Transactions on Pattern Analysis and Machine Intelligence. 33 (8): 1633–1645. doi:10.1109/tpami.2010.223. PMID 21173443.
7. Tsin, Yanghai; Kanade, Takeo (2004). A Correlation-Based Approach to Robust Point Set Registration. Computer Vision ECCV. Lecture Notes in Computer Science. 3023. Springer Berlin Heidelberg. pp. 558–569. CiteSeerX 10.1.1.156.6729. doi:10.1007/978-3-540-24672-5_44. ISBN 978-3-540-21982-8.
8. Myronenko, Andriy; Song, Xubo (2010). "Point set registration: Coherent Point drift". IEEE Transactions on Pattern Analysis and Machine Intelligence. 32 (2): 2262–2275. arXiv:0905.2635. doi:10.1109/tpami.2010.46. PMID 20975122.
9. ^ Holz, Dirk; Ichim, Alexandru E.; Tombari, Federico; Rusu, Radu B.; Behnke, Sven (2015). "Registration with the Point Cloud Library: A Modular Framework for Aligning in 3-D". IEEE Robotics Automation Magazine. 22 (4): 110–124. doi:10.1109/MRA.2015.2432331.
10. ^ Besl, Paul; McKay, Neil (1992). "A Method for Registration of 3-D Shapes". IEEE Transactions on Pattern Analysis and Machine Intelligence. 14 (2): 239–256. doi:10.1109/34.121791.
11. ^ Rusinkiewicz, Szymon; Levoy, Marc (2001). Efficient variants of the ICP algorithm. Proceedings of the Third International Conference on 3-D Digital Imaging and Modeling, 2001. IEEE. pp. 145–152. doi:10.1109/IM.2001.924423.
12. Gold, Steven; Rangarajan, Anand; Lu, Chien-Ping; Suguna, Pappu; Mjolsness, Eric (1998). "New algorithms for 2d and 3d point matching:: pose estimation and correspondence". Pattern Recognition. 38 (8): 1019–1031. doi:10.1016/S0031-3203(98)80010-1.
13. ^ Jian, Bing; Vemuri, Baba C. (2005). A robust algorithm for point set registration using mixture of Gaussians. Tenth IEEE International Conference on Computer Vision 2005. 2. pp. 1246–1251.
14. ^ Myronenko, Andriy; Song, Xubo; Carriera-Perpinán, Miguel A. (2006). "Non-rigid point set registration: Coherent point drift". Advances in Neural Information Processing Systems. 19: 1009–1016. Retrieved 31 May 2014.
15. ^ Assalih, Hassan. (2013). "Chapter 6: Sorting the Correspondence Space". 3D reconstruction and motion estimation using forward looking sonar (PDF) (Ph.D.). Heriot-Watt University.