Quiz: Lucas–Kanade
Before this unit: Motion between frames: brightness constancy and the aperture problem (previous unit); The structure tensor: orientation and corners (day 2); Day 2: Edges, blobs and ridges; Day 23: FFT registration.
See also: Day 5: Deconvolution; Day 6: Splines and NURBS.
Short questions to test your understanding. Try each on paper first, then open the answer. Convention: x to the right, y down; flow in pixels per frame.
Q1. What does Lucas–Kanade assume, and how does that assumption get around the aperture problem?
How many constraint lines does a window give?
It assumes the flow is the same for all pixels of a small window. Then the window gives many constraint lines for the same two unknowns; if the gradients in the window point in different directions, the lines cross and the velocity is determined (least squares: the point closest to all lines).
Q2. The Lucas–Kanade matrix of a window has eigenvalues 300 and 280. Another window has 300 and 0.5, a third 0.4 and 0.1. Where would you trust the flow?
It is the structure tensor of the edges day.
First window (both large): a corner or texture, trust it. Second (one large, one tiny): an edge, only the motion across the edge is reliable. Third (both tiny): flat, no information. The smaller eigenvalue \mu_2 is the confidence.
Q3. You double the window radius ρ. Name one thing that gets better and one that gets worse.
Noise, and what lies inside the window.
Better: more pixels average the noise away and fewer windows contain only one edge. Worse: the window reaches across motion boundaries and mixes different motions (a cell and the still background), and fine detail of the flow field is blurred.
Q4. Lucas–Kanade gives nonsense for a shift of 8 pixels on the micrograph. Why? Give two remedies.
The constraint is a first-order Taylor expansion.
The linearisation holds only for motion small compared with how fast the gradient changes (about a pixel at the scale of the image structure). Remedies: iterate with warping (estimate, warp frame 2 back, estimate the rest), and go coarse to fine on a Gaussian pyramid, where 8 px is 1 px at level 3.
Q5. On a 4-level pyramid (levels 0 to 3), the true motion is 12 px. What is it at each level? When going from level 2 to level 1, what do you do with the flow found at level 2?
Each level halves the pixel count per side.
12, 6, 3 and 1.5 px at levels 0, 1, 2, 3. Going from level 2 to level 1: upsample the flow to the finer grid and double it (a pixel at level 2 is two pixels at level 1), warp frame 2 by it, and estimate the remaining small motion.
Q6. Why does block matching cope with large motion while Lucas–Kanade does not? What does Lucas–Kanade do better?
Searching vs linearising.
Block matching tries every shift in a search range and keeps the best score, so it does not depend on a linearisation. But it gives integer shifts unless a peak is fitted, and is slow (many shifts per window). Lucas–Kanade is sub-pixel by construction and cheap (five blurs and a 2\times2 solve per pixel).
Q7. (math) Write the normal equations of Lucas–Kanade for a window. What happens when all gradients in the window are parallel?
Differentiate \sum w(I_xu + I_yv + I_t)^2.
\begin{pmatrix}\sum wI_x^2 & \sum wI_xI_y\\ \sum wI_xI_y & \sum wI_y^2\end{pmatrix}\begin{pmatrix}u\\v\end{pmatrix} = -\begin{pmatrix}\sum wI_xI_t\\ \sum wI_yI_t\end{pmatrix}. With all gradients parallel to a unit vector \mathbf n, J = c\,\mathbf n\mathbf n^\top has rank 1 (determinant 0): only \mathbf n \cdot \mathbf u is determined; the minimum-norm solution is the normal flow.