manupap1 / libzoneminder-plugin-openalpr

libzoneminder-plugin-openalpr is a free, open source Licence Plate Recognition plugin for the ZoneMinder CCTV sofware (https://github.com/ZoneMinder/ZoneMinder). It is based on openalpr library (https://github.com/openalpr/openalpr) for the recognition algorithm and plugin development initiated by nextime (https://github.com/nextime/zum/tree/master/scripts/ZoneMinder).
GNU General Public License v2.0
41 stars 19 forks source link

libzoneminder-plugin-openalpr

Overview

libzoneminder-plugin-openalpr is a free, open source Licence Plate Recognition (LPR) plugin for the ZoneMinder CCTV sofware (https://github.com/ZoneMinder/ZoneMinder). It is based on openalpr library (https://github.com/openalpr/openalpr). The recognized license plates are added to Zoneminder's event notes.

Requirements

libzoneminder-plugin-openalpr requires:

Installation

Debian Jessie (64 bits)

Currently the plugin framework is not supported in upstream ZoneMinder. ZoneMinder with plugin support can be built from the repository https://github.com/manupap1/ZoneMinder

Installation of the building environment

sudo apt-get install build-essential git devscripts

Compilation of ZoneMinder

git clone https://github.com/manupap1/ZoneMinder.git
cd ZoneMinder/
git fetch origin plugin_support:plugin_support
git checkout plugin_support
cp -R distros/debian8 ./debian
sudo apt-get install debhelper po-debconf dh-systemd autoconf automake quilt libphp-serialization-perl libgnutls28-dev libmysqlclient-dev libdbd-mysql-perl libdate-manip-perl libwww-perl libjpeg62-turbo-dev libpcre3-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libbz2-dev libtool libsys-mmap-perl libnetpbm10-dev libavdevice-dev libdevice-serialport-perl libarchive-zip-perl libmime-lite-perl dh-autoreconf libvlccore-dev libvlc-dev libcurl4-openssl-dev libgcrypt20-dev libpolkit-gobject-1-dev libdbi-perl libnet-sftp-foreign-perl libexpect-perl libmime-tools-perl pkg-config
debuild

Installation of ZoneMinder plugin development library

cd ..
sudo dpkg -i libzoneminder-dev_*_amd64.deb

Compilation of OpenALPR

git clone https://github.com/openalpr/openalpr.git
cd openalpr
cp -R distros/debian ./
fakeroot debian/rules get-orig-source
sudo apt-get install debhelper git cmake quilt libopencv-dev libtesseract-dev libtesseract-dev libleptonica-dev liblog4cplus-dev libcurl3-dev uuid-dev
debuild

Installation of OpenALPR development library

cd ..
sudo dpkg -i libopenalpr-dev_*_amd64.deb libopenalpr2_*_amd64.deb libopenalpr-data_*_all.deb

Compilation of libzoneminder-plugin-openalpr

git clone https://github.com/manupap1/libzoneminder-plugin-openalpr.git
cd libzoneminder-plugin-openalpr
cp -R distros/debian ./
sudo apt-get install debhelper quilt dh-autoreconf pkg-config libboost-program-options1.55-dev libopencv-dev libopencv-core-dev libopencv-imgproc-dev
debuild

Installation of ZoneMinder, OpenALPR and libzoneminder-plugin-openalpr

cd ..
sudo apt-get install libavcodec56 libavdevice55 libavformat56 libavutil54 libbz2-1.0 libc6 libcurl3 libgcc1 libgcrypt20 libgnutls-deb0-28 libgnutls-openssl27 libjpeg62-turbo libmysqlclient18 libpcre3 libstdc++6 libswscale3 libvlc5 zlib1g debconf init-system-helpers perl libdevice-serialport-perl libimage-info-perl libjson-any-perl libsys-mmap-perl liburi-encode-perl libwww-perl libarchive-tar-perl libarchive-zip-perl libdate-manip-perl libdbi-perl libmodule-load-conditional-perl libmime-lite-perl libmime-tools-perl libnet-sftp-foreign-perl libphp-serialization-perl libav-tools rsyslog netpbm zip policykit-1 apache2 libapache2-mod-php5 php5 php5-mysql mysql-server
sudo dpkg -i libzoneminder-perl_*_all.deb zoneminder-database_*_all.deb zoneminder-core_*_amd64.deb zoneminder-ui-base_*_amd64.deb zoneminder-ui-classic_*_all.deb libopenalpr2_*_amd64.deb libopenalpr-data_*_all.deb libzoneminder-plugin-openalpr_*_amd64.deb

Configuration

After installation, please make some adjustments in file /etc/zm/plugins.d/openalpr.conf. Most of default values can be kept, but if you live in Europe, you can set the country_code setting to eu to improve reading of plates with EU format

All the next configuration steps are done through the web interface.

Firstly, the plugin loading has to be enabled in ZM options (please check the LOAD_PLUGIN setting in Config tab).

Then, you can configure the plugin settings from each Zone configuration page.

Zone

Available plugins are listed with a color code under the Plugins row:

Once a plugin object is loaded, the Plugin configuration page is accessed by clicking on the plugin name.

Plugin

The first options are available for all plugins:

The next options are specifics to this plugin and can be used to adjust the detection accuracy:

The configuration is saved to the database and applied when clicking on the Save button.

Using

When a license plate is detected, this triggers an event with alarmed frame(s). Depending on your configuration settings and video content, an event may contain multiple alarmed frames.

Events

Licenses plates are stored in the event note field accessible by a click on the event detection cause.

Event

Alarmed frames are highlighted with the plate's detection area(s).

Frame

The detected plate number(s) can be added in email or sms notifications by using the %ED% token in EMAIL_BODY or MESSAGE_BODY option.

Improvement / Contribution

Feel free to contribute, if you can:

I am personally not in a position to provide videos content to test the plugin in all conditions. After some search to find footage with good quality and with optical settings adapted for LPR, I found this video on youtube: https://www.youtube.com/watch?v=ECIxQblzNWI. The video has been published by iFacility Group (http://www.ifacility.co.uk) and is currently included in the misc folder.

Any new video content is welcomed, if it meets the following criterias: