License Plate Recognition API

I built my own New Zealand licence plate recognition API using computer vision and a Raspberry Pi after online LPR services became too expensive.

License Plate Recognition API

I’ve worked on a variety of projects where license plate recognition was useful — cameras, automation, vehicle tracking, and other systems where being able to turn a photo of a vehicle into a registration number opens up a lot of possibilities.

The problem was that using an online license plate recognition service started becoming increasingly expensive as these projects grew.

Rather than continuing to pay for another API every time I wanted to experiment with a project, I decided to build my own.

The result is my own License Plate Recognition (LPR) API, along with a simple website where you can try it for yourself:

Try the License Plate Recognition demo

Why build another LPR system?

License Plate Recognition — also commonly called ALPR or ANPR — is essentially a combination of computer vision and optical character recognition. A camera captures a vehicle, software finds the registration plate, and OCR converts the characters on that plate into text.

The concept sounds relatively simple, but there are quite a few moving parts involved.

Traditional LPR systems typically combine a camera, image-processing software and some form of database or application layer.

For my projects, I didn't necessarily need a huge commercial platform. I needed something I could integrate into my own software, run myself, and experiment with without having another per-request service sitting in the middle.

So I built one.

From an image to a registration number

The basic pipeline looks something like this:

Image → Plate Detection → Crop → OCR → Registration

First, an image of a vehicle is provided to the system.

The computer vision model searches the image for a licence plate and determines where it is located. Once the plate has been detected, the relevant section of the image can be passed through an OCR process to determine the characters.

The final result can then be returned to whatever application originally requested the recognition.

That separation is useful because the recognition system doesn't need to know what the rest of the application is doing. It can simply take an image and return useful data.

Example of it working

Why I built it around a Raspberry Pi

One of the more interesting parts of this project is that the inference isn't running in a giant cloud environment.

The demo currently runs its recognition through a Raspberry Pi.

If you try the demo at alpr.harryludemann.com, the site itself explains that detection and OCR are performed on the Raspberry Pi rather than directly in the browser or on Vercel.

That was an important part of the project for me.

I've always liked the idea of taking something that would normally require a cloud service and seeing how far you can push relatively inexpensive hardware instead.

A Raspberry Pi isn't going to compete with a massive GPU cluster, but for a focused computer-vision workload it can be surprisingly capable.

It also means the architecture can be moved closer to the camera.

Instead of:

Camera → Internet → Cloud API → Result

you can potentially build:

Camera → Local Device → LPR → Result

That opens up some interesting possibilities for projects where internet connectivity isn't guaranteed or where keeping image processing local is desirable.

Built specifically with New Zealand plates in mind

The initial version of the system is focused on New Zealand licence plates.

That makes sense for my own projects because I'm based in New Zealand, and it also means I can optimise the system around the plates I'm actually likely to encounter.

Licence plates aren't universally formatted. Different countries — and sometimes different regions within countries — use different layouts, character sets, fonts and plate designs.

That makes localisation an important part of building a reliable recognition system.

The demo is therefore deliberately focused on answering a fairly simple question:

Can I give this system a photo of a New Zealand vehicle and have it correctly read the plate?

The API

The website is really just the front end.

The more interesting part of the project is the API sitting behind it.

That means other applications don't need to know anything about the underlying computer-vision models. They can simply send an image to the API and consume the result.

This is particularly useful for the types of projects I originally needed LPR for.

For example, an application could potentially use the result to:

  • Log vehicles arriving at a location
  • Trigger an automation when a particular plate is detected
  • Build a vehicle arrival history
  • Connect plate recognition to CCTV systems
  • Automatically associate vehicles with other events
  • Experiment with parking or access-control systems
  • Feed recognised plates into another application or database

The important part is that the LPR system becomes a reusable building block rather than something that has to be implemented separately in every project.

Testing it yourself

I also wanted a quick way to test the system without having to build an application around the API first.

So I built a small web interface:

Try the ALPR demo

You can upload a photo, or use a camera, and let the system attempt to identify the plate.

The current interface accepts JPEG, PNG and WebP images under 8 MB.

It's intentionally simple. Drop in an image, let the backend process it, and see what comes back.

This is still a work in progress

Like most of the projects I put together, this isn't intended to be presented as a perfect, production-ready replacement for every commercial LPR system.

Real-world plate recognition is difficult.

Lighting, motion blur, camera angle, reflections, dirt, plate covers, image resolution and partially obscured plates can all make recognition harder. Even commercial systems have to deal with these variables.

The interesting part for me is seeing how far I can get with hardware and software that I control myself.

There are also plenty of improvements I want to make over time — better recognition in difficult conditions, improved performance, more camera integrations and potentially support for additional plate formats.

Why I like building things like this

The original motivation was fairly practical: I had multiple projects that needed licence plate recognition, and paying for an external service didn't make as much sense as it once did.

But that's usually how my projects start.

I run into a problem, find an existing solution, realise that I want more control over it, and eventually end up building my own version.

This project is a good example of that process.

What started as a way to avoid relying on an increasingly expensive external API turned into a small computer-vision service running on a Raspberry Pi, with its own API and a web interface for testing it.

And that's probably the most interesting part of building software yourself — sometimes the solution to one small problem becomes a completely reusable tool for the next ten projects.

If you want to see it in action, try the demo here:

alpr.harryludemann.com