Quiz: aligning point sets
Before this unit: From matches to a transform: RANSAC, stitching and registration (previous unit); Day 2: Edges, blobs and ridges.
See also: Shape models: landmarks, Procrustes and PCA (day 30); From detections to tracks (day 26); Day 21: Hough transform; Day 23: FFT registration; Day 20: Point detection.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. Why can the ratio test and RANSAC of the previous units not align two sets of bead positions?
What do they compare to decide which point matches which?
They need candidate matches from descriptors: a description of each point’s neighbourhood that can be compared between the images. A bead position is only a position; every bead looks the same. Without candidate pairs there is nothing to test. ICP gets its pairs from the positions alone: the nearest point under the current guess of the transform.
Q2. You know the pairs. In which order do you find the shift and the rotation, and why does that order work?
Where does the best transform put the centroid?
The best transform maps the centroid of one set onto the centroid of the other, whatever the rotation. So centre both sets first; the rotation is then found from the centred points alone (\theta = \operatorname{atan2}(S_\text{cross}, S_\text{dot}) in 2D), and the shift is \bar{\mathbf q} - R\bar{\mathbf p}.
Q3. What are the two steps of one ICP iteration, and why can neither increase the sum of squared distances?
In each step one thing is held fixed.
Match: for the current transform, pair each moving point with its nearest fixed point; the new partner is never further away than the old one. Move: for these pairs, fit the best transform; it is never worse than the old transform on the same pairs. Both steps lower (or keep) the same sum.
Q4. ICP has converged with an RMS of 2 px. Is the alignment right?
What does converged mean for ICP?
Not necessarily. Converged only means the pairing no longer changes: a local minimum. A wrong but self-consistent pairing can also have short distances, especially for dense, evenly spread points, where every point has some neighbour close by. 2 px means little unless you know what the right alignment would give (the noise of the positions). Check with an overlay, a landmark not used in the fit, or by starting from several angles.
Q5. Name three ways to give ICP a good start.
Shift, rotation, and a little outside help.
Match the centroids (removes a large shift, if the sets overlap fully); align the principal axes of both sets (a rotation guess, up to 180°); try several start angles and keep the result with the lowest RMS; a few manual landmarks or feature matches with RANSAC, then ICP to refine.
Q6. A third of the cells in time point 2 are not in time point 1. What goes wrong with plain ICP, and what is the fix?
Every moving point gets a partner.
Each new cell is paired with some cell of time point 1, at a large distance, and least squares lets these long pairs pull the transform. Trimmed ICP keeps only the closest fraction of the pairs (here about 2/3) in each iteration; alternatives are a distance cut-off, mutual nearest neighbours, or robust weights.
Q7. Why does point-to-point ICP align two samplings of the same outline slightly wrongly, and what does point to plane change?
Where are the exact partners of the moving samples?
The moving samples lie between the fixed samples, so they have no exact partners; point to point pulls each one onto the nearest fixed sample, and the whole set slides along the outline (a small rotation error). Point to plane measures only the distance across the surface (to the tangent), so sliding along it costs nothing and the sampling no longer biases the result; it also converges in far fewer iterations.
Q8. (math) Show that for known pairs the best shift is \mathbf t = \bar{\mathbf q} - R\bar{\mathbf p}, and that in 2D the best angle is \operatorname{atan2}(S_\text{cross}, S_\text{dot}).
Differentiate with respect to \mathbf t; then expand the square and keep the terms with R.
\partial/\partial\mathbf t \sum|R\mathbf p_i + \mathbf t - \mathbf q_i|^2 = 2\sum(R\mathbf p_i + \mathbf t - \mathbf q_i) = 0 gives n\mathbf t = \sum\mathbf q_i - R\sum\mathbf p_i. With centred points the sum is \sum|\mathbf p'|^2 + \sum|\mathbf q'|^2 - 2\sum\mathbf q'\cdot R\mathbf p' (|R\mathbf p'| = |\mathbf p'|), and \mathbf q'\cdot R\mathbf p' = \cos\theta\,(p_xq_x + p_yq_y) + \sin\theta\,(p_xq_y - p_yq_x). So maximise S_\text{dot}\cos\theta + S_\text{cross}\sin\theta = \sqrt{S_\text{dot}^2 + S_\text{cross}^2}\cos(\theta - \varphi) with \varphi = \operatorname{atan2}(S_\text{cross}, S_\text{dot}): the maximum is at \theta = \varphi.