What Is Optical Flow and How Does It Work?

Optical flow is the pattern of motion that sweeps across your view whenever you move or things around you move, like scenery streaming past a car window.1PubMed Central. Optic Flow: A History Because your own movement creates that pattern, it also tells you about that movement, so anything that can see it, a brain or a camera, can use it to work out how it is moving. The idea was first described for human vision around 1950 and now sits inside drones, video compression and phone cameras.1PubMed Central. Optic Flow: A History2IEEE Transactions on Image Processing. Optical Flow Based Co-Located Reference Frame for Video Compression Nobody can see the flow directly, though; it has to be worked out from how the light in one moment differs from the next, and that is where most of its quirks and failures come from.

What Optical Flow Actually Looks Like

The psychologist James Gibson argued that we read this motion from the changing pattern of light on the back of the eye.3Wikipedia. James J. Gibson You don’t need to recognize a single object to sense that you are moving; the shifting light carries that information by itself. Computers picture the result as a field of small arrows, one for every point in the image, each showing which way and how fast that spot appears to move.

Different movements make different shapes. Walking or driving forward makes the scene expand outward from the point you are heading toward, and that still center marks your direction of travel.4PubMed Central. Optical Flow-Based Obstacle Detection for Mid-Air Collision Avoidance Turning your head makes the whole scene slide sideways together, and tilting it makes the scene rotate. Nearby things stream past faster than distant ones, which is why fence posts blur while mountains barely move. Those speed differences are one of the cues that tell you how far away things are.

The arrows describe how things appear to move in the image, not how they move in the world. A stationary tree seems to rush past only because you are moving, and a car travelling alongside you at the same speed can produce almost no flow at all. That gap between apparent and real motion is why the flow has to be interpreted, by brains and software alike.

How a Computer Works Out Optical Flow

Nearly every method starts from one assumption: a point in the scene keeps the same brightness from one frame to the next, just in a new place.5British Machine Vision Conference. Robust Brightness Description for Computing Optical Flow That turns the job into finding where each patch of brightness moved to in the following frame.6University of Toronto. Optical Flow Estimation This works best for small movements, which is why many methods first shrink the images so that big jumps become small ones.7Intel Corporation. Pyramidal Implementation of the Lucas Kanade Feature Tracker

A single point isn’t enough, though. If you look at a tiny patch along a straight edge, you can only see motion across the edge, not along it.8CamelEdge. Unraveling Motion: A Deep Dive into Optical Flow in Computer Vision A small window therefore can’t tell the full direction an edge is moving.8CamelEdge. Unraveling Motion: A Deep Dive into Optical Flow in Computer Vision Every method has to borrow information from nearby points to fill in what one point can’t say.

The barber pole is a human version of this. Stripes on a spinning pole seem to climb upward even though the pole only rotates. Your brain sees just the stripes’ edges through the pole’s outline and guesses the motion, making the same mistake software makes when it looks at too small a window. Seeing more of the scene, like the end of a stripe, clears up the ambiguity.

There are two classic ways to borrow information. The Lucas-Kanade method assumes a small neighbourhood of pixels all move together and picks the single motion that fits them best.9Wikipedia. Lucas–Kanade method It only works where the patch has detail in more than one direction, such as a corner rather than a plain edge.7Intel Corporation. Pyramidal Implementation of the Lucas Kanade Feature Tracker The Horn-Schunck method instead looks at the whole image at once, balancing how well the brightness matches against how smoothly the motion varies.10Image Processing On Line. Horn–Schunck Optical Flow with a Multi-Scale Strategy One is a local approach and the other a global one, and many later methods mix the two ideas.11arXiv. Investigating Optical Flow Computation: From Local Methods to a Multiresolution Horn-Schunck Implementation with Bilinear Interpolation

A plain white wall shows no change at all when it moves, so no method can measure motion there. That is why trackers prefer textured scenes and struggle on smooth surfaces.

