BookNotesSlidesP-sets Syllabusdraft · v0.2.49.1
◀▲⌂▶
💬Comments welcome. To leave a note, select any text and click the note / highlight button that pops up — or open the panel with the tab at the top-right (‹). Notes are visible only inside our private review group.
💡 In a hurry? Jump to this chapter’s 1 big lesson ↓

12.8 Optical flow⧉

📎 Problem set

PS9 (make-your-own) implements Lucas–Kanade optical flow and retiming. → Chapter 1.5, Problem sets (appendix).

You have two consecutive frames of a video, showing a person turning their head, a car crossing the scene, or leaves stirring in the wind, and you want to know, for every single pixel, where it went. Not "the camera panned left" and not "there are three moving objects," but a full, dense field: a little arrow at each pixel saying how far and in what direction that bit of the world slid between the two frames. That field is optical flow, and it is the automatic, dense answer to the same correspondence question Chapter 11.3, Morphing answered by hand. Where morphing made you draw line pairs across two faces, optical flow estimates the entire two-dimensional displacement field straight from the two images, with no human in the loop.

It is also, as we will see almost immediately, a problem that is intrinsically ill-posed, and the derivation makes that explicit. The mathematics will tell us, pixel by pixel, exactly where it cannot recover the motion, and why. That confession is not a weakness to apologize for; it is the most important thing in the chapter, because every flow algorithm ever written is a different answer to the question the math itself raises: given that one pixel can never tell us its full motion, where do we get the missing information?

We pose brightness constancy, linearize it into the optical-flow constraint, one equation per pixel, and immediately hit the aperture problem: one equation, two unknowns. Then come the two classic ways to supply the second equation: Lucas–Kanade (borrow it from your neighbors) and Horn–Schunck (borrow it from a global smoothness prior), the coarse-to-fine trick that rescues the linearization for large motion, and finally learned flow, which keeps this skeleton and replaces the hand-built parts with trained ones.

💡 Big lesson (L17, recurrence)

Correspondence first, then transport. The unifying move of this whole part: nearly every technique (1) estimates a correspondence (a coordinate map saying where each pixel came from) and then (2) transports the pixels along it by warping and resampling. The transport is one shared engine (Chapter 11.1, Warping); the correspondence is the hard, ill-posed part. Optical flow is the part's most general correspondence estimator: a dense, per-pixel map estimated automatically from two images, where a homography would be parametric and a morph field user-drawn. Here, the flow is the correspondence: the field $(u,v)$ is itself the coordinate map that morphing, frame interpolation, stabilization, and compression all transport along. Everything downstream of this chapter assumes you can produce it. This is the part's anchor for L17 (registered in Matching pixels across space and time; it recurs across the part).

12.8.1 What optical flow is: and whether it is even well-defined⧉

Optical flow is the two-dimensional motion vector of every pixel between two frames (usually consecutive): a dense field $\big(u(x,y),\,v(x,y)\big)$ that, for each pixel, says how far it moved horizontally and vertically. Because a field of little arrows is hard to read, flow is conventionally displayed with a color key: hue encodes the direction of motion and saturation its speed, so that a coherent moving region shows up as a smooth wash of one color (Figure 12.8.1).

This primitive earns its own chapter because almost everything downstream needs it. Frame interpolation and slow-motion synthesis transport pixels to the in-between time along the flow; video stabilization and compression both reduce to "estimate motion, then act on it"; super-resolution and inpainting align frames by it; and far outside photography, the same field drives optical mice, medical image registration, action recognition, egomotion and simultaneous localization and mapping (SLAM), and fluid-flow measurement. It is widely used.

A close relative shows what extra structure buys you. Stereo disparity is optical flow specialized to a static scene viewed by two cameras with a known baseline: the geometry forces the match to lie on a one-dimensional epipolar line, so there is a single unknown (depth, equivalently disparity) per pixel instead of two. Flow is the unconstrained two-dimensional version, with no epipolar line to ride and both components free (cross-ref Chapter 12.1, Brute force).

