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

Top comments (0)