In practice, software takes two consecutive frames, often only a few hundredths of a second apart, and finds the big motions first on shrunken versions. It then refines the arrows on sharper versions until each pixel has a small, precise motion.

Tracking a Few Points or Every Pixel

Sparse flow follows a chosen set of distinctive points, while dense flow assigns a motion arrow to every pixel.2IEEE Transactions on Image Processing. Optical Flow Based Co-Located Reference Frame for Video Compression Dense flow can therefore capture complicated motion that a few tracked points would miss.2IEEE Transactions on Image Processing. Optical Flow Based Co-Located Reference Frame for Video Compression Tracking distinctive points, on the other hand, works well in clear, high-contrast scenes and struggles in dull, low-contrast ones with few features to latch onto.12PubMed Central. A Comparison of Dense and Sparse Optical Flow Techniques for Low-Resolution Aerial Thermal Imagery Some dense methods also run very well on hardware that does many small calculations at once, such as graphics chips.12PubMed Central. A Comparison of Dense and Sparse Optical Flow Techniques for Low-Resolution Aerial Thermal Imagery

Which one a device uses depends on the job. A drone holding steady over carpet often needs only a few tracked points to sense drift. Video editing tools that smooth slow motion need an arrow for every pixel. Driving and traffic cameras may use either, depending on what they need to detect. The choice trades speed and battery against detail.

Dense does not mean every arrow is measured equally well. Plain areas get arrows filled in from their neighbours rather than truly observed, so a dense map can look complete while being a guess in places.

How Neural Networks Learn Optical Flow

Since about 2015, networks trained on examples with known motion have been able to estimate flow directly from two frames.13arXiv. FlowNet: Learning Optical Flow with Convolutional Networks The older methods they replaced can be fragile and do poorly at the edges of objects.14Volume 2: Manufacturing Processes; Manufacturing Systems; Nano/Micro/Meso Manufacturing; Quality and Reliability. OF-NET: Deep-Learning Based Sub-Pixel Optical Flow Estimation With Multi-Scale Convolutional Neural Network An improved version of the early networks cut errors by more than half while running fast enough for live video.15IEEE Transactions on Pattern Analysis and Machine Intelligence. FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks A later, widely used design compares features of every pixel with every other pixel and refines its answer step by step.16arXiv. RAFT: Recurrent All-Pairs Field Transforms for Optical Flow

“Learning” here means the network is shown many pairs of frames along with the correct motion arrows, and it adjusts itself until its guesses match the correct answers. Much of the training uses computer-generated scenes, where the true motion is known exactly. The network still relies on the same basic idea of matching what looks alike between frames. Classic methods also remain in use on small, low-power chips where networks are too heavy.

Where Optical Flow Works in Everyday Technology

Drones can use flow from their cameras to track their own movement when GPS is unavailable, such as indoors.17Acta Universitatis Sapientiae, Electrical and Mechanical Engineering. A Review of Using Visual Odometery Methods in Autonomous UAV Navigation in GPS-Denied Environment A racing drone with a single camera used flow to dodge obstacles in cluttered places at up to 6 meters per second, about 13 mph.18arXiv. Seeing Through Pixel Motion: Learning Obstacle Avoidance from Optical Flow with One Camera Flow also helps separate motion caused by the camera’s own movement from things actually coming toward it.4PubMed Central. Optical Flow-Based Obstacle Detection for Mid-Air Collision Avoidance In simulated tests, a flow-based system spotted every incoming aircraft along its path.4PubMed Central. Optical Flow-Based Obstacle Detection for Mid-Air Collision Avoidance Several cameras pointing different ways give a better sense of the vehicle’s own movement than one.19IEEE Xplore. Ego-Motion Estimation Using Optical Flow Fields Observed from Multiple Cameras

Many small drones have a downward camera that watches the texture of the floor. If the floor pattern slides, the drone knows it is drifting and corrects. Over a blank, shiny or dark floor there is little to track, so the drone may drift.