Brightness-based correspondence is ambiguous or invalid in several common situations:

"The flow," then, is an idealization, and the math will warn us, pixel by pixel, where the idealization breaks. Keep that in mind: a flow field is a best effort, confident in some places and guessing in others, and good methods know the difference.

fig-flow-field-colorkey
Figure 12.8.1. From two frames to a dense field. Two consecutive video frames (a moving foreground object over a near-static background) yield a per-pixel flow $(u,v)$, displayed with the standard color key: hue encodes motion direction, saturation encodes speed (after Baker et al. 2011). A coherently moving region reads as one smooth color; the static background reads as near-white (zero motion); occlusion seams and the textureless interior show up as noisy or uncertain. The key turns a field of thousands of little arrows into a single readable image.

12.8.2 Brightness constancy and the optical-flow constraint⧉

Start from the one thing we are willing to assume is conserved as a point moves: its brightness. A scene point that sits at $(x,y)$ in the first frame and has slid by $(u,v)$ one timestep later should have the same intensity in the new location. It merely relocated, it did not change color:

$$ I(x,\,y,\,t) \;=\; I(x+u,\;y+v,\;t+1). $$

Here $(u,v)$ is exactly the per-pixel displacement we are after. This is the brightness-constancy (or "color-constancy") assumption of Horn and Schunck (1981). It is an assumption, and we have already flagged where it breaks, for example a surface that turns toward the light, a specular highlight that slides across glass, or a pixel that gets occluded, but for small motions between consecutive frames it is serviceable.

As written, the equation is awkward: the unknowns $(u,v)$ sit inside the image function $I$, in a nonlinear way. The standard move is to linearize: expand the right-hand side to first order about $(x,y,t)$, assuming the motion is small:

$$ I(x+u,\,y+v,\,t+1) \;\approx\; I(x,y,t) \;+\; I_x\,u \;+\; I_y\,v \;+\; I_t, $$

where $I_x,I_y$ are the spatial image gradients and $I_t$ is the temporal gradient, in practice just the frame-to-frame difference at that pixel. Substitute this back into brightness constancy and cancel $I(x,y,t)$ from both sides, and the whole problem collapses to one clean line, the optical-flow constraint equation (OFCE):

$$ \boxed{\,I_x\,u + I_y\,v + I_t = 0\,} \qquad\text{equivalently}\qquad \nabla I\cdot(u,v) + I_t = 0. $$

Read it back: the flow, dotted into the image gradient, must cancel the temporal change. Two facts about this equation drive the entire rest of the chapter.

First, only the gradient carries motion information. Where the image is flat ($\nabla I = 0$), the constraint degenerates to $I_t = 0$ and says nothing whatsoever about $(u,v)$. You cannot see motion in a blank region, because nothing in it changes when it moves. All the information about flow lives in the image gradient, which is exactly why textureless regions were on our ill-posed list. (It is also the precise lever that Eulerian video magnification pulls from the other side: it amplifies the temporal change $I_t$ in proportion to the spatial gradient; cross-ref the motion-magnification chapter and Wu et al. 2012.)

Video 12.8.1. Video: Eulerian Video Magnification for Revealing Subtle Changes in the World. Wu, Rubinstein, Shih, Guttag, Durand & Freeman 2012 (YouTube). Amplifying tiny temporal intensity changes at fixed pixels, without tracking motion, to make a person's pulse and barely-visible movement plainly visible, the Eulerian counterpart to the gradient-based flow constraint developed here.

Second, this is the key point: one equation cannot determine two unknowns. The OFCE is a single scalar equation in the two unknowns $(u,v)$. In the plane of all possible flows it does not pick out a point; it picks out a whole line (Figure 12.8.2). The true flow lies somewhere on that line, but the single pixel cannot say where. The one thing we can read off is the component of motion along the gradient: the normal flow, of magnitude $u_\perp = -I_t / \lVert\nabla I\rVert$ directed along $\nabla I$. The component tangent to the edge is completely free. That under-determination has a name.

