Skip to content

alpr speed.py Process speed images with OPENALPR Automatic License Plate Reader

Claude Pageau edited this page Sep 28, 2019 · 16 revisions

How to Use OPENALPR with speed-camera

This sample alpr-speed.py script will read speed-cam.py image paths from sqlite3 database entries. It will then use openalpr to search for license plate numbers in the speed-cam.py images. This method takes advantage of speed-cam.py motion tracking to only process potential candidates for real moving vehicles or objects.

You will need to configure openalpr to suit your needs eg country and regions Etc. As each image is processed the speed_cam.db speed table status field will be updated to 'none' or plate infor. image is only processed once.

Note

When using speed camera for openalpr purposes the speed settings will most likely not be needed and motion tracking will only be used for triggering image for license plate capture purposes. It is suggested you set speed-cam.py config.py image resolution WIDTH and HEIGHT to 640x480 with image_bigger = 1.0

This script will print out the license plates info. It will also add a license plate data the status column of the data/speed_cam_db sqlite3 database. This code is still under development. It is also possible to add code to save results to another sqlite database table, csv or other file.

Installation

I installed openalpr on RPI's per

sudo apt-get install python-openalpr
sudo apt-get install openalpr install openalpr-daemon
sudo apt-get openalpr-utils libopenalpr-dev

sudo apt-get install sqlite3

I Also needed to create symbolic link per below but this may be due to version that was loaded

sudo ln -s /usr/share/openalpr/runtime_data/ocr/tessdata/lus.traineddata /usr/share/openalpr/runtime_data/ocr/lus.traineddata

How To Run Script

Configure speed-cam.py using config.py and set camera width height to 640x480 resolution and image_bigger = 1.0 Since the camera will be positioned to read license plates the speed calibration can be ignored.

Make sure openalpr is installed and can be run. Collect speed camera images with license plate(s) showing on the images. The image entries will be added to the data/speed_cam.db database file. The status column of the speed table will store the processing status of alpr-speed.py

Open SSH or terminal session and