Optical flow & motion
Before we begin
Optical flow estimates how each pixel moves between consecutive video frames — a 2D motion field .
Learning objectives
- State the brightness constancy assumption.
- Contrast Lucas–Kanade (local) vs Horn–Schunck (global).
- Know when flow fails (occlusion, lighting, lack of texture).
- Read a color-wheel flow visualization.
Brightness constancy
Linearize → optical flow constraint .
One equation, two unknowns — aperture problem. Need a window (LK) or smoothness prior (HS).
Lucas–Kanade
Assume constant flow in a small patch. Stack equations for pixels in window → least squares for .
Works on textured patches; fails on uniform regions.
Dense flow
Modern networks (RAFT, PWC-Net) predict dense flow end-to-end — state of the art on benchmarks.
Classical Farneback in OpenCV: cv2.calcOpticalFlowFarneback.
Motion boundaries
Different objects move differently — flow discontinuities at edges. Layered motion and segmentation-aware flow handle mixed scenes.