fig-flow-constraint-line
Figure 12.8.2. One equation, a line of answers. In the $(u,v)$ plane, the optical-flow constraint $I_x u + I_y v + I_t = 0$ is a line, not a point: every flow on that line satisfies the single equation equally well. The gradient direction $\nabla I$ fixes only the normal component (the foot of the perpendicular from the origin to the line, the normal flow); the component tangent to the line, i.e. along the image edge, is entirely undetermined. A single pixel hands you a line of possibilities and asks for help choosing among them.

12.8.3 The aperture problem⧉

The under-determination we just met has a classical name and a vivid intuition: the aperture problem. The statement is exactly what the OFCE told us: from a single pixel you can recover only the normal flow, the motion perpendicular to the local edge; the motion along the edge is unobservable. One equation, two unknowns (Figure 12.8.3).

The intuition is the "aperture" the name refers to. Watch a long straight edge, a diagonal bar, slide behind a small round hole. You cannot tell whether the bar is moving horizontally, vertically, or straight perpendicular to itself: every one of those motions produces the same changing picture inside the hole. Only the component that changes what is visible through the aperture, the perpendicular one, registers; everything along the edge slides invisibly. The barber-pole illusion is the same effect in a perceptual setting: the diagonal stripes are physically rotating sideways around the pole, but because each stripe is a long edge, only the perpendicular (upward) component is locally visible, and the stripes appear to march up the pole forever.

This is not a bug. The mathematics is reporting a real ambiguity in the data: a single local measurement does not determine tangential motion. So "solving" optical flow does not mean finding a cleverer way to invert one equation; it means adding a second assumption to supply the missing equation. The two classic choices, which organize the rest of the chapter, are:

There is a perceptual coda. Human vision suffers the aperture problem too; we misperceive the barber pole and similar stimuli exactly as the equations predict, and the brain resolves it the same way the algorithms do: by integrating across the object, leaning on corners and line-endings (where there is no aperture ambiguity) to disambiguate the long edges. The math and the visual system are answering the same question with the same trick.

fig-aperture-problem
Figure 12.8.3. Why one pixel is not enough. Left: a single straight edge viewed through a small circular aperture, where three different true motions (horizontal, vertical, perpendicular-to-edge) all produce the identical appearance inside the hole, so only the perpendicular (normal) component is recoverable. Right: the barber-pole illusion, diagonal stripes rotating sideways appear to move straight up, because each stripe is a long edge and only its normal component is locally visible. The recoverable motion is shown as a thick arrow ⟂ to the edge; the unrecoverable along-edge family as faint arrows.

12.8.4 Lucas–Kanade: local constant-flow least squares (and the structure tensor)⧉

The first cure is local, and simple. Assume that all the pixels in a small window $W$ share the same motion $(u,v)$. That single assumption changes everything about the bookkeeping: instead of one equation in two unknowns, we now have many equations, one OFCE per pixel in the window, for the same two unknowns. The problem flips from under-determined to over-determined, and over-determined linear systems have a standard, robust answer: least squares. Aggregating the window both resolves the aperture problem (different pixels in a textured patch have differently-oriented gradients, so their constraint lines intersect at a point) and regularizes against noise. This is Lucas and Kanade (1981).

Concretely, stack the $n$ pixels of the window. Each contributes one row $[\,I_x \;\; I_y\,]$ and one entry $I_t$:

$$ A = \begin{bmatrix} I_x^{(1)} & I_y^{(1)} \\ \vdots & \vdots \\ I_x^{(n)} & I_y^{(n)} \end{bmatrix}, \qquad \mathbf b = \begin{bmatrix} I_t^{(1)} \\ \vdots \\ I_t^{(n)} \end{bmatrix}, \qquad A\begin{bmatrix}u\\v\end{bmatrix} = -\mathbf b. $$

This is a tall, skinny over-determined system, and its least-squares solution is given by the normal equations, exactly the object from Chapter 6.7, Image formation as a linear system:

