Lucas-Kanade Optical Flow

Machine Learning
Introduced by
Bruce Lucas and Takeo Kanade
Year
1981
Type
Optical flow and tracking
Family
Motion estimation

What does it do?

The Lucas-Kanade method, introduced by Bruce Lucas and Takeo Kanade in 1981, estimates optical flow, the apparent motion of image content between frames.

It was presented as an iterative image registration technique with an application to stereo vision. Applied to a set of feature points, it returns a motion vector for each point and is used for tracking and motion analysis in video.

The intuition behind the method

Optical flow asks how image content moved between two consecutive frames. The Lucas-Kanade method assumes brightness constancy: a point with intensity I(x, y, t) moves to (x+u, y+v) in the next frame with the same intensity, so I(x+u, y+v, t+1) is approximately I(x, y, t). A first-order Taylor expansion turns this into one linear equation per pixel relating (u, v) to the local spatial and temporal gradients. Each pixel supplies only one constraint, so the method pools the equations from a small window around a feature. The pooled system determines (u, v) only when it is well conditioned, which in practice requires gradients pointing in at least two clearly different directions. If the window contains a single edge orientation, or one direction with negligible gradient, the motion is ambiguous (the aperture problem). The method is sparse: it solves for motion at detected feature points, not at every pixel.

History

Lucas and Kanade introduced the method in 1981, presenting it as an iterative image registration technique with an application to stereo vision. It combines the brightness constancy assumption with a local least-squares fit over a window. The pyramidal (coarse-to-fine) implementation is described in Bouguet's OpenCV documentation, not in a peer-reviewed article.

When to use it

Choose Lucas-Kanade when the question concerns the motion of a limited set of well-defined points, such as corners or markers, across video frames, and when displacements between frames are small to moderate. It suits feature tracking and camera or object motion estimation where computation should be kept low. Avoid it for large or discontinuous motion, such as fast movement or occlusions that the window cannot follow. Avoid it when a flow value is needed at every pixel, or when the region of interest is textureless, where dense methods that use regularisation to fill in uniform areas, such as Horn-Schunck, or learning-based flow estimators are more appropriate. It is also a poor choice when brightness changes markedly between frames, unless the intensities are preprocessed.

Limitations and considerations

  • Brightness constancy is assumed. Changes in illumination, shadows or specular reflections alter the intensities from which the gradients are computed, which biases the estimated flow.
  • The first-order Taylor linearisation holds only for small displacements within the window. Larger motion violates it unless a coarse-to-fine scheme is used.
  • Motion is recoverable only where M is well conditioned. In a window containing a single edge orientation, M is nearly singular: only the motion component across the edge can be recovered, and motion along the edge is undetermined (the aperture problem). Uniform regions give no constraint at all.
  • The output is sparse. Flow is available only at detected features and does not describe the motion of the rest of the scene.
  • Occlusion and disocclusion break the assumption that a feature persists between frames, so the estimate is undefined or misleading at those points.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Each linearised step requires solving only a 2x2 linear system per feature, which keeps computation low when a few points are tracked.
  • The least-squares solution is a real-valued displacement vector rather than an integer pixel shift.
  • Features are tracked directly from intensity gradients, so no separate descriptor-matching step is needed between frames.
  • Pooling constraints over a window reduces the influence of noise at any single pixel. Combined with a coarse-to-fine pyramid, as in Bouguet's implementation, it can handle larger motions than a single-scale version.
  • Its assumptions (brightness constancy, locally uniform motion, small displacement) are explicit, so a failure can be linked to a specific violated assumption.

Applications

  • Video object tracking: following features (corners, markers) across video frames for motion analysis
  • Visual odometry: estimating camera motion from optical flow in robotic navigation
  • 3D reconstruction: using optical flow correspondences to compute camera pose and depth
  • Motion-based segmentation: identifying moving objects by clustering optical flow vectors
  • Action recognition in video: computing motion patterns for activity classification

How it works

How it works

1

Detect feature points, such as Harris corners, in the first frame. Choose the size of the local window around each feature that will be used to pool the flow equations.

2

The method has no trained parameters, so nothing is learned from data. For each feature, compute the spatial gradients Ix and Iy and the temporal intensity change It between the two frames, and collect these values over the window to form the linear constraints.

3

For each feature, sum the gradient products over the window around it to form the 2x2 matrix M. Its diagonal terms are sum(Ix^2) and sum(Iy^2), and its off-diagonal term is sum(IxIy). Solve M [u v]^T = -[sum(IxIt), sum(IyIt)]^T for the displacement (u, v). Because the linearisation is only approximate, the estimate can be refined by repeating the solve, consistent with the iterative formulation named in the original paper's title.

4

No ground-truth feature position is available at run time, so this step is a consistency check rather than a comparison with known answers. Useful checks include the conditioning of M, the residual of the linear solve, and whether a feature tracked forward to the next frame and back again returns close to its starting position. A nearly singular M signals an ambiguous window: this is the case when the smaller eigenvalue of M is small relative to the larger one, meaning the window has little gradient in one direction. A feature is also unreliable when its forward-backward return error is large relative to the window size. Unreliable features are discarded or re-detected.

Common pitfalls

  • Applying the method to arbitrary pixels rather than to features detected for their texture. Many pixels have a poorly conditioned system, and their flow estimates are unreliable.
  • Choosing a window that is too small increases sensitivity to noise. Choosing one that is too large mixes motion from regions that move differently and reduces localisation accuracy.
  • Feeding frames with changing illumination without preprocessing. The violated brightness constancy assumption produces systematic drift in the estimates.
  • Accumulating errors over long sequences. If each frame's estimate is propagated, small errors compound, so features need periodic re-detection and consistency checks.

Frequently asked questions

What is the brightness constancy assumption and why might it fail?

The brightness constancy assumption states that a point keeps its intensity as it moves: I(x, y, t) = I(x+u, y+v, t+1). It fails when illumination changes, through shadows or reflections, and when occlusion reveals surfaces that were not visible in the previous frame. Normalising intensities in preprocessing can reduce some lighting effects, but it does not remove changes caused by shading or occlusion.

What is the aperture problem and how does Lucas-Kanade address it?

The aperture problem arises when a window sees only one edge orientation: motion along the edge leaves the local image unchanged, so that component cannot be determined. Lucas-Kanade pools gradients over the window. The 2x2 system determines both components of the motion only when it is well conditioned, which generally requires gradients in at least two clearly different directions. If one of those gradients is weak, the estimate remains unreliable even though a second direction is present.

How does pyramidal Lucas-Kanade handle large motions?

The pyramidal implementation builds a sequence of progressively smaller copies of each image. Flow is estimated at the coarsest level, where a large motion appears small, and the estimate is propagated to finer levels for refinement. This addresses the small-motion limitation, but it recovers only motion that is small at some level of the pyramid, and the method remains local.

Why is Lucas-Kanade called 'sparse' optical flow?

Lucas-Kanade estimates motion only at detected feature points (corners, edges), not at every pixel. This sparsity makes computation efficient and gives motion vectors at interest points. Dense optical flow methods (Horn-Schunck, modern learning-based methods) estimate motion at every pixel, providing complete flow fields at higher computational cost.

Related methods

Sources

  1. Lucas, B. D., & Kanade, T. (1981). An iterative image registration technique with an application to stereo vision. Proceedings of the Seventh International Joint Conference on Artificial Intelligence (IJCAI), 674–679.

    Open publication reference
  2. Bouguet, J. Y. (2001). Pyramidal implementation of the Lucas Kanade feature tracker. OpenCV Documentation.

    Open publication reference