Any sort of computer vision is not a trivial task – and license plate detection is not an exception.

If you take a moment to think about it, it’s so easy for humans to classify what’s on images – but the problem arises when you want to automate that process.
Computer vision professionals have built their entire careers on top of it.
Computers can’t "see" in the way we can, as they can only understand numbers, and defining rules on arrays of numbers is basically what any Computer Vision task boils down to (massively oversimplified).
So, in today’s article, I will quickly demonstrate the power of OpenALPR API to do the following:
- Read text from license plate
- Determine the car’s brand
- Determine the car’s color
Once again, it’s so easy for us to look at the image of a car, and in a second we’d have information on all of the above points. For computers that task is a lot more complex – I dare you to install OpenCV and try to implement the logic by yourself if you disagree with me.
Without further ado, let’s see how to get things set up properly, what image I’m gonna use, and finally, the source code.
A Tiny Bit of Setup
To start out, you’ll need an OpenALPR account for which you can register here. I’m on a free plan, and if I’m not wrong it will enable you to make 1000 requests per month. That’s not enough for commercial purposes, but it will definitely suit you well for exploration.
If at some point in time you’ll need more, here are the plans from which you can choose:
- BASIC: 25,000 requests/month = $99/month
- PRO: 125,000 requests/month = $395/month
- ENTERPRISE: 1,000,000 requests/month = $1995/month
It’s not cheap by any means, but if you have a parking lot that serves 1M cars per month then I’m guessing 2K isn’t that much for a state of the art license plate reading system.
Anyway, once registered you will get access to your dashboard, and within it, you can go to CarCheck API section to grab the API key:

We’ll need it later when making requests, but more on that in a bit.
Cool, let’s now see the image we’ll use to test the API.
Let’s get the Image
I searched online for car images with a license plate that are free for non-commercial use (actually pretty difficult to find one where the plate isn’t blurred). After some time I found a pretty decent image, and you can download it from this link:

Nice, now we have the account created and we have the image. We’re done preparation-wise. Let’s jump into the good stuff.
Reading License Plates
When it comes to imports, we’ll only need two libraries:
base64
requests
Yes, you’ve read that right. You won’t need to install any libraries to use OpenALPR, which makes potential deployment somewhere down the road that much easier.

Now we’ll declare two variables, one holing a path to your car image, and the second one holding the secret key, obtained by good folks at OpenALPR:

And now comes the part we’ve been waiting for. Here are the steps we need to take in order to read the license plate from a given image:
- Read in the image, and encode it with
base64
- Make a POST request to the API, with parameter
data
being the encoded image - Dig around the JSON response to obtain values we care for
It seems easy, right? Here’s the complete code:

Keep in mind that I’ve split the url
variable into two lines so the image is more readable to you. Also, note how you can specify the country
parameter inside the URL to possibly get better results, if you know beforehand to which country license plate belongs to.
As you can see, with just a few lines of code we’ve managed to obtain so much useful information from the image. To someone unfamiliar with computer vision, developing a solution like this could require months and months of work, and it is questionable how satisfied would you be with the results in the end.
Before you go
And there you have it – in just a few lines of code we’ve managed to perform state of the art computer vision work (well sort of, we just made a call to the API).
I’d argue that the color of the car is black, and not silver-gray, but that’s irrelevant for our case.
The free plan will suit you well to explore, but consider developing the full solution on your own, just for the fun. Maybe that will be the topic for some other time, so let me know if you’d be interested in that.
Thanks for reading.
Loved the article? Become a Medium member to continue learning without limits. I’ll receive a portion of your membership fee if you use the following link, with no extra cost to you.