OpenALPR Install for RPI and UDOO and TRE and YUN

This is the way to install on Linux systems like RPI and UDOO – should work well.  thanks to Simon Eriksson

1. Remove the Tesseract and OpenCV packages with apt.  It seems the UDOO libs are at OpenCV 2.3.1 which wont work with the openalpr distro on github.

How to remove an apt application

2. Install all dependencies we will need:

sudo apt-get install autoconf automake libtool
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libtiff4-dev
sudo apt-get install zlib1g-dev
sudo apt-get install git-core
sudo apt-get install cmake
sudo apt-get install liblog4cplus-dev libcurl3-dev uuid-dev
sudo apt-get install build-essential (you may already have this)

3. Clone the openalpr repo to the /home/pi directory and extract it:

cd /home/ubuntu  ( or /home/pi ) 
git clone https://github.com/openalpr/openalpr.git

4. Create a directory to hold our libraries and download them all:

cd openalpr
mkdir libraries
cd libraries
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz
wget http://www.leptonica.org/source/leptonica-1.70.tar.gz
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/opencv-2.4.8.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencvlibrary%2Ffiles%2Fopencv-unix%2F2.4.8%2Fopencv-2.4.8.zip%2Fdownload&ts=1392199888&use_mirror=skylink
mv opencv-2.4.8.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencvlibrary%2Ffiles%2Fopencv-unix%2F2.4.8%2Fopencv-2.4.8.zip%2Fdownload opencv-2.4.8.zip

(the last step is required because of the way SF does its direct linking, there may be a better way to do this)

5. Extract all the packages ready to compile them:

tar -zxvf tesseract-ocr-3.02.02.tar.gz
tar -zxvf leptonica-1.70.tar.gz
unzip opencv-2.4.8.zip

6. Compile Leptonica:

cd leptonica-1.70
./configure
make
make install

7. Compile tesseract:

cd ../tesseract-ocr
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
export TESSDATA_PREFIX=/home/pi/openalpr/libraries/tesseract-ocr/tessdata

8. Extract the tesseract language data:

cd ..
tar -zxvf tesseract-ocr-3.02.eng.tar.gz

9. Compile opencv:

Try this first – it has a good tutorial on OpenCV

http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html

cd opencv-2.4.8
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

10. Update the CMakeLists for openalpr:

cd ../../../src
nano CMakeLists.txt
Change line 22 and 23 to:
SET(OpenCV_DIR "/usr/local/lib")
SET(Tesseract_DIR "/home/pi/openalpr/libraries/tesseract-ocr")

11. Compile openalpr:

cmake ./
make

That should then allow you to run as per the instructions on openalpr

http://www.openalpr.com/

 

 

Advertisements

