Simple API REST to process image from url and scan for car plates using openalpr
OpenALPR is an open source Automatic License Plate Recognition library written in C++ with bindings in C#, Java, Node.js, and Python. The library analyzes images and video streams to identify license plates. The output is the text representation of any license plate characters.
ALPRservice is just a micro service covering openalpr scan over an API/JSON interface.
Devs tools
$ sudo apt-get install libpng12-dev libjpeg62-turbo-dev libtiff5-dev zlib1g-dev
$ sudo apt-get install build-essential
$ sudo apt-get install autoconf automake libtool
$ sudo apt-get install git-core
$ sudo apt-get install cmake
Prerequisites
$ sudo apt-get install libopencv-dev libtesseract-dev git cmake build-essential libleptonica-dev
$ sudo apt-get install liblog4cplus-dev libcurl3-dev
If using the daemon, install beanstalkd
$ sudo apt-get install beanstalkd
Clone the latest code from GitHub
$ git clone https://github.com/openalpr/openalpr.git
Setup the build directory
$ cd openalpr/src
$ mkdir build
$ cd build
Setup the compile environment
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc ..
Compile
$ make
Install the binaries/libraries to your local system (prefix is /usr)
$ sudo make install
Test
$ wget http://plates.openalpr.com/h786poj.jpg -O lp.jpg
$ alpr -c eu -j lp.jpg
To avoid “libdc1394 error: Failed to initialize libdc1394” line
sudo ln /dev/null /dev/raw1394
Get last version from Github repo:
$ git clone https://github.com/ffr4nz/alprservice.git
You need some requeriment installed:
$ pip install -r requirements.txt
After pip install all libraries service can start using:
$ python alprservice.py -p 4343
Consume API service using /plate/ endpoint
http://alprservice.server.domain:service-port/plate/TopN/Country/URL/
{
"data_type": "alpr_results",
"epoch_time": 1449827429584,
"img_height": 513,
"img_width": 770,
"processing_time_ms": 325.753967,
"regions_of_interest": [],
"results": [
{
"candidates": [
{
"confidence": 88.498375,
"matches_template": 0,
"plate": "3985JCM"
},
{
"confidence": 86.127914,
"matches_template": 0,
"plate": "398SJCM"
},
{
"confidence": 81.407692,
"matches_template": 0,
"plate": "985JCM"
},
{
"confidence": 81.051277,
"matches_template": 0,
"plate": "S985JCM"
},
{
"confidence": 80.932816,
"matches_template": 0,
"plate": "B985JCM"
}
],
"confidence": 88.498375,
"coordinates": [
{
"x": 308,
"y": 384
},
{
"x": 478,
"y": 382
},
{
"x": 479,
"y": 419
},
{
"x": 309,
"y": 421
}
],
"matches_template": 0,
"plate": "3985JCM",
"plate_index": 0,
"processing_time_ms": 76.103065,
"region": "",
"region_confidence": 0,
"requested_topn": 5
}
],
"version": 2
}
GPL
https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Ubuntu-Linux)