AI Glossary / Computer vision and multimodal AI / Intermediate
Optical flow
Definition
Optical flow is the apparent movement of visual patterns across an image sequence, commonly represented by a two-dimensional vector at each estimated location. It describes image motion, which can arise from moving objects, a moving camera or changes in the appearance of the scene.
What it means
A flow vector links an image location to an estimated corresponding location in another frame. A sparse method estimates movement at selected points; a dense method attempts an estimate across the image. The vectors may represent displacement between frames or velocity, depending on the method and units.
Optical flow is not automatically the physical velocity of an object in the world. Camera motion, perspective and depth affect what appears on the image plane. A scene point can move in three dimensions while its projection hardly changes, and changing reflections can create apparent movement without the corresponding surface motion.
The result is therefore an estimate based on image evidence and modeling assumptions. Its usefulness depends on where those assumptions hold and how uncertainty is handled.
How it works
Many classical methods begin with brightness constancy: a moving scene pattern is assumed to keep approximately the same intensity between nearby frames. A small-motion approximation leads to the constraint Ix × u + Iy × v + It = 0, where the I terms are image derivatives and u and v are image velocities.
One such equation has two unknown motion components. Additional information is needed. Lucas - Kanade combines local constraints under a shared-motion assumption; other methods add smoothness or learned relationships. Image pyramids can help handle movement that is large at the original resolution.
Occlusion creates locations with no visible counterpart in the next frame. Flat areas provide weak information, while a straight edge can leave motion along the edge ambiguous. A dense field may still contain vectors there, but their existence does not prove the image evidence uniquely supports them.
Three practical examples
- A video-stabilization workflow estimates image movement and separates a camera-motion model from residual local movement.
- A sports-analysis experiment uses flow to describe movement patterns, while a separate process identifies players and interprets actions.
- A frame-interpolation system uses estimated correspondences to help construct intermediate views, with special treatment needed where objects uncover or hide regions.
Think of it this way
Think of watching marks slide across a window. You can measure their apparent movement on the glass without knowing exactly how far away the marked objects are or whether you are moving too.
The analogy is limited because a camera records changing light patterns, not permanent marks attached to the image plane. Shadows, reflections and missing visibility can make correspondences uncertain.
Worked example
Converting displacement into image velocity
Suppose a tracked feature is estimated at pixel coordinates (100, 50) in one frame and (104, 47) in the next. Using coordinates that increase rightward and downward, the displacement is (4, -3) pixels: four right and three up. Its magnitude is 5 pixels.
If the actual interval between these frames is 0.02 seconds, the image velocity is (200, -150) pixels per second, with magnitude 250 pixels per second. This calculation uses the measured interval; a nominal frame-rate label can be misleading if frames were dropped or timing is irregular.
It does not yet give meters per second. That conversion needs suitable geometry and calibration, including the relevant depth or an appropriate planar mapping.
A separate constraint example illustrates ambiguity. If Ix = 2, Iy = 0 and It = -6, the brightness equation requires 2u - 6 = 0, so u = 3. It places no constraint on v. Additional evidence or assumptions must determine the second component. Reporting a complete vector without recognizing that limitation can overstate what a local patch reveals.
Illustrative case study
Illustrative case study - fictional
A fictional workshop studies a short conveyor video. A flow visualization shows movement across most of the frame, including the supposedly stationary background. Review reveals that the camera mount vibrated during recording.
The team compares background features to estimate the common image movement, then examines residual movement near the conveyor. It also marks regions where reflective packaging produces unstable estimates.
The revised analysis keeps image displacement separate from physical speed and uses a calibration procedure for the latter. The case illustrates interpretation of flow, not a validated measurement system or a claim that background subtraction always resolves camera motion.
Common misconceptions and mistakes
- Optical flow is not identical to three-dimensional scene flow or a physical motion field. It describes apparent image movement.
- A vector at every pixel does not mean every vector is equally reliable. Some may be driven mainly by model assumptions.
- Brightness constancy is an assumption used by many methods, not a universal law of video.
- Flow alone does not identify an object or explain its intention. Recognition and interpretation require additional steps.
- Pixels per frame, pixels per second and meters per second are different units. Conversions need the appropriate timing and geometry.
Business use
Businesses may use optical flow within video enhancement, motion analysis and automated inspection. It is a useful component when the task depends on how image content changes over time.
Evaluate the complete workflow using relevant lighting, motion blur, occlusion and camera movement. If a measurement matters, compare it with independent reference measurements. Preserve frame timing and coordinate conventions in the result. For qualitative visualizations, make clear whether arrows show sparse tracked points, dense estimates or a fitted camera-motion model; those are different representations.
People also ask
Does optical flow require a neural network?
No. Classical optimization and local estimation methods exist alongside learned approaches.
Can it distinguish camera movement from object movement automatically?
Not from the term alone. A larger method must model or use additional evidence to separate those causes.
Why are corners often easier to track than a long straight edge?
A corner contains intensity variation in multiple directions, providing more information about both displacement components. A straight edge may constrain mainly movement across the edge.
Check your understanding
A point moves 5 pixels between frames separated by 0.02 seconds. Is its physical speed necessarily 250 meters per second?
Answer: No. The apparent speed is 250 pixels per second. Physical units require appropriate scene geometry and calibration.
Related terms
- Motion field
- Motion vector
- Lucas–Kanade method
- aperture problem
- scene flow
- video stabilisation
Learn next
Track a few visible corners in a short sequence with a stationary camera, then repeat while moving the camera. Calculate displacement using actual timestamps and inspect occluded or textureless areas separately. Avoid interpreting arrow length as physical speed without calibration.
More in Computer vision and multimodal AI
- Object co-segmentation - Object co-segmentation identifies and separates object regions that are shared across two or more images by analyzing the images together.
- Object recognition - Object recognition is the process of identifying what an object is from visual information, such as an image or video.
- Open set recognition - Open set recognition is a recognition setting in which a system must identify supported classes while allowing inputs from previously unseen classes to be...
- Optimal transport - Optimal transport is a mathematical framework for finding the least costly way to redistribute one distribution of mass into another, according to a...
- Oriented projective geometry - Oriented projective geometry is a form of projective geometry that retains a distinction between opposite homogeneous directions.
- Orthographic projection - Orthographic projection maps three-dimensional points onto a plane along parallel lines perpendicular to that plane.
Sources
Sources: OpenCV, Optical Flow tutorial: https://docs.opencv.org/4.13.0/d4/dee/tutorial_optical_flow.html ; MathWorks, Optical Flow overview: https://www.mathworks.com/discovery/optical-flow.html . Relevant explanations of flow, classical constraints, sparse and dense estimation were reviewed. Numerical examples are illustrative.
Previous: Optical braille recognition Next: Optical Multi-Tree with Shuffle Exchange