Inferensys

Glossary

Optical Flow

Optical flow is the pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between an observer (camera) and the scene.
Engineer deploying small language model to edge device, IoT sensor visible on desk, technical hardware setup in bright workspace.
COMPUTER VISION

What is Optical Flow?

A core technique in computer vision for estimating motion between consecutive image frames.

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.

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.

COMPUTER VISION

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.

06

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.
OPTICAL FLOW

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 / MetricLucas-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

100 MB

~2-5 MB

Inference Latency (QVGA @ 30 FPS)

< 1 ms

10-50 ms

1000 ms (CPU)

50-100 ms (NPU accelerated)

Power Consumption (Estimate)

~1-5 mW

~10-50 mW

500 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

OPTICAL FLOW

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.

Prasad Kumkar

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.