Booting Python + NumPy (Pyodide)…
Every panel runs the real hand-written module (kalman.py, assignment.py, nms.py, stereo_match.py) in your browser.
First principles · real NumPy

Algorithms From Scratch

The classic building blocks of a tracking pipeline, each hand-written and tested against a reference, then run live here: a Kalman filter, the Hungarian assignment algorithm, non-max suppression and block-matching stereo.

① Kalman filter: tracking through noise

A true path (grey) is seen only through noisy measurements (red dots). The Kalman estimate (and its ±2σ uncertainty band) is recovered by kalman.py. More measurement noise → trust the model more; more process noise → trust the data more.
…

② Hungarian algorithm: optimal assignment

Edit the cost matrix (rows = tracks, cols = detections). assignment.py finds the assignment with the minimum total cost, highlighted. Compare it to greedy "cheapest pair first".
…
Click any cell to edit. Highlighted = the optimal assignment.

③ Non-max suppression: one box per object

A detector fires many overlapping boxes per object. nms.py keeps the highest-scoring box and suppresses its duplicates. Slide the IoU threshold; kept vs suppressed.
…

④ Block-matching stereo: disparity from a pair

For each pixel, stereo_match.py slides a window along the row of the other image to find the shift that matches best: the disparity (→ depth). The closer square shows a larger shift.
left
right
recovered disparity
…

Things to notice

Tuning trades lag vs jitter

Crank process noise and the estimate snaps to the data but jitters; drop it and it's silky but lags fast or accelerating paths. A constant-velocity model can never have both.

Process vs measurement noise

Greedy isn't optimal

Edit the matrix until "cheapest pair first" boxes itself in: grabbing one bargain can force two expensive leftovers. The Hungarian algorithm minimises the total, not each step.

Why greedy loses

One box per object

Low IoU threshold and it over-merges (one box for two objects); high and duplicates survive. The sweet spot keeps exactly one box per real object.

What IoU measures

Bigger window, blurrier depth

Large blocks match reliably but smear edges and fine detail; small blocks are sharp but noisy. The disparity map's crispness rides on that block-size trade-off.

The block-size trade-off