Video compression works by describing how parts of a frame moved instead of storing each frame whole, using the same motion ideas.2IEEE Transactions on Image Processing. Optical Flow Based Co-Located Reference Frame for Video Compression More accurate motion estimates mean less data to send, which helps very low-bandwidth video.20ICASSP, IEEE International Conference on Acoustics, Speech and Signal Processing – Proceedings. Optical flow based motion compensation algorithm for very low bit-rate video coding Most of a frame in a video call barely changes from moment to moment, so the encoder sends motion arrows plus small corrections instead of full pictures. When you pan the camera or move fast, the motion becomes hard to predict and the call turns blocky.

Flow is also used to create in-between frames for smoother playback and to separate moving objects from the background.2IEEE Transactions on Image Processing. Optical Flow Based Co-Located Reference Frame for Video Compression On TVs and phones, software estimates arrows between two real frames and draws a new frame partway along them. This turns ordinary video into smoother or slower footage, and errors around moving edges create the warping or haloes people notice.

How Brains and Bees Use Optical Flow

One motion area at the side of the brain reacts about equally to any moving dots, even random ones.21PubMed. Sensitivity to optic flow in human cortical areas MT and MST The area just in front of it responds most to complex flow that mixes expansion, contraction and rotation, and less to simple sliding or random motion.21PubMed. Sensitivity to optic flow in human cortical areas MT and MST The brain, in other words, separates local motion from the overall flow pattern that signals self-motion.

Honeybees fly by holding flow steady. In a tunnel, they control speed by keeping the image motion seen by both eyes constant.22PubMed. Honeybee navigation en route to the goal: visual flight control and odometry They automatically slow down in narrow passages, where the walls stream past faster, which avoids collisions.22PubMed. Honeybee navigation en route to the goal: visual flight control and odometry When landing, bees keep the rate at which the surface seems to expand constant.23PubMed Central. A universal strategy for visually guided landing Their speed therefore drops gradually and reaches nearly zero at touchdown without measuring distance.22PubMed. Honeybee navigation en route to the goal: visual flight control and odometry23PubMed Central. A universal strategy for visually guided landing Engineers copy this rule in drones because it needs only a camera, not a distance sensor.

Flow shapes how we walk, too. On a treadmill with moving scenery, people walked faster when the scene flowed toward them and slower when it flowed backward.24PubMed. Visual influence on human locomotion. Modulation to changes in optic flow. They changed mainly stride length rather than step rate.24PubMed. Visual influence on human locomotion. Modulation to changes in optic flow. The effect faded by about 45% over 800 meters of walking.24PubMed. Visual influence on human locomotion. Modulation to changes in optic flow.

With little texture, there is little flow to read, and your brain loses one of its main signals for speed and direction. That is part of why driving in fog or snow makes speed hard to judge.

Why Optical Flow Goes Wrong

Regions of constant brightness, edges between moving objects and hidden areas all trip up standard methods.25IEEE Transactions on Pattern Analysis and Machine Intelligence. Multimodal Estimation of Discontinuous Optical Flow Using Markov Random Fields Very large movements between frames are also beyond simple methods.25IEEE Transactions on Pattern Analysis and Machine Intelligence. Multimodal Estimation of Discontinuous Optical Flow Using Markov Random Fields Methods assume motion is smooth, but at the boundary of an object it suddenly changes.26University of Utah Department of Computer Science Technical Report. Exploiting Discontinuities in Optical Flow Smoothing therefore tends to blur the motion at edges, mixing object and background.25IEEE Transactions on Pattern Analysis and Machine Intelligence. Multimodal Estimation of Discontinuous Optical Flow Using Markov Random Fields

The hardest case is when one object hides another, leaving areas with no valid motion to measure.25IEEE Transactions on Pattern Analysis and Machine Intelligence. Multimodal Estimation of Discontinuous Optical Flow Using Markov Random Fields Newer methods estimate which areas are hidden and fill them in from similar-looking nearby patches.27Computer Vision and Image Understanding. Aggregation of Local Parametric Candidates with Exemplar-based Occlusion Handling for Optical Flow

