DEV Community

Senthil Pitchappan V
Senthil Pitchappan V

Posted on

Automatic number-plate recognition in just 15 lines of code

Automatic number-plate recognition is a technology that uses optical character recognition on images to read vehicle registration plates.

  1. Plate recognizer API
  2. Python

Accurate, Fast, Developer- Friendly ALPR

Automatic License Plate Recognition software that works in all environments, optimized for your location. It supports a number of country number plates all over the world.
To see all the countries supported Click Here

To get API Key:

Go to platerecognizer and create an account to get your own API KEY.

Python

  1. pip install json
  2. pip install requests

Code

import requests
import json
from pprint import pprint

#Automatic number-plate recognition API
regions = ['in']            #Change to your country
with open('IMAGE_PATH', 'rb') as fp:
    response = requests.post(
        'https://api.platerecognizer.com/v1/plate-reader/',
        data=dict(regions=regions),
        files=dict(upload=fp),
        headers={'Authorization': 'Token YOUR_API_KEY'})
data = response.json()

#print output in JSON Format
pprint(data)

#get number plate value from JSON response
for plate in data['results']:
    plate_data = plate['plate']
print(plate_data)
Enter fullscreen mode Exit fullscreen mode

View full project code on my Github

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️