Skip to content
/ diy-alpr Public

An automated license plate reader (ALPR) built with a Raspberry Pi. Captures images along with GPS coordinates, analyzes images for license plates (using OpenALPR library), and produces a list of recognized plates, time, and location.

Notifications You must be signed in to change notification settings

jfh01/diy-alpr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

diy-aplr - An automated license plate reader built w/ Raspberry Pi

This program is built for Raspberry Pi. It continuously captures photographs of license plates along with current GPS coordinates. The captured photos are analyzed and any license plate numbers that are recognized are output to CSV or/and JSON (along with the time and location of the image) The application is multi-threaded and designed to capture at high speed (3-5 images/sec). The Rapsberry Pi can't recognize as fast as it can capture, so image files are queued up in a capture directory and worked through as fast as the recognizer is able.

LEGAL NOTE
----------
Your local laws may have something to say about the use of automated license plate readers. Please learn the law and don't use this software to break it.

COMPONENTS
----------
diy-lpr - main application
gpspoll - reads coordinates from an attached GPS device
camcap - continuously captures images from the camera (requires a GPS lock)
recognizer - performs ALPR recognition on captured images

REQUIRED HARDWARE
-----------------
1. Raspberry Pi - Tested Pi 3 Model B
2. GPS - Tested with w/ AdaFruit GPS Hat and external antenna
3. Camera - Tested with Raspberry Pi Camera V2

SOFTWARE DEPENDENCIES
---------------------
1. Python 2.7
2. OpenALPR
3. gpsd
4. Non-standard Python libraries: gps, exifread, openalpr, picamera

CONFIGURING DIY-ALPR
--------------------
Edit src/diy-lpr.py. Edit any variables between 'BEGIN DIY-ALPR CONFIG' and 'END DIY-ALPR CONFIG' that need changing. You can also tweak camera settings between 'BEGIN CAMERA CONFIG' and 'END CAMERA CONFIG'

RUNNING DIY-APLR
----------------
Before you can use DIY-ALPR, you will need to make sure your Raspberry Pi Camera is properly connected. You will also need to have your GPS device installed and working. diy-alpr relies on 'gpsd' to work. Follow the instructions that came with your GPS device (or the gpsd manual) to get this running. If the 'cgps' command isn't returning a GPS fix, then diy-alpr won't work. diy-alpr looks for gpsd at localhost:2947.

Once everything is ready to go, fire up diy-alpr with:

    diy-alpr$ python src/diy-lpr.py

If you want to run in background and capture a log file, use:

    diy-alpr$ nohup python src/diy-lpr.py >> work/diy-lpr.log 2>&1 &

The program will output various status information and errors to keep you apprised of its activies.

If you have a capture_ctl file set up, you will need to make sure this file exists. diy-alpr will only capture images while this file is in place. To start capture:

    diy-alpr$ touch work/capture_ctl

To stop capture:

    diy-alpr$ rm work/capture_ctl

RUNNING DIY-ALPR ON BOOT
------------------------
On Raspbian, edit /etc/rc.local and add:

  sudo -u USER_TO_RUN_AS python PATH_TO_DIY_ALPR/src/diy-lpr.py >> PATH_TO_DIY_ALPR/work/diy-lpr.log 2>&1 &

TODOs
-----

- versioned releases
- proper make system for installation
- proper config system (editing .py for config is pretty lame)
- proper logging system (everything is going to STDOUT. should have multilevel file-based logging)
- test/tweak for other Raspberry Pi hardware versions and other Camera versions
- test a NOIR camera, possibly with an IR LED flash for capturing plates at night
- look at improving OpenALPR performance. would be nice if it could keep up with the camera. or, just wait for the Raspberry Pi hardware to get faster
- automatically push captured plates (and images?) to a cloud API endpoint

About

An automated license plate reader (ALPR) built with a Raspberry Pi. Captures images along with GPS coordinates, analyzes images for license plates (using OpenALPR library), and produces a list of recognized plates, time, and location.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages