Skip to content
renanlido.me
Back to blog

Published on Jul 10, 2026 · 5 min read

How cameras read truck plates: inside a port OCR/ALPR pipeline

The anatomy of an automated gate: from camera to the gate opening, and the lessons of keeping computer vision running 24/7.

computer-visionevent-drivenmission-critical


At a port terminal, the gate is where the money flows through. Every truck stopped at the entrance is cost piling up by the minute — and the queue grows fast. The promise of automation is easy to say and hard to deliver: the camera reads the plate, the system decides, the gate opens. No human typing plates on a keyboard.

The anatomy of the problem

Every pipeline of this kind, whatever the tooling, needs to solve four well-separated responsibilities — and that separation is what keeps the system alive when one part chokes.

  • Capture: turn physical cameras into video streams other components can consume without depending on the hardware
  • Infer: detect the vehicle, locate the plate and read the characters — discarding early (and cheaply) every frame that does not matter
  • Decide: cross-check the reading against business rules, schedules and authorizations, and answer a single question: open or not?
  • Actuate: turn the decision into physical gate movement and into information for everyone who needs to know, in real time

Why events instead of direct calls

The temptation to wire these stages together with direct HTTP calls is real — it's the path of least effort. But a gate runs 24/7, and a component restarting at 3am cannot mean a stuck truck. With messaging in between, each stage degrades independently: if the decision stage goes down for 30 seconds, readings pile up and get processed on recovery. The truck waits a few extra seconds; nobody pages the on-call.

The same reasoning applies to whoever watches the operation: yard and gate screens work better as event projections than as queries. For a flow that is 99% server→screen, Server-Sent Events solves it with far fewer moving parts than WebSocket.

What I learned keeping this in production

  • Confidence is a gradient: every OCR reading comes with a score. Below the cutoff, the flow degrades to human confirmation — automating 95% well beats automating 100% badly.
  • Cameras are hardware, and hardware fails: monitoring the stream matters as much as monitoring the service. A frozen stream is a silent bug.
  • Idempotency is not optional: the same plate can be read three times in two seconds. Consumers must treat re-reads as noise, not as three trucks.
  • Clear boundaries pay rent: the "can it enter?" rule should not know what a camera, a GPU or a gate controller is. That is what lets the infrastructure evolve without rewriting the decision.

In the end, the whole pipeline exists for one thing: turning a video frame into a gate arm rising within seconds, thousands of times a day, drama-free. It's the kind of system nobody notices when it works — which is exactly how you measure success in mission-critical software.