If feature detection is the process of deciding "where in the image to use as a landmark," feature tracking is the process of finding "where that landmark moved to in the next frame." Stable tracking lets you estimate camera motion, object velocity, or a robot's self-localization. Conversely, getting a single correspondence wrong can cause the subsequent pose estimate and map to collapse all at once. This article treats the difference between detectors and descriptors as given, and handles both local optimization of pixel motion and descriptor matching as a single design problem.

0. 30-Second Summary

1. Why Points on the Image Appear to Move

Feature points linked by motion arrows between the previous and current frames

Figure 1 — A correspondence is a hypothesis until its motion agrees with neighboring points and the camera model. Spatial coverage matters as much as the raw match count.

A 3D point X projects to \mathbf{x}=(x,y) on the image under camera motion. With frame interval \Delta t, the goal of tracking is to find the displacement \mathbf{d}_k in

\mathbf{x}_{k+1}=\mathbf{x}_k+\mathbf{d}_k

When the camera translates, apparent speed varies with depth; when it rotates, the whole image flows in the same direction. Simply subtracting consecutive images is fragile against lighting change and exposure noise, so local patch structure is used instead.

2. Lucas–Kanade: Solving a Small Window All at Once

The brightness-constancy assumption is

I(x,y,t)=I(x+u,y+v,t+\Delta t)

Linearizing for small displacement (u,v) gives the optical-flow constraint equation

I_xu+I_yv+I_t=0

At a single pixel, this is one equation for two unknowns (the aperture problem). So the pixels within a window W are pooled, and least squares

\begin{bmatrix}u\\v\end{bmatrix} =-\left(\sum_{W}w\begin{bmatrix}I_x^2&I_xI_y\\I_xI_y&I_y^2\end{bmatrix}\right)^{-1} \sum_Ww\begin{bmatrix}I_xI_t\\I_yI_t\end{bmatrix}

is solved. The bracketed term is the feature point's local structure matrix — the more gradient there is in two directions, at a corner, the more stably invertible it is. On a flat wall or a single edge, motion can't be uniquely determined.

To handle large displacements, the displacement is propagated from the coarse level of a downscaled pyramid down to the fine level. At each level, several iterations are run before recomputing at the next position. In implementation, you tune pyramid depth, window size, termination criteria, minimum eigenvalue, and forward-backward tracking error.

3. Choosing Between This and Descriptor Matching

Descriptors like ORB or SIFT convert the surrounding patch into a vector or bit string, and take the closest-distance candidate as the correspondence. For small motion between consecutive frames, Lucas–Kanade is fast, but descriptor re-matching becomes valuable when recovering from occlusion, skipping frames, or when the camera moves substantially.

Method Input Strengths Weaknesses Typical use
LK tracking Previous frame's point and next frame's image Fast, subpixel accuracy Weak to large displacement, occlusion, low texture VO, real-time tracking
ORB matching Descriptors from 2 images Lightweight, handles rotation Mismatches from reflection/blur SLAM initialization/re-search
SIFT matching Descriptors from 2 images Robust to scale/rotation Compute, memory SfM, image retrieval
Learning-based Points, descriptors, matcher Potentially robust to large appearance change Outside training data, GPU load Hard environments, research

Taking only the closest-distance descriptor candidate lets in mismatches from similar patterns. Requiring d_1/d_2<\tau (the ratio test) between the nearest distance d_1 and the second-nearest d_2, and further checking mutual nearest neighbors from A→B and B→A, helps. Finally, verify with RANSAC using the reprojection error of a fundamental matrix, homography, or PnP estimated from the correspondences.

4. Quantifying Tracking Confidence

In implementation, judging "tracking succeeded" as merely "a point was returned" isn't enough. Logging the following lets you isolate the cause of a breakdown:

Even with a high RANSAC inlier ratio, if all points cluster in one corner of the image, pose estimation degenerates. Capping the maximum point count per grid cell and spreading feature points across the whole field of view improves the observability of rotation and translation. Sometimes keeping a small number of correspondences spread across different directions and distances is better than simply increasing point count.

5. Moving Objects and Rolling Shutter

Visual Odometry assumes a static environment to estimate camera motion. When many pedestrians, cars, or a spinning fan appear in frame, their correspondences become outliers inconsistent with the camera-motion model. When there are too many dynamic objects for RANSAC alone to remove, combine semantic masking, optical-flow clustering, background modeling, and depth consistency.

A CMOS camera's rolling shutter exposes the image row by row, from top to bottom, at slightly different times. Under fast rotation or vibration, camera pose changes row by row even within a single frame, breaking the assumption of a single projection model. Mitigations include row-timing correction using IMU angular velocity, global shutter, short exposure, and calibrating the readout time.

6. Flow of a Minimal Implementation

  1. Calibrate the camera together with intrinsics, distortion, and timestamps.
  2. Detect FAST/ORB or Shi–Tomasi in the initial frame, and equalize spatially via a grid.
  3. On each new frame, track with pyramidal LK, checking forward-backward error and image boundaries.
  4. Discard low-confidence points, and detect new points in under-populated grid cells.
  5. Run descriptor matching at the necessary interval, removing outliers with RANSAC.
  6. Pass the remaining correspondences to an Essential Matrix, PnP, or IMU fusion step.
  7. If points are lost continuously, re-initialize, and log the tracking state and cause.

7. Conclusion

Feature tracking is a technology that treats detector, local optimization, descriptor matching, and geometric verification as a single confidence-design problem. LK smoothly links consecutive frames, descriptors recover from large changes, and RANSAC sieves out mismatches geometrically. Rather than depending on any single one of these, keeping logs that include point distribution, time synchronization, dynamic objects, and rolling shutter substantially improves the reproducibility of Visual SLAM and VIO.

References

#Feature Tracking #Lucas-Kanade #Optical Flow #RANSAC #Visual Odometry