$$ \boxed{\,A^\top A \begin{bmatrix}u\\v\end{bmatrix} = -A^\top \mathbf b\,}, \qquad A^\top A = \sum_W \begin{bmatrix} I_x^2 & I_x I_y \\ I_x I_y & I_y^2 \end{bmatrix}, \qquad A^\top \mathbf b = \sum_W \begin{bmatrix} I_x I_t \\ I_y I_t\end{bmatrix}. $$

Solve the small least-squares system only where it has adequate rank and scale; do not explicitly invert a nearly singular matrix. But the real point is to look hard at that $2\times2$ matrix on the left, because we have met it before.

The matrix $A^\top A = \sum_W \left(\begin{smallmatrix} I_x^2 & I_x I_y \\ I_x I_y & I_y^2 \end{smallmatrix}\right)$ is the Harris structure tensor: the second-moment matrix of image gradients over the window, the very object that decided corner detection back in Chapter 12.3, Sparse matching (and originally Harris & Stephens 1988). The same matrix that found good keypoints now governs whether flow is recoverable, and its eigenvalues tell the whole story (Figure 12.8.4):

The unification is exact: the corner/edge/flat trichotomy that told us where to put keypoints for matching is the identical eigenvalue story that tells us where flow is well-posed because it is the same matrix. And it hands us the bridge to the next chapter: to get reliable sparse motion, just run Lucas–Kanade only on the pixels where $A^\top A$ is well-conditioned. That is exactly Kanade–Lucas–Tomasi (KLT) feature tracking (cross-ref Chapter 12.4, Feature tracking).

Two caveats fix Lucas–Kanade's scope. Because it rests on the same first-order linearization, it assumes small motion (on the order of a pixel); large displacements need the coarse-to-fine machinery below. Lucas–Kanade uses a shared displacement within a window, whereas Horn–Schunck estimates a globally coupled field; the local solve is not one iteration of that global model (Figure 12.8.6). The same gradient least-squares is also the engine of parametric image alignment (registering two whole images under one affine or projective warp), which is why Lucas–Kanade reappears in Chapter 12.1, Brute force: there the unknowns are a handful of warp parameters rather than a per-pixel $(u,v)$, but the normal-equations skeleton is the same.

fig-flow-corner-edge-flat
Figure 12.8.4. The same structure tensor as Harris, deciding where flow is solvable. Three windows over an image, each annotated with the eigenvalues of $A^\top A=\sum_W\left(\begin{smallmatrix}I_x^2 & I_xI_y\\ I_xI_y & I_y^2\end{smallmatrix}\right)$. Corner (two large eigenvalues): the system is well-conditioned, full 2-D flow recoverable. Edge (one large, one near-zero): rank-deficient → only normal flow; the along-edge direction is the null eigenvector (the aperture problem made algebraic). Flat (both near-zero): no information, flow indeterminate. It is the very picture that selected Harris corners: same matrix, same eigenvalues, now read as flow conditioning.
fig-aperture-lk-demo
Figure 12.8.5. Interactive: the aperture problem and Lucas–Kanade, made tangible. Drag a small window over a moving scene with an edge, a corner, and a flat/textured region. For the patch under the window the demo shows the gradients, the structure-tensor ellipse (eigenvalues of $A^\top A$), and the recoverable motion: on an edge only the normal-flow component is determined (the family of consistent motions is a line, the aperture ambiguity); at a corner LK solves $A^\top A\,\mathbf v = A^\top b$ and recovers the true vector; on a flat region $A^\top A$ is nearly singular, its gradients fall below the demo's threshold, and no motion is reported. The constraint line is drawn only when the window's gradients are effectively one-dimensional, and the temporal derivative comes analytically from the known motion, an idealization a real video does not give you. Move the window from edge → corner → flat and watch the conditioning change.

12.8.5 Horn–Schunck: global smoothness regularization⧉

