Quiz: from a peak to a mosaic

Short questions to test your understanding. Try each on paper first, then open the answer. The shift of tile B relative to tile A is where B sits on A; tiles are N \times N.


Q1. Two 100 \times 100 tiles give an unpadded phase-correlation peak at (80, 10). Which four shifts can it mean? Which overlaps do they have?

Subtract the tile size in x, in y, or in both.

(80, 10), (-20, 10), (80, -90) and (-20, -90). Overlaps: 20 \cdot 90 = 1800 px (18 %), 80 \cdot 90 = 7200 (72 %), 20 \cdot 10 = 200 (2 %), 80 \cdot 10 = 800 (8 %). NCC on each overlap decides; the 2 % candidate is too small to judge.


Q2. Why do stitching programs often test the four candidates instead of zero-padding the tiles?

Compare the cost of the two ways.

Padding makes every FFT about four times larger (in 2D) and the overlap becomes a smaller part of the padded image. Testing four candidates by NCC costs one small computation per candidate on the overlap pixels only, and also gives a confidence for the pair.


Q3. The correlation samples around a peak are (0.5, 0.9, 0.7). Estimate the sub-pixel position with a parabola.

\delta = \dfrac{c_{-1} - c_{+1}}{2(c_{-1} - 2c_0 + c_{+1})}.

\delta = \dfrac{0.5 - 0.7}{2(0.5 - 1.8 + 0.7)} = \dfrac{-0.2}{-1.2} = \tfrac16 \approx 0.17 px to the right of the middle sample, towards the larger neighbour.


Q4. What is “pixel locking”, and which method avoids it?

Plot the error of the parabola against the true fraction of a pixel.

The parabola (and the centroid) estimates are pulled towards whole pixels: their error is zero at fractions 0 and 0.5 and largest in between, an S-shaped curve, because the true peak is not a parabola. A histogram of many estimates then piles up near whole pixels. The upsampled DFT evaluates the exact interpolated correlation on a fine grid and has no such bias (only the grid spacing).


Q5. Three tiles in a row: measured shifts d_{12} = 100, d_{23} = 102, d_{13} = 199. Chaining gives x_3 = 202 from the first two, but the direct measurement says 199. What does least squares (equal weights, x_1 = 0) give?

Minimise (x_2 - 100)^2 + (x_3 - x_2 - 102)^2 + (x_3 - 199)^2.

Setting the derivatives to zero: 2x_2 - x_3 = -2 and -x_2 + 2x_3 = 301, so x_2 = 99, x_3 = 200. Each measurement is off by 1: residuals -1, -1, +1. The discrepancy of 3 around the loop is shared by all three pairs.


Q6. One pair of a mosaic was registered wrongly by 100 px. What happens with chaining along a path through that pair, and with global least squares?

Who depends on that pair in each case?

Chaining: every tile after the bad pair moves by 100 px. Global least squares: the other paths around the loop disagree with the bad pair, so the solution follows the majority; the bad pair is left with a large residual (here about 100 px), which flags it. If its confidence is low, it gets little weight in the first place. Then drop it and solve again.


Q7. A time-lapse drifts slowly while the cells inside change their shape. Register every frame to the first frame or to the previous frame?

What makes each choice fail?

To the first frame, errors do not accumulate, but late frames may no longer resemble the first one when the sample changes. To the previous frame, consecutive frames resemble each other, but the errors of all steps add up (a random walk). With a changing sample, register to the previous frame or to key frames, and keep the step errors small (sub-pixel estimation, low noise).


Q8. (math) Why is the matrix of the normal equations of global alignment singular, and how is that fixed?

What happens to the energy if every tile is moved by the same amount?

The energy depends only on differences x_j - x_i; adding the same constant to every position does not change it. So the graph Laplacian L has L\mathbf 1 = 0: the constant vector is in its null space. Fixing one tile (x_1 = 0, i.e. deleting its row and column) removes this freedom; for a connected graph the reduced matrix is invertible.