Optical flow is the pattern of apparent motion of image objects between two consecutive frames caused by the relative movement between a scene and an observer (camera). It is a 2D vector field where each vector is a displacement vector showing the movement of a point from the first frame to the second. This technique is fundamental for motion estimation, object tracking, and scene understanding in video sequences, providing dense, per-pixel motion information without requiring object detection.
Glossary
Optical Flow

What is Optical Flow?
A core technique in computer vision for estimating motion between consecutive image frames.
In TinyML and sensor data processing, efficient optical flow algorithms like Lucas-Kanade or Farnebäck are crucial for real-time analysis on resource-constrained devices. These algorithms enable applications like visual odometry for robotics, gesture recognition, and video compression by calculating motion vectors. The computational challenge lies in balancing accuracy with the severe memory, power, and processing constraints of microcontrollers and edge devices, often requiring optimized, fixed-point implementations.
Key Optical Flow Algorithms
Optical flow algorithms estimate the motion of pixels between consecutive image frames. The following core methods represent the evolution from classical, mathematically rigorous approaches to modern, data-driven deep learning solutions.
Phase-Based Methods
Phase-based optical flow techniques exploit the fact that the phase component of a bandpass-filtered image contains motion information. Motion is estimated by analyzing the phase shift over time in the output of a set of filters, such as Gabor filters or within a complex steerable pyramid.
- Core Principle: Motion is seen as a translation of local phase.
- Advantages: Highly robust to changes in illumination and contrast, as these affect amplitude more than phase.
- Output: Can produce very smooth, sub-pixel accurate flow fields.
- Applications: Often used in medical imaging and fluid motion analysis where classic brightness constancy fails.
Algorithm Comparison for Embedded Deployment
Comparison of classical and learning-based optical flow algorithms for deployment on microcontrollers, focusing on computational cost, memory footprint, and accuracy trade-offs.
| Feature / Metric | Lucas-Kanade (Classical) | Farneback (Classical) | FlowNet2-S (Deep Learning) | RAFT-Small (Deep Learning) |
|---|---|---|---|---|
Algorithm Type | Local, gradient-based | Dense, polynomial expansion | Convolutional neural network | Recurrent all-pairs field |
Output Density | Sparse (feature points) | Dense (per-pixel) | Dense (per-pixel) | Dense (per-pixel) |
Typical Model Size | N/A (algorithmic) | N/A (algorithmic) | ~160 MB (FP32) | ~5 MB (INT8 quantized) |
Peak RAM Usage | < 50 KB | ~200-500 KB |
| ~2-5 MB |
Inference Latency (QVGA @ 30 FPS) | < 1 ms | 10-50 ms |
| 50-100 ms (NPU accelerated) |
Power Consumption (Estimate) | ~1-5 mW | ~10-50 mW |
| ~20-80 mW |
Accuracy (Sintel Clean EPE) | High (on tracked points) | Medium | Very High | High |
Robustness to Lighting Changes | Low | Medium | High | High |
Requires Training Data | ||||
Suitable MCU Class | Ultra-low-power (Cortex-M0+) | Low-power (Cortex-M4) | High-end MPU / CPU | Mid-range with NPU (Cortex-M55, Ethos-U55) |
Deployment Framework | Hand-coded C, CMSIS-DSP | OpenCV (lite), hand-coded | TensorFlow Lite, PyTorch Mobile | TensorFlow Lite Micro, TVM |
Frequently Asked Questions
Optical flow is a core computer vision technique for estimating the motion of objects, surfaces, and edges in a visual scene. These questions address its fundamental principles, applications, and implementation challenges, particularly in resource-constrained environments.
Optical flow is the pattern of apparent motion of image objects between two consecutive frames caused by the relative movement between a camera and the scene. It works by estimating a motion vector field where each vector represents the displacement of a pixel or feature from one frame to the next. Core algorithms like Lucas-Kanade (a sparse, feature-based method) or Farnebäck (a dense, gradient-based method) solve this by assuming brightness constancy and small, smooth motion between frames. The process involves calculating spatial and temporal image gradients to solve for pixel velocity, effectively tracking how patterns of intensity move over time.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Optical flow is a foundational technique in computer vision for motion analysis. These related concepts are essential for understanding its implementation, especially in resource-constrained, real-time systems.
Feature Tracking
Feature tracking is a sparse method for estimating motion by following distinctive points (e.g., corners, edges) across consecutive video frames. Unlike dense optical flow, which computes a vector for every pixel, feature tracking focuses on a subset of salient features, making it computationally efficient.
- Key Algorithms: Kanade-Lucas-Tomasi (KLT) tracker.
- Use Case: Ideal for visual odometry and object tracking in robotics, where processing power is limited.
- Trade-off: Provides motion data only at feature points, not a complete flow field.
Visual Odometry
Visual odometry is the process of estimating the ego-motion of an agent (like a robot or vehicle) by analyzing the motion of visual features or optical flow from a camera. It is a core technique for autonomous navigation and SLAM (Simultaneous Localization and Mapping).
- Input: Often uses optical flow or feature tracks as its primary input.
- Challenge: Must be robust to drift over time, often requiring loop closure detection.
- Application: Essential for drones, autonomous vehicles, and AR/VR systems to understand their movement in 3D space.
Motion Estimation
Motion estimation is the broader computational problem of determining the movement of objects or the camera between frames. Optical flow is one specific technique for solving motion estimation, typically assuming brightness constancy and small displacements.
- Other Methods: Includes block-matching algorithms (used heavily in video compression standards like H.264/AVC and HEVC).
- Context: In video codecs, motion estimation finds redundant areas between frames to enable high compression ratios.
- Differentiation: While optical flow yields a per-pixel velocity field, general motion estimation may produce parametric models (e.g., affine, projective transformations) for entire regions.
Lucas-Kanade Method
The Lucas-Kanade method is a widely used differential algorithm for computing optical flow. It assumes that the flow is essentially constant in a local neighborhood of the pixel being examined and solves the basic optical flow equations using the least squares criterion.
- Core Assumption: Brightness constancy and small, smooth motion within a local window.
- Efficiency: Its localized nature makes it suitable for real-time and embedded implementations.
- Limitation: Cannot compute flow in uniform texture regions (the 'aperture problem'). It is often applied in a pyramidal framework (Lucas-Kanade in a Gaussian pyramid) to handle larger motions.
Horn-Schunck Method
The Horn-Schunck method is a global, variational approach to optical flow estimation. It introduces a smoothness constraint that assumes neighboring pixels have similar velocity vectors, creating a dense, smoothly varying flow field across the entire image.
- Global Optimization: Minimizes an energy function combining a data term (brightness constancy) and a regularization term (smoothness).
- Output: Produces a dense flow field, even in regions with little texture.
- Computational Cost: More computationally intensive than local methods like Lucas-Kanade, as it requires solving a large system of equations. Often used in offline processing or where flow smoothness is critical.
Farneback's Algorithm
Farneback's algorithm is a dense optical flow technique that models the neighborhoods of two frames using polynomial expansion. By observing how these polynomials transform, it computes a dense displacement field. It is known for its robustness and accuracy.
- Dense Output: Computes a flow vector for every pixel.
- Performance: More accurate than simpler differential methods but also more computationally demanding. Implementations in libraries like OpenCV are highly optimized.
- Typical Use: Used in applications requiring high-quality dense flow, such as video stabilization, action recognition, and advanced driver-assistance systems (ADAS).

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us