Everyday life supplies examples of each failure. A person walking in front of a door hides and reveals parts of it, creating holes in the flow. A sudden light change can look like motion because the brightness changed. A fast swing of a phone camera jumps too far between frames to match, and spinning wheels or repeating patterns can be matched to the wrong spot.

Why Moving Scenery Can Make You Feel Like You’re Moving

Watching flowing scenery can create a convincing feeling that you yourself are moving.28CHI Conference on Human Factors in Computing Systems. Mixing in Reverse Optical Flow to Mitigate Vection and Simulation Sickness in Virtual Reality It’s what happens when the train next to yours pulls away and you feel your own train moving. Adding a little jiggle or bob to the scene, like the head-bob of walking, makes the illusion stronger.29PubMed. Independent modulation of motion and vection aftereffects revealed by using coherent oscillation and random jitter in optic flow The bob only helps if it runs across the main direction of flow, not along it.30PubMed Central. Relative Visual Oscillation Can Facilitate Visually Induced Self-Motion Perception About 15 seconds of watching flow can briefly bias your balance sense in the opposite direction afterward, even in the dark.31PubMed. Optic flow induces nonvisual self-motion aftereffects

Much of the sense of self-motion comes from flow in peripheral vision. Big screens and headsets fill that area, which strengthens the illusion, while the same scene on a small phone rarely feels as real.

In VR, your eyes report motion while your inner-ear balance system reports stillness.28CHI Conference on Human Factors in Computing Systems. Mixing in Reverse Optical Flow to Mitigate Vection and Simulation Sickness in Virtual Reality This conflict is a main cause of simulator sickness.28CHI Conference on Human Factors in Computing Systems. Mixing in Reverse Optical Flow to Mitigate Vection and Simulation Sickness in Virtual Reality One tested approach mixes in a little reverse flow to weaken the illusion of moving and reduce sickness.28CHI Conference on Human Factors in Computing Systems. Mixing in Reverse Optical Flow to Mitigate Vection and Simulation Sickness in Virtual Reality

You can do something about it yourself. Use comfort settings that narrow the view during movement, which reduces peripheral flow, and prefer teleport-style movement over smooth gliding. Take breaks, since longer flow exposure builds stronger effects, and sit down so a lingering sense of motion doesn’t unsteady you afterward.

Optical Flow and Alzheimer’s Disease

About a third of people with Alzheimer’s had trouble telling the direction of expanding flow.32PubMed. Visual mechanisms of spatial disorientation in Alzheimer’s disease When only the overall pattern was left to judge, most people with Alzheimer’s (85%) and about 1 in 5 healthy older adults struggled.32PubMed. Visual mechanisms of spatial disorientation in Alzheimer’s disease Those with bigger flow problems tended to do worse on map-reading and on-the-road driving tests.32PubMed. Visual mechanisms of spatial disorientation in Alzheimer’s disease In early Alzheimer’s, people also had trouble judging their own movement when their eyes were moving.33PubMed Central. Disrupted pursuit compensation during self-motion perception in early Alzheimer’s disease Struggling with flow is not a diagnosis, since some healthy older adults show it too.

Cameras That See Only Change

An event camera doesn’t take frames; each pixel reports only when its brightness changes.34Neurocomputing. Event-based optical flow: Method categorisation and review of techniques that leverage deep learning These cameras respond within millionths of a second, handle very bright and dark scenes together, and use little power.34Neurocomputing. Event-based optical flow: Method categorisation and review of techniques that leverage deep learning They suffer far less motion blur, which suits fast drones and robots.34Neurocomputing. Event-based optical flow: Method categorisation and review of techniques that leverage deep learning Compact brain-like networks can estimate flow from them on low-power chips.35PubMed Central. Optical flow estimation from event-based cameras and spiking neural networks