Louis RyanComputer vision · Ireland

Project · 2025 · client not named

Reading batch codes on a bottling line

What was needed
A small drinks producer prints a batch code and date on each bottle. Codes were checked by eye on a handful of bottles per run. A smudged printer head once put an unreadable code on most of a pallet, found weeks later.
What I built
A camera and light above the conveyor. The software reads the code on every bottle, logs it, and lights a lamp when a code cannot be read.
What changed
Every bottle is now checked instead of a sample, and a bad printer head is caught within a few bottles rather than a few weeks. Codes go straight into the spreadsheet they already keep.
How long it took
Three weeks, one of them spent on lighting.
The camera and light bracket mounted above the conveyor.
The light mattered more than the camera did. Overhead strip lighting reflected off wet glass and wiped out the code entirely.

The story

I expected the hard part to be the reading. It was the lighting.

Bottles come off the filler wet, and the ceiling lights were reflecting straight into the lens, so the code sat in a white blur. A cheap bracket, an angled light and a matte shield fixed what no amount of software would have.

The reading itself is easier than it sounds, because the code is always printed in the same font in roughly the same place. The system is not trying to read anything in the world — only this printer, on this glass.

What took the remaining time was deciding what should happen when a code cannot be read. Stopping the line was too aggressive for a run of a few thousand bottles. We settled on a lamp and a logged photograph, so the operator can decide.

A close photograph of a bottle neck with the batch code boxed and the read text beside it.
What the operator sees when a code reads cleanly. When it doesn't, the same screen shows the photograph, so nobody is guessing what the machine objected to.
For the technically minded

Industrial camera with a hardware trigger off the existing bottle sensor, fixed focus, and a diffused bar light at about 30 degrees. Text detection is constrained to a fixed region of interest, then character recognition on a model fine-tuned on around 900 photographs of this printer's output, including deliberately smudged runs. Roughly 40 bottles a minute, well inside what the hardware handles.

Read rate settled around 99.4% on clean print. Anything below the confidence threshold is treated as unreadable rather than guessed — a wrong code logged as correct would be worse than no code at all.

Topics this used

Reading codes, labels or paperwork?

Tell me what the print looks like and how many there are. Lighting is usually the real question.