The second cure is global, and it supplies the missing equation from a prior rather than from a window. Instead of assuming constancy inside a patch, assume that the flow field as a whole is smooth, so neighboring pixels move similarly. This does something Lucas–Kanade cannot: it propagates motion from the data-rich places (corners, textured patches) into the data-poor ones (edges, flat regions), filling in the aperture-ambiguous directions from confident neighbors. This is the other half of Horn and Schunck (1981).

The assumption is expressed as an energy to minimize over the whole image, and it has the standard data-fit-plus-prior shape of every inverse problem in this book:

$$ E(u,v) = \iint \underbrace{\big(I_x\,u + I_y\,v + I_t\big)^2}_{\text{data: brightness constancy}} \;+\; \lambda\,\underbrace{\big(\lVert\nabla u\rVert^2 + \lVert\nabla v\rVert^2\big)}_{\text{prior: smoothness}}\;\,dx\,dy. $$

The data term is just the squared OFCE residual: it penalizes flow that violates brightness constancy. The smoothness term penalizes spatial variation of the flow, $\lVert\nabla u\rVert^2 + \lVert\nabla v\rVert^2$, i.e. it wants neighboring flow vectors to agree. The scalar $\lambda$ trades the two off: large $\lambda$ buys a smoother, more diffused field that fills the apertures aggressively; small $\lambda$ trusts the data and tolerates a noisier field.

Because the energy is quadratic in $(u,v)$, minimizing it is tractable in the most familiar way: the Euler–Lagrange equations are linear, a large sparse system that couples all the pixels (a screened-Poisson-like diffusion: the same flavor of system we solved in Chapter 6.7, Image formation as a linear system and again for Poisson editing). One does not form that matrix; one iterates (Gauss–Seidel or Jacobi), and each update has a readable form: every pixel's flow relaxes toward its neighborhood average, corrected by the local brightness constraint. Smooth the field, honor the data, repeat; the smoothness quietly carries motion into the textureless gaps where the data fell silent.

The contrast with Lucas–Kanade is the thing to carry away (Figure 12.8.6): local window + least squares versus global field + smoothness prior; a one-step $2\times2$ solve versus an iterative sparse relaxation; constant-in-a-patch versus smoothly-varying-everywhere. They are two answers to the same question the aperture problem posed: supply the missing equation by aggregating locally or by regularizing globally.

A word on what "classical flow" actually means today, because the textbook Horn–Schunck is not what wins benchmarks. The Secrets of Optical Flow analysis of Sun, Roth and Black (2010) dissected the best classical methods and found the basic structure is still Horn–Schunck, but the improvements come from better terms: robust (non-quadratic, $L_1$/Charbonnier) penalties on both data and smoothness so that occlusions and motion edges do not get over-smoothed, median filtering of the flow between iterations, coarse-to-fine pyramids (next section), and edge-aware smoothness that bends the prior around image boundaries. The recurring lesson is that the choice of energy matters. Keep the data-fit-plus-prior scaffold and invest in penalties that match reality.

fig-LK-vs-HS
Figure 12.8.6. Two ways to supply the missing equation. Lucas–Kanade (left): over each small window, solve one $2\times2$ system $A^\top A[u\;v]^\top=-A^\top\mathbf b$: local and direct, one linearized solve under a small-motion assumption, flow undefined where the window is untextured. (Practical Lucas–Kanade tracking repeats that solve, warping the window each time, to handle larger motions.) Horn–Schunck (right): minimize one global energy (data term + smoothness $\lambda(\lVert\nabla u\rVert^2+\lVert\nabla v\rVert^2)$), solved by iterative relaxation that propagates motion into textureless regions. Patch-and-least-squares versus prior-and-propagate; one linearized solve versus iterative relaxation; constant-in-a-window versus smooth-everywhere.

12.8.6 Large motion: coarse-to-fine warping⧉

