Three webcams, a Raspberry Pi, and a dartboard that keeps score
DartVision scores steel-tip darts with three USB cameras and a Pi 5. The interesting part wasn't the computer vision. It was finding out, again and again, that the system was confidently wrong.
Commercial auto-scoring dartboard systems exist, and they're good. They also cost more than the board, the cabinet and a year of darts combined. So I built one: three USB webcams around a dartboard, a Raspberry Pi 5, and a touchscreen that shows the score the moment a dart lands.
Mostly the moment it lands, anyway. This post covers how DartVision works, the bugs that taught me the most, and the numbers as they stand today. The numbers aren't where I want them yet.

The setup
- Brain: a Raspberry Pi 5 running a Python service (Flask and Socket.IO, with OpenCV and NumPy doing the real work). The UI runs in a Chromium kiosk on a touchscreen.
- Eyes: three 1280×720 USB cameras running MJPG at 30 fps. Each sits about 43 cm from the bull, about 30° above the board, and they're spaced 120° apart.
- Light: an LED ring light around the board, with exposure and white balance locked per camera so the image doesn't drift as the room changes.
At that distance the board is about 840 pixels across, so one pixel covers roughly half a millimetre of board. That's plenty for scoring, if you know exactly where every pixel lands on the board. Most of this project turned out to be about that "if".
How a dart gets scored
- Something changed. Each camera runs a small state machine (empty → changing → stable) on frame differences. When a dart lands and the image settles, the camera reports.
- Find the dart's axis. Diff the new frame against the one before the dart. Reject shapes that don't look like a dart, then reject shadows. Fit a line down the dart's centreline with RANSAC.
- Map it onto the board. Each camera has a calibration (a homography plus lens distortion) that turns its 2D line into a line on the board's surface.
- Intersect. Two or three cameras give two or three lines. Where they cross is where the dart is. Outliers get thrown out, and if only two cameras fired, the third gets asked to take another look.
- Score it. Convert that board position into segment and ring, then let the game rules handle the rest: cricket, x01, Killer, Shanghai and a few house games.
Nothing in that pipeline is machine learning. Every throw is saved with its images, so a learned model is an option later, but classic geometry got surprisingly far.
It never worked, and nobody could tell
This started in February as a port of opencv-darts, an older two-camera Scala project, onto the Pi 5. It ran, the UI looked right, and it never scored a dart.
When I came back to it in September, the first job was a full assessment. It found that:
- the scoring path threw an exception, which a bare
exceptquietly swallowed; - the calibration was seven months stale, with the bullseye off by up to 213 pixels, about 117 mm;
- lens distortion had been measured but was never applied;
- three identical cameras had calibrated focal lengths of 613, 1070 and 1013 px;
- the cameras were streaming uncompressed at 10.6 fps with auto-exposure on.

That picture settled it: rebuild rather than re-tune. The first thrown darts scored the next day.
Calibrate from the board, not a checkerboard
The textbook way to calibrate a camera is to wave a printed checkerboard in front of it. I tried that, and swapped it out for something better suited to this job: the dartboard is a calibration target. It has 20 straight wires radiating from a known centre and six rings at known radii.
So each camera finds the bull (automatically, or by a tap on the screen), you tap the 20 to fix orientation, and a least-squares fit pulls a homography and radial distortion straight from the edges of those wires and rings. It's sub-pixel accurate, needs no printed target, and re-runs in seconds. The median error is now about 0.4 mm.
Getting there meant handling some fun failure modes. The board is symmetric, so a fit can happily come out mirrored, or rotated by one segment (18°). The ring light also added a green cast that fooled the bull finder until I normalised the colour balance.
Bugs that taught me something
Good averages can hide a bad edge
After re-mounting the cameras and switching to a thin-wire board, the calibration checks all passed, with average error around half a millimetre. Doubles were still being misread. Plotting the signed error by sector showed the fit pulling up to 4.25 mm inward at the double ring, and the double band is only 8 mm wide. The check had looked only at the points the fit chose to keep, and an unsigned median hid which way the error ran. Now there's a per-sector gate: if any sector is off by more than 2 mm, the calibration fails.
The cameras were looking at different moments
Some wrong scores came from two cameras each fitting a perfectly good line to a different dart. One camera's frame had been taken a second or so later, after the next dart had already landed. The fix was to take all cameras' frames from the same tick and pick each camera's dart jointly instead of separately.
Pulling the darts is not a throw
In the first real play sessions, 36% of turns scored more than three darts. The extra one was my hand. Pulling darts out of the board looks a lot like something new arriving. The data showed the "fourth dart" turning up a median 8 seconds after the third, usually seen by only two cameras. A three-dart cap per turn raised the share of clean turns to 87%. Now a pull just ends the turn.
Self-healing that couldn't stop
Cameras get bumped, so I added automatic recalibration when the board appears to have moved. Camera 0 then recalibrated itself four times in eight minutes, because each successful refit still left the drift reading above the trigger. Now drift has to be confirmed, the threshold sits above the fit's own noise, a camera can self-heal at most once every ten minutes, and anything worse gets flagged instead of retried forever.
Making it fast without changing a single answer
On the Pi, the third dart of a turn took 5–7 seconds to appear on screen. That's long enough for players to stare at the screen wondering if it noticed. Profiling pointed at the dart-axis step. Three changes did most of the work:
- caching image dilation that was being recomputed on every frame;
- working on small crops instead of full 720p frames;
- vectorising the RANSAC loop while keeping the same random draws.
The median time for that step dropped from 1,660 ms to 429 ms (3.9×). To make sure nothing else changed, I fingerprinted the output on 47 real throws before and after: the results were bit-identical. (Running the three cameras in parallel only bought 10%, thanks to Python's GIL, so that change never shipped.)
Where it stands
| Measure | Result | Target |
|---|---|---|
| Hand-placed test set (60 darts) | 56 / 60 (93%) | ≥ 95% |
| Calibration error, median | ~0.4 mm | ≤ 5 mm p95 |
| Dart-axis step on the Pi | 429 ms median | — |
| Landing to on-screen | not yet re-measured | < 2 s |
All of those test numbers come from darts placed by hand. Live play is harder to measure, because a throw only gets a truth label when someone corrects its score. The live logs also show what's left to fix. Over 20 games and 331 throws, about two-thirds of scoring runs were phantoms: the pipeline woke up, looked, and found no new dart. Each one costs time, and each one is a chance to score something that isn't there. One more catch: when only two cameras see a dart, there's no third opinion to cross-check them.
Built with an AI pair, deliberately
Most of September's roughly 370 commits were written with Claude Code. Making that work took more process than I expected:
- One task per branch, one brief per task. Each piece of work starts as a written brief with acceptance criteria. Parallel agents work in separate git worktrees.
- No test needs hardware. Everything runs against recorded camera frames, so the full suite (about 2,900 tests) runs on a laptop.
- Mutation checks. For a fix to count, its test has to fail when the fix is reverted.
- Real data over intuition. Nearly every fix above came from instrumenting live games and reading the logs, rather than from guessing.
Even the game art and sound effects are AI-generated. That's a separate post.
What's next
Accuracy first: get the hand-placed set past 95%, then build a live accuracy metric that doesn't depend on someone bothering to correct a score. After that comes a TV output, so the whole room can see the scoreboard.
The full source is GPLv3 and builds on vassdoki/opencv-darts, whose history is preserved in the repo.