34 comments

  1. Hi, You said:

    Change line 22 and 23 to:
    SET(OpenCV_DIR “/usr/local/lib”)
    SET(Tesseract_DIR “/home/pi/openalpr/libraries/tesseract-ocr”)

    What is in those lines that should be removed and replaced with these 2 lines? I ask it because I’m using an other version of OpenCV and I think CMakeLists.txt is changed.

    1. Hi the builds seem to have changed now – there are new make lists. Its possible the new cmakeslists wont work with this advice – sorry. My only advice is see if you can install the products and make sure ALPR can see them rather than building them out. We found that a bit easier

  2. I also get this error after executing the last make command in the tutorial:

    In file included from /home/pi/openalpr/src/daemon.cpp:8:0:
    /home/pi/openalpr/src/video/logging_videobuffer.h:5:30: fatal error: log4cplus/logger.h: No such file or directory
    compilation terminated.
    CMakeFiles/alprd.dir/build.make:54: recipe for target ‘CMakeFiles/alprd.dir/daemon.cpp.o’ failed
    make[2]: *** [CMakeFiles/alprd.dir/daemon.cpp.o] Error 1
    CMakeFiles/Makefile2:99: recipe for target ‘CMakeFiles/alprd.dir/all’ failed
    make[1]: *** [CMakeFiles/alprd.dir/all] Error 2
    Makefile:133: recipe for target ‘all’ failed
    make: *** [all] Error 2

  3. I finally compiled OpenALPR, but the results are very bad. I gave the sample from it’s own git repo and it gave me these results,

    plate0: 5 results
    – E3R2X confidence: 86.7075
    – PE3R2X confidence: 83.0183
    – 3E3R2X confidence: 82.2258
    – 9E3R2X confidence: 80.2115
    – RE3R2X confidence: 80.1028
    *** glibc detected *** alpr: munmap_chunk(): invalid pointer: 0x0050ac78 ***
    Aborted

    Sample img: https://camo.githubusercontent.com/6d5fac0f995bea0e8a285bdaed2007e47bdf9f87/687474703a2f2f7777772e6f70656e616c70722e636f6d2f696d616765732f64656d6f73637265656e73686f74732f706c617465332e706e67

  4. Hey. I’ve installed alpr via this guide, and this worked better than the official guide. As OpenCV 2.4.8 wasn’t on the download page, I’ve downloaded 2.4.9, and it INSTALLED! FINALLY!

    However, you forgot to mention to type “make install” after installing alpr itself.

    The problem itself though, is that OpenCV is now whining that libopencv_superres.so.2.4 is missing. I’m going to try to find 2.4.8 and install that as I can’t find superres.so.2.4. You’ll hear from me.

    1. Same person as ^, Google oAuth didn’t work.

      Got it working, I have some notes though:
      -The link for OpenCV 2.4.8 is not working. I’ve used google to find OpenCV 2.4.8 and used FTP to transfer it over. ie link needs to be updated
      -You forgot to “make install” openalpr itself. Don’t forget that :p
      -When using openalpr and it says that lus.traineddata couldn’t be found, due to a weird error, it uses (l + region) as language, which cannot be found obviously. To remedy this, make a copy of eng.traineddata and replace eng with either lus for US or leu for EU region.
      Other than that, nice!

  5. Just installed it using this toturial. But when I run alpr it gives the following error:
    alpr: error while loading shared libraries: libopenalpr.so.2: cannot open shared object file: No such file or directory.
    I tried to find this file on google but without success.

    I used opencv v2.4.9, because I can’t find v2.4.8.I don’t know if this might be the problem.
    Make and make install both did not give any errors.

    I did not do the following step:
    Change line 22 and 23 to:
    SET(OpenCV_DIR “/usr/local/lib”)
    SET(Tesseract_DIR “/home/pi/openalpr/libraries/tesseract-ocr”)
    Because the txt was changed and I think it looks for these directiories automaticly.

    1. When I try to open the file, this happens:
      root@raspberrypi:/home/pi/openalpr/src# /usr/local/lib/libopenalpr.so.2
      Segmentation fault

      1. hello MAurice i got the same problem and i execute that command you gave but no result :/

  6. After making successfully all make I run the command:

    root @ raspberrypi: / home / pi / openalpr / src # alpr –help

    the error that comes back to me is:

    -bash: ALPR: command not found

    what did I wrong?

    thanks, Matteo

    1. So if these are installed on the repo – with yum or apt-get – you need to remove these with those installers. Google is your friend. Thebest plan is to install them from yum and apt-get

  7. Can anyone help me with this error: I’m using Raspberry Pi Model 2 with Raspbian… I’m trying to compile openalpr.. The final ‘Make’…

    In file included from /home/pi/openalpr/src/daemon.cpp:8:0:
    /home/pi/openalpr/src/video/logging_videobuffer.h:5:30: fatal error: log4cplus/logger.h: No such file or directory
    compilation terminated.
    CMakeFiles/alprd.dir/build.make:54: recipe for target ‘CMakeFiles/alprd.dir/daemon.cpp.o’ failed
    make[2]: *** [CMakeFiles/alprd.dir/daemon.cpp.o] Error 1
    CMakeFiles/Makefile2:100: recipe for target ‘CMakeFiles/alprd.dir/all’ failed
    make[1]: *** [CMakeFiles/alprd.dir/all] Error 2
    Makefile:133: recipe for target ‘all’ failed
    make: *** [all] Error 2

    1. Hi, I have had the same issue as BCGUIMARES using openalpr from git, it looks like the first poster Iman had the same problem so maybe has a solution

      1. I installed the dependencies below and it seemed to compile fine after
        sudo apt-get install liblog4cplus-dev
        i was getting another error aswell which was resolved with the following
        sudo apt-get install libcurl4-openssl-dev

  8. I have finished compilation without error and warning.
    However, I have got following error when I run it.
    Do you have any advice?

    ./alpr -c -eu ea7the.ipg
    –(!) Config file ‘/etc/openalpr/openalpr.conf’ does not exist!
    –(!) You can specify the configuration file location via the command line
    –(!) or by setting the environment variable ‘OPENALPR_CONFIG_FILE’

  9. Hello everybody

    I have a problem

    Error openning data file /usr/local/share/tessdata/lus.traıneddata
    please make sure the TESSDATA_PREFIX…
    Failed loading language ‘lus’
    OpenCV Error: Insufficiend memory …

    Screenshot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s