Everything so far rode on the first-order Taylor expansion, and that expansion is only valid for sub-pixel motion. Real motion is many pixels. A hand can cross a quarter of the frame between two frames, and at that scale the linearization is simply wrong: the gradient at a pixel tells you nothing about a match twenty pixels away, and the solver either diverges or locks onto the wrong, aliased match. We need a way to make every motion look sub-pixel.

The fix is pyramids, and it reuses Chapter 6.6, Pyramids and wavelets wholesale. Build a Gaussian pyramid of both frames. On the coarsest level (heavily blurred and downsampled), a motion of, say, sixteen pixels in the original becomes a single pixel, which the linear method handles fine. Then walk back down toward full resolution, and at each finer level (Figure 12.8.7):

  1. upsample the coarse flow estimate to this level and scale its magnitude (twice the resolution → twice the displacement in pixels);
  2. warp frame 2 toward frame 1 by the current flow estimate, using the inverse-warp-and-resample engine of Chapter 11.1, Warping;
  3. estimate only the residual flow on the now-nearly-aligned pair (which is small again, so the linearization is valid) and add it to the running estimate.

Repeat to the finest level. The warp-then-refine loop is worth memorizing, because it is precisely the iterative scheme the learned methods at the end of the chapter reproduce, except that the per-step update is learned rather than derived:

flow = zero field on the coarsest grid
for each level from coarsest to finest:
    if this is not the coarsest level:
        resize flow and scale x/y components by their coordinate-scale ratios
    repeat up to an iteration cap:
        r(x) = frame2(x + flow(x)) - frame1(x)
        J(x) = gradient(frame2) sampled at x + flow(x)
        solve the chosen weighted/regularized linearized problem for delta
        reject invalid updates; flow = flow + delta
        stop if the declared step and residual criteria are met
return flow and validity/confidence information

A pyramid increases the range of motions accessible to a local linearization. It is not a Laplacian decomposition of the true motion, and downsampling can erase small moving objects. Iterative refinement cannot recover evidence that was lost at coarse levels without additional matching or a better initialization.

A different attack on large motion abandons the linearization entirely and matches patches directly. For each pixel in frame 1, score its similarity (sum-of-squared-differences, or correlation) against every candidate offset in frame 2; the result is a cost volume: a high-dimensional table of match scores over all displacements. This keeps brightness constancy but drops the Taylor approximation, so it handles arbitrarily large motion at the price of an expensive search (pruned in practice by coarse-to-fine and, soon, by learned features). The cost volume is a sideshow in classical flow but the centerpiece of the learned methods we turn to now.

fig-coarse-to-fine-flow
Figure 12.8.7. Making large motion sub-pixel. A Gaussian pyramid of both frames: on the coarsest (most blurred, smallest) level, even a large displacement is a fraction of a pixel, so the linear flow method works. Descending the pyramid, at each level: (1) upsample-and-scale the coarse flow, (2) warp frame 2 toward frame 1 by it, (3) estimate the small residual flow on the aligned pair and add it. The arrows at each level show low-frequency motion captured coarse, high-frequency motion added as residuals, which gives a Laplacian-pyramid view of the flow field.

For the fixed linearized Horn–Schunck energy above, the stationarity equations are

$$I_x(I_xu+I_yv+I_t)-\lambda\Delta u=0,\qquad I_y(I_xu+I_yv+I_t)-\lambda\Delta v=0.$$

Use a smoothness discretization and boundary conditions consistent with this energy. In completely uninformative regions, smoothness extrapolates motion rather than measuring it; constant-flow null modes can remain if the data supplies no anchor. Evaluate endpoint error on known visible motion separately from occlusion handling. Forward/backward consistency must sample the backward field at the displaced coordinate, not compare the two fields at the same pixel.

12.8.7 Learned flow: RAFT (neuralize the classical pipeline)⧉

Learned methods can replace the representation and update rule. RAFT is a useful architectural example Teed & Deng 2020, not a permanent statement about which model leads every benchmark.

