← All work
AcademicJanuary to February 2026ENSTA (Brest Campus), video project

Optical Flow Motion Tracker

A real-time webcam demonstrator that detects and tracks moving objects, built on the classic Horn–Schunck method.

Real timeon a live webcam feed
10pipeline stages, from capture to display
Multi-objecttracking with stabilised boxes

The need

Tracking objects in video underpins surveillance, robotics and driver assistance. This project asks how far motion alone can go, with no trained model, by implementing a foundational method from its mathematics up to a live demo.

What I owned

The method, the implementation and the demonstrator, in a team of three.

The solution

The tracking problem becomes motion detection between two consecutive frames. From the flow field, the system derives direction and speed, then a motion mask, then regions and boxes.

Capture
WebcamGreyscale and Gaussian blur
Flow
Horn–Schunck (u, v)Motion magnitude
Mask
Threshold calibrated over 30 framesMorphological cleanup
Track
Connected componentsBox smoothing and persistence
Display
Flow arrowsBoxesMask window
The demonstrator's pipeline, from webcam to display.
Our Horn-Schunck notebook: the arrows show where people move between two consecutive frames.

How it was built

Horn–Schunck assumes a point keeps its brightness as it moves, which alone leaves one equation for two unknowns. A smoothness term resolves this by assuming neighbouring points move alike. The resulting energy is minimised through an iterative scheme, which we implemented directly in Python.

A threshold calibrated over the first frames adapts the motion mask to the current scene, while box smoothing and persistence keep tracking stable when detections flicker.

The two consecutive frames used as input for the result above.
Motion vectors on a moving person, a literature example from our presentation.
Moving objects isolated in traffic scenes, a literature example from our presentation.

Results

  • A working real-time demonstrator for motion detection and multi-object tracking.
  • Strong results for rigid objects with clear edges and slow to moderate motion.