Optical Flow plus Scene Flow Guide
Track where each pixel went, then lift that motion into 3D. Optical flow is the 2D shift; scene flow adds depth change to make it 3D.
Why Does This Exist?
Optical flow tells a car that pixels moved, but not whether the object approaches or just slides sideways. Scene flow exists to answer in meters: combine 2D flow with depth change from stereo, RGB-D, or lidar into a 3D vector per point. This overview separates the two so later pages can specialize.
Classical 2D methods start at optical flow; learned 2D models are FlowNet, PWC-Net, RAFT, and GMFlow. The 3D page is scene flow estimation.
Think of It Like This
Shadows versus real steps
Watch a puppet shadow slide across a wall: direction is clear but distance is not. Step into the room and see the puppet stride forward half a meter while sliding sideways: that full stride is the truth.
Shadows are optical flow and strides are scene flow. The analogy stops at density: shadows cover walls while scene flow needs depth everywhere, which is often missing.
How It Actually Works
Optical flow obeys brightness constancy with one equation for two unknowns, resolved by local windows or global smoothness. Scene flow adds depth rate: with depth and intrinsics , the 3D velocity is . Stereo scene flow solves flow plus disparity change together; RGB-D reads from the sensor; lidar scene flow registers clouds. Endpoint error scores 2D; 3D error adds .
Worked numbers
A pixel shifts px with m, px, and depth change m per frame (approaching). Then m, , m. Endpoint error against prediction is px.
Code
def scene_velocity(u: float, v: float, z: float, f: float, dz: float) -> tuple[float, float, float]: return (z * u / f, z * v / f, dz) # lift 2D flow plus depth rate to 3D
print(scene_velocity(5.0, 0.0, 6.0, 600.0, -0.3)) # -> (0.05, 0.0, -0.3)Watch Out For
Reading flow as 3D speed
Large 2D flow can mean a near object creeping or a far object racing; without depth the two are identical. The symptom is emergency braking for distant trucks. Always multiply by depth over focal length before acting on flow magnitude.
The Quick Version
- Optical flow is 2D pixel shift between frames.
- Scene flow is 3D velocity in meters.
- Depth plus flow lifts 2D into 3D through scaling.
- Endpoint error scores 2D; add depth-rate error for 3D.
- A px shift at m with m approach is the reference case.
- Flow without depth cannot separate near-slow from far-fast.