Block-matching motion estimation, the core of every video encoder: every 16×16 block is searched ±12 px in the previous frame, 576 million pixel comparisons per 720p frame. From the vectors: vehicle speed per lane, zones you can arm or ignore, and an event log. Plain Kotlin, compiled to WebGPU by Kernelin.
Plain frame differencing alarms on swaying trees, rain and light changes. Motion vectors know direction and speed: leaves wiggle in place, cars travel. In the test scene the tree raises 0 false detections.
The same vectors give vehicle speed per lane (here within 6% of the truth) and wrong-way detection: the analytics traffic departments buy dedicated hardware for.
576 million comparisons per frame, 30 times a second, is 17 billion per second. One CPU core manages about one frame per second; the GPU keeps up with live video.
loading…