ANPR project

Starts with a Pi 3B+

sudo apt-get update && sudo apt-get -y upgrade

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

pi@raspberrypi:~ $ sudo apt-get install openalpr openalpr-daemon openalpr-utils libopenalpr-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
beanstalkd fontconfig fontconfig-config fonts-dejavu-core gnome-icon-theme gtk-update-icon-cache hicolor-icon-theme libaacs0 libatk1.0-0 libatk1.0-data libavahi-client3 libavcodec57 libavformat57 libavutil55 libbdplus0 libbluray2 libcairo2 libchromaprint1
libcroco3 libcups2 libdatrie1 libdc1394-22 libdrm-amdgpu1 libdrm-freedreno1 libdrm-nouveau2 libdrm-radeon1 libfontconfig1 libgail-common libgail18 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif7 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgme0
libgraphite2-3 libgsm1 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libilmbase12 libjbig0 liblept5 libllvm3.9 liblog4cplus-1.1-9 libmp3lame0 libmpg123-0 libogg0 libopenalpr-data libopenalpr2 libopencv-calib3d2.4v5 libopencv-contrib2.4v5
libopencv-core2.4v5 libopencv-features2d2.4v5 libopencv-flann2.4v5 libopencv-gpu2.4v5 libopencv-highgui2.4-deb0 libopencv-imgproc2.4v5 libopencv-legacy2.4v5 libopencv-ml2.4v5 libopencv-objdetect2.4v5 libopencv-ocl2.4v5 libopencv-photo2.4v5 libopencv-stitching2.4v5
libopencv-superres2.4v5 libopencv-ts2.4v5 libopencv-video2.4v5 libopencv-videostab2.4v5 libopenexr22 libopenjp2-7 libopenmpt0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpixman-1-0 libraw1394-11 librsvg2-2 librsvg2-common libsensors4 libshine3
libsnappy1v5 libsoxr0 libspeex1 libssh-gcrypt-4 libswresample2 libswscale4 libtesseract-data libtesseract3 libthai-data libthai0 libtheora0 libtiff5 libtwolame0 libtxc-dxtn-s2tc libva-drm1 libva-x11-1 libva1 libvdpau-va-gl1 libvdpau1 libvorbis0a libvorbisenc2
libvorbisfile3 libvpx4 libwavpack1 libwebp6 libwebpmux2 libx11-xcb1 libx264-148 libx265-95 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1
libxrandr2 libxrender1 libxshmfence1 libxvidcore4 libxxf86vm1 libzvbi-common libzvbi0 mesa-va-drivers mesa-vdpau-drivers va-driver-all vdpau-driver-all
Suggested packages:
doc-base libbluray-bdj cups-common gvfs opus-tools libraw1394-doc librsvg2-bin lm-sensors speex
The following NEW packages will be installed:
beanstalkd fontconfig fontconfig-config fonts-dejavu-core gnome-icon-theme gtk-update-icon-cache hicolor-icon-theme libaacs0 libatk1.0-0 libatk1.0-data libavahi-client3 libavcodec57 libavformat57 libavutil55 libbdplus0 libbluray2 libcairo2 libchromaprint1
libcroco3 libcups2 libdatrie1 libdc1394-22 libdrm-amdgpu1 libdrm-freedreno1 libdrm-nouveau2 libdrm-radeon1 libfontconfig1 libgail-common libgail18 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif7 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgme0
libgraphite2-3 libgsm1 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libilmbase12 libjbig0 liblept5 libllvm3.9 liblog4cplus-1.1-9 libmp3lame0 libmpg123-0 libogg0 libopenalpr-data libopenalpr-dev libopenalpr2 libopencv-calib3d2.4v5 libopencv-contrib2.4v5
libopencv-core2.4v5 libopencv-features2d2.4v5 libopencv-flann2.4v5 libopencv-gpu2.4v5 libopencv-highgui2.4-deb0 libopencv-imgproc2.4v5 libopencv-legacy2.4v5 libopencv-ml2.4v5 libopencv-objdetect2.4v5 libopencv-ocl2.4v5 libopencv-photo2.4v5 libopencv-stitching2.4v5
libopencv-superres2.4v5 libopencv-ts2.4v5 libopencv-video2.4v5 libopencv-videostab2.4v5 libopenexr22 libopenjp2-7 libopenmpt0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpixman-1-0 libraw1394-11 librsvg2-2 librsvg2-common libsensors4 libshine3
libsnappy1v5 libsoxr0 libspeex1 libssh-gcrypt-4 libswresample2 libswscale4 libtesseract-data libtesseract3 libthai-data libthai0 libtheora0 libtiff5 libtwolame0 libtxc-dxtn-s2tc libva-drm1 libva-x11-1 libva1 libvdpau-va-gl1 libvdpau1 libvorbis0a libvorbisenc2
libvorbisfile3 libvpx4 libwavpack1 libwebp6 libwebpmux2 libx11-xcb1 libx264-148 libx265-95 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1
libxrandr2 libxrender1 libxshmfence1 libxvidcore4 libxxf86vm1 libzvbi-common libzvbi0 mesa-va-drivers mesa-vdpau-drivers openalpr openalpr-daemon openalpr-utils va-driver-all vdpau-driver-all
0 upgraded, 140 newly installed, 0 to remove and 0 not upgraded.
Need to get 57.4 MB of archives.
After this operation, 299 MB of additional disk space will be used.
Do you want to continue? [Y/n]

sudo apt install python-pip

pip install openalpr picamera

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

sudo systemctl enable nodered.service

npm i node-red-dashboard

import json
from openalpr import Alpr

alpr = Alpr(“gb”, “/etc/openalpr/openalpr.conf”, “/usr/share/openalpr/runtime_data”)
results = alpr.recognize_file(“/home/pi/rate.jpg”)
print(json.dumps(results, indent=4))
alpr.unload()

{
“data_type”: “alpr_results”,
“epoch_time”: 1560138041134,
“img_height”: 2268,
“img_width”: 4032,
“results”: [
{
“plate”: “DX65XMA”,
“confidence”: 87.81337,
“region_confidence”: 0,
“region”: “gb”,
“plate_index”: 0,
“processing_time_ms”: 277.051605,
“candidates”: [
{
“matches_template”: 1,
“plate”: “DX65XMA”,
“confidence”: 87.81337
},
{
“matches_template”: 0,
“plate”: “0X65XMA”,
“confidence”: 79.748543
},
{
“matches_template”: 1,
“plate”: “DX65XHA”,
“confidence”: 79.662643
},
{
“matches_template”: 0,
“plate”: “DX65XA”,
“confidence”: 78.438332
},
{
“matches_template”: 1,
“plate”: “OX65XMA”,
“confidence”: 78.098389
},
{
“matches_template”: 1,
“plate”: “BX65XMA”,
“confidence”: 77.908867
},
{
“matches_template”: 1,
“plate”: “DX65XNA”,
“confidence”: 77.642143
},
{
“matches_template”: 0,
“plate”: “X65XMA”,
“confidence”: 76.91127
},
{
“matches_template”: 1,
“plate”: “GX65XMA”,
“confidence”: 75.897186
},