The exemplar is RAFT (Teed and Deng 2020, a European Conference on Computer Vision (ECCV) best paper), and it is best read as the classical pipeline with three of its parts neuralized (Figure 12.8.8):

  1. learned per-pixel features replace raw RGB in the matching, so a match survives lighting changes and weak texture that would break brightness constancy on pixels, plus a separate context encoder of frame 1 that supplies the edge-aware regularization Horn–Schunck got from a smoothness prior;
  2. an all-pairs 4-D correlation (cost) volume: the cost volume from the previous section, computed between every pair of locations on the lower-resolution feature grids and pooled into a pyramid for cheap multi-scale lookup;
  3. a recurrent update operator (a GRU with shared weights) that iteratively refines the flow: at each step it looks up correlations at the current flow estimate and predicts an increment, which mimics an iterative optimizer, the unrolled cousin of the warp-then-refine loop from the last section, but with the update learned instead of derived.

The whole thing is differentiable and trained end-to-end. Two notes earn their place. First, flow got the deep-learning treatment relatively late because it is intrinsically non-local: a pixel can match anywhere in the other frame, which ordinary convolutions, with their small receptive fields, handle badly. The explicit cost volume is the inductive bias that makes non-local matching tractable, and it is no accident that RAFT keeps it. Second, ground-truth flow is hard to obtain for real scenes, so training leans on synthetic datasets such as FlyingChairs, FlyingThings3D Mayer et al. 2016 (FlyingThings3D) and Sintel Butler et al. 2012 (Sintel), real driving data such as KITTI Geiger, Lenz & Urtasun 2012 (KITTI) and on self-supervised warping losses that score a flow by how well it warps one frame onto the other.

This is exactly the part's lesson about learned methods: RAFT is the classical pipeline with its hand-crafted parts replaced by learned ones. The structure comes from the classical method, and the operators are learned from data. It is pointedly not a generic transformer that dissolved the structure into attention: its cost volume and recurrent update show how problem-specific structure can help a learned model solve non-local matching (the lineage runs FlowNet 2015 Dosovitskiy et al. 2015, the first convolutional neural network (CNN) flow → PWC-Net 2018 Sun et al. 2018, an explicitly pyramid + warping + cost-volume, "Lucas–Kanade-flavored" net → RAFT and its transformer variants).

And with a dense, automatic correspondence field finally in hand, the transport half of the part opens up: warp and interpolate between frames for slow-motion synthesis, stabilize, compress with motion-compensated prediction, magnify subtle motion, or lift the field to its three-dimensional cousins (scene flow, structure-from-motion). Correspondence first, then transport: the flow we just estimated is the correspondence, and the rest of this part spends it.

fig-raft-skeleton
Figure 12.8.8. RAFT: the classical pipeline, neuralized. (1) Learned features (a shared encoder) replace raw RGB for matching, with a separate context encoder of frame 1 for edge-aware regularization. (2) An all-pairs 4-D correlation volume precomputes similarity between every pair of pixels, pooled into a pyramid for multi-scale lookup. (3) A recurrent (GRU) update operator with shared weights iteratively refines the flow: each step looks up correlations at the current estimate and predicts an increment, acting as a learned iterative optimizer. The boxes line up one-to-one with the classical data term, cost volume, and warp-then-refine loop.

Recap: big lessons of this chapter

💡 Big lesson (L17, recurrence)

Correspondence first, then transport. The unifying move of this whole part: nearly every technique (1) estimates a correspondence (a coordinate map saying where each pixel came from) and then (2) transports the pixels along it by warping and resampling. The transport is one shared engine (Chapter 11.1, Warping); the correspondence is the hard, ill-posed part. Optical flow is the part's most general correspondence estimator: a dense, per-pixel map estimated automatically from two images, where a homography would be parametric and a morph field user-drawn. Here, the flow is the correspondence: the field $(u,v)$ is itself the coordinate map that morphing, frame interpolation, stabilization, and compression all transport along. Everything downstream of this chapter assumes you can produce it. This is the part's anchor for L17 (registered in Matching pixels across space and time; it recurs across the part).