# SyringeMeter

From camera images to stable readings and traceable records.

A syringe measurement application that runs locally on the CPU. Detection, orientation, range markers and plunger position produce continuous volume readings, live charts and CSV records controlled by the user. This case study follows a vision prototype through desktop interaction, failure handling and Windows distribution.

[Website source](https://zzzxc.com/projects/syringe-meter)

## How does a detection become a continuous measurement?

The starting point is a syringe in a camera image. It can tilt, its plunger moves, and its color markers may briefly become unreadable. A detection box locates the object. Answering how much volume it contains also requires orientation, range and plunger evidence from the same frame, in the same coordinate system.

Bringing that reading into a desktop application adds further responsibilities. The interface must stay responsive, charts must follow measurements, and starting or stopping must have a clear meaning. Unexpected exits must not leave recording state ambiguous. SyringeMeter was built around this entire journey from image to record.

## Align the measurement before calculating volume

YOLO OBB first locates the syringe and its rotation. The detected region is then transformed into a consistently oriented local image. As the syringe turns in the camera view, the measurement logic can continue working in the same coordinates.

Within that image, a green marker establishes direction, two red range lines define the measurement span, and the plunger position supplies the current volume evidence. Together, valid observations produce a continuous volume result. Temporal stabilization then prepares it for the live reading and chart.

- Locate the object: establish the syringe's position and angle.
- Measure locally: bring direction, range and plunger into one coordinate system.
- Display the result: turn valid volume estimates into readings and charts that can be followed over time.

## A stable reading must also know when to disappear

Smoothing can reduce jitter, but it can also conceal missing evidence. When the current frame has invalid color markers, range anchors or upstream evidence, the application explicitly reports no valid reading. It does not retain the previous volume. A steady number must still correspond to the image being observed.

The runtime treats video and measurements separately. A worker process owns the camera, model, visual measurement and CSV writing; the parent process handles the Qt interface and user actions. The video channel keeps only the latest frame, while measurement samples use a bounded lossless channel. Display responsiveness and recording integrity each have their own data path.

## Every recording begins with an explicit action

Opening the camera does not start saving data. A recording session and scalar CSV are created only after the user presses Start. The product does not save camera images or video. It records measurements and timing that belong to that session.

Start, Stop, Reset and exit commands take effect at processing frame boundaries. Reset closes the current session, clears the chart and returns the application to READY. Only the next explicit Start creates a new CSV and restarts timing at 0 ms, giving each session a clear boundary.

- Observe: follow the live volume and chart without automatically recording a CSV.
- Record: press Start to begin a separate measurement session.
- Reset: close the session, clear the chart and wait for the next Start.

## Delivering an application people can install

The project connects camera input, continuous measurement, Qt interaction, charts and CSV in an end-to-end workflow. Tests cover unit logic, integration, the interface, processes and recording. Interface contracts and documentation are also checked, keeping implemented behavior, automated results and physical evidence distinguishable.

Version 0.2.0 provides a Windows x64 CPU-only installer and portable ZIP, built by GitHub Actions with PyInstaller and Inno Setup. The release job verifies checksums for both artifacts. Model files stay out of Git history and enter installation artifacts through the approved release pipeline after SHA-256 verification.

This establishes a repeatable build and distribution path. Installation, camera access and real inference on the target machine still require their own physical verification; a successful automated build cannot establish those results.

## My role: defining what the system must get right

I led this personal engineering project, defining the problem, product goals, measurement semantics, failure boundaries and acceptance criteria. I brought the algorithm, runtime, desktop interaction and Windows distribution into one workflow, and retained the final release decision.

AI tools contributed to implementation, refactoring, tests and documentation. My responsibility was to decide which behavior to build, which evidence was sufficient to accept it, and which results still needed real hardware. The project is also a practice in AI-native collaboration: bringing iteration to a system with explicit behavior, verifiable results and clear responsibility.

## Evidence and scope

SyringeMeter is an engineering MVP for controlled conditions, demonstrated with a single marked syringe. It is not a medical device and makes no claim to support arbitrary syringes, lighting or deployment environments.

The videos on this page were recorded on macOS running the Python source and establish only the behavior visible in those sessions. The v0.2.0 Windows build and release have passed automated verification. Installation, camera access and real inference for the current Windows package have not yet been reverified on the target machine. Source, automated checks, demonstrations and package verification are recorded separately; the project status tracks further progress.

## From image to record

### Capture

Process the current camera frame locally.

### Locate

Find the syringe and its rotation with YOLO OBB.

### Align

Transform the local image into a consistent measurement direction.

### Read evidence

Combine the green direction marker, two red range lines and plunger position.

### Stabilize

Use quality checks and temporal stabilization to determine valid readings.

### Display & record

Show live readings and charts; write scalar CSV after an explicit Start.

## Explore the project

- [Source & project documentation](https://github.com/agenticnoob/syringe-meter)
- [Windows v0.2.0 release](https://github.com/agenticnoob/syringe-meter/releases/tag/v0.2.0)
- [Current verification status](https://github.com/agenticnoob/syringe-meter/blob/main/docs/status/current.yaml)

[Contents](https://zzzxc.com/agent/en/index.md)
