Last updated: November 2026
I shoot olympic-style 10M Air Pistol. In order to see and score without having to move position, I had a webcam strapped to a sighting scope. It worked pretty well but there was a long USB cable and any slight bump would upset the whole setup. This details a small computer I set up AT the target, which streams the target view onto my network, so I can see how I'm doing from my laptop. This has quickly led to the realization that we have good streaming data that can be analyzed - my next step is live scoring through shot detection.
| Part | What |
|---|---|
| Pi Zero 2 W | Dual-core A53, 512MB RAM, WiFi |
| OV5647 camera | 5MP sensor, the classic Pi Camera Module v1 |
| microSD card | 64GB (overkill, it is what I had) |
The whole thing is smaller than a deck of cards and runs off a phone charger. Total cost roughly $45.
The Pi boots, connects to WiFi, and starts an MJPEG streaming server on port
http://scopecam.local:8080/stream.mjpg
and see a live feed. There is also a snapshot endpoint at /snapshot.jpg and a
WebSocket broadcaster on port 8081 for piping frames to a server-side
detection pipeline.
The camera runs at full sensor resolution internally but streams at 1920×1080 with JPEG quality 75, about 200KB per frame, a 5.8× reduction from the 1.1MB full-res frames.
Out of the box, the Pi Zero 2 W is a tight fit for continuous camera streaming. The default Raspberry Pi OS config reserves 128MB of the 512MB RAM for the GPU. That leaves 353MB visible to the system, and with Python + libcamera + multiple HTTP clients and OOM crashes started to occur.
Adjustments I found worked to give me a little more RAM breathing room:
| Metric | Before | After |
|---|---|---|
| Total RAM | 353MB | 414MB |
| Available RAM | 85MB | 186MB |
| GPU memory | 128MB | 64MB |
| Frame size | 1.1MB | ~200KB |
| Swap used | 52.5MB | 0MB |
Available RAM more than doubled and swap dropped to zero.
http.server.ThreadingHTTPServer with a
multipart/x-mixed-replace MJPEG handler. No framework, no dependencies.The whole server is a single 145-line Python file.
A 10m air pistol target is a known geometry: rings of fixed diameter on a card, with a black center. Once the camera is calibrated against that card, the geometry can be drawn on top of the video: the numbered rings in these screenshots are not printed on the paper. They are rendered from the calibration, which is why they sit so squarely over the card at an angle.
Calibration is one button, New target + calibrate, and it is done per card.
From then on the app knows where the center is and what a pixel is worth in
millimeters, and every later measurement is arithmetic instead of guesswork.
Scoring is a click. Put the crosshair on the hole and click the card; the app records the shot, measures its radius from the center in millimeters, and derives the score from that radius. Each shot is drawn on the view as it lands.
The panel keeps the series as a list: shot number, score, radius, and how the shot was entered:
| # | score | r mm | how |
|---|---|---|---|
| 3 | 10.5 | 1.8 | clicked |
| 4 | 10.5 | 2.9 | clicked |
| 5 | 8 | 16.6 | clicked |
| 7 | 10 | 5.7 | clicked |
| 11 | 10 | 6.4 | clicked |
The two totals above the list are the ones that matter at the firing line:
series total for the ten-shot series, and match total across the match, which
is six series. SERIES 2 / 6 in the header is where you are in that match.
auto-detect off: the panel says so plainly, and every entry above reads
clicked for the same reason. Shot detection is the goal and it is not trusted
yet, so shots are entered by hand. That keeps the record honest: every row
carries a radius that a person agreed with.
Scoring by hand is also what produces labeled data. Every shot leaves behind a frame, a position, and a score someone confirmed, which is exactly what a detector needs and cannot invent.
So each series is being recorded, per shot:
Saved together per series, that is a training set rather than an archive. Enough of them and the difference frames stop being a record and start being a model: one that proposes a shot, with the manual score as the check on it.
Train on the recorded series, then turn auto-detect on.
The WebSocket broadcaster already pipes every frame to port 8081, so the detection itself belongs on the more capable machine rather than the Pi. The approach I am heading toward is lightweight frame differencing on the desktop side, keyed to the regions of interest rather than full-frame analysis, and now with recorded series to measure it against.