top of page
Search
Writer's pictureSenthil Pitchappan V

Automatic number-plate recognition in just 15 lines of code

Updated: Sep 13, 2020

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

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's number plates all over the world.

To see all the countries supported Click Here.


To get API Key:

Go to https://platerecognizer.com and create an account to get your own API KEY.


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)

Changes you should make:

  1. YOUR_API_KEY

  2. IMAGE_PATH

  3. Country Code (if required)

If you get any import error:

pip install json

pip install requests


Further Process:

  1. Add Database - Firebase or sqlite3 or MySQL

  2. Add the outvalue to CSV File

  3. Integrate this code and HTML to create a Web App


For full coding Github Link


JSON OUTPUT:



102 views0 comments

Recent Posts

See All

Comentarios


bottom of page