AppStars

Our R&D, 2012

A computer vision lap timer for remote-control cars.

A Windows app that watched an RC car track through one PlayStation 3 Eye camera, worked out which car had just crossed the line by its colour, and spoke the lap time aloud. It used classical computer vision, background subtraction and colour matching on raw pixel buffers, with no vision library and no deep learning.

Owner
Our own R&D
Industry
Sport and hobby timing
Services
Computer vision, real-time processing, desktop software
Platforms
Windows; C# and WinForms; a PlayStation 3 Eye camera
Our role
We designed and built the vision pipeline, the timing logic and the app.

The challenge

Timing RC car laps usually means transponders on every car and a loop in the track. We wanted to do it with one cheap camera pointed at the finish line: no hardware on the cars, set up in minutes. A camera gives you a stream of pixels, though, not "the red car just completed a lap".

The hard parts were the usual ones for vision outside a lab. Lighting shifts and shadows move. Sensor noise makes every frame slightly different even when nothing happens. A car crossing the line appears in several frames in a row and must count once. And the work has to keep up with the camera, or cars are missed. In 2012 deep learning hadn't yet reached everyday computer vision, so the rules were ours to write.

Our approach

We controlled the scene wherever we could, so the vision could stay simple. The camera is fixed, so anything that changes is probably a car. Each car has a distinct body colour, so colour can serve as identity. And a lap takes seconds, so the time between crossings is a strong check on whether a detection is real. The whole app is about 2,800 lines of C#, working directly on byte buffers from the camera.

What we built

A clean picture of the empty track

A calibration step averaged several frames of the empty track into one background image. Averaging smooths out sensor noise, so the reference is steadier than any single frame, and every live frame is compared with it.

Tiles, not pixels

Each live frame was compared with the background in square tiles. A tile counted as changed only if every pixel in it differed by at least a noise threshold on all three colour channels, and the check stopped at the first pixel that didn't. On an empty track most tiles fail on the first pixel, so the scan is cheap, and shadows and noise rarely change a whole tile, so they're ignored. The changed tiles were merged into one bounding box, and anything smaller than a minimum width and height was discarded.

Identity by colour

The average colour inside the box identified the car. In setup mode, each new colour that crossed the line was registered as a new car, so setting up meant driving each car past the camera once. In racing mode, the timer picked the registered car with the nearest colour. We also experimented with converting to HSL, which separates hue from brightness, and snapping to a small palette of white, black, red, green and blue to cope with changing light.

Counting each lap once

A minimum lap time, five seconds by default, stopped one pass from being counted twice as a car crossed the line over several frames. It's a simple guard, and the kind every real-world detection system needs whatever model sits in front of it.

Keeping up with the camera

Capture ran on its own thread, and everything slow went to the thread pool: speaking the time from pre-recorded number clips, saving the frame and recording the lap. The capture loop never waited on the disk or the speaker, and each lap appeared in a results grid with a saved image of the crossing.

Architecture

  1. Camera threadFrames from a fixed PS3 Eye camera
  2. Background subtractionChanged tiles against an averaged empty track
  3. Blob and colourOne bounding box and its average colour
  4. IdentifyNearest registered car colour
  5. LapPast the minimum lap time: spoken, saved, shown

Results

Under the hood

Classical computer vision, chosen on purpose.

What it taught us

Clients often ask whether a problem needs deep learning. Sometimes it does. Sometimes a fixed camera, a clean background and a well-chosen threshold do the job more cheaply and more predictably, and that's the honest answer. Knowing both lets us choose, which is how we approach computer vision today. Later we trained an object detector to find equipment in power-pole photos, a problem no threshold could solve.

The guards matter just as much in a learned system. Decide what counts as an event before you measure it, and add checks for the double count and the bad frame, because no model removes the need for them. Running everything on the device, with no cloud, is now the norm in our Edge AI work.

What we'd do now

The same timer, built today.

  • Start classical, then measure. We'd still try background subtraction first, record a few sessions and count missed and false laps before deciding whether a model is needed.
  • Use a small detector if the scene fights back. Outdoor light, similar colours or crowded crossings are where a compact object detector running on the device earns its place.
  • Track, don't just detect. Following each car across frames gives a cleaner crossing time than a single detection, and makes the double-count guard a backstop rather than the main defence.
  • Keep every threshold in settings. Noise tolerance, tile size, minimum box and minimum lap time were all tunable without a rebuild. That's still right.

Questions

What is background subtraction?

Comparing each video frame with a reference image of the empty scene. Whatever differs enough is treated as a moving object, such as a car crossing the line.

How did it tell the cars apart?

By colour. Each car was registered by driving it past the camera, and each later crossing was matched to the car with the nearest average colour.

Did it use machine learning?

No. It used classical computer vision with thresholds we chose and tuned. That kept it fast, predictable and easy to set up.

Related

The services behind this work, and more stories like it.

Services

Case studies

Bring us the hard problem.

A 45-minute discovery call with the engineer who'll build it.