Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
linux:howtos:centos:openalpr-compile-from-sources [21/08/2021 14:31] – [Step 4. More dependencies] Juanga Covas | linux:howtos:centos:openalpr-compile-from-sources [13/01/2023 19:53] (actual) – [Too Long, Won't read] Juanga Covas | ||
---|---|---|---|
Línea 15: | Línea 15: | ||
\\ | \\ | ||
+ | |||
+ | ===== Too Long, Won't read ===== | ||
+ | |||
+ | <wrap tip>If you're feeling lucky</ | ||
+ | |||
+ | <code bash [enable_line_numbers=" | ||
+ | # Installing OpenALPR from sources under CentOS 7 | ||
+ | |||
+ | # some " | ||
+ | sudo yum -y install epel-release | ||
+ | sudo yum -y install git wget | ||
+ | sudo yum -y groupinstall " | ||
+ | sudo yum -y install cmake cmake3 curl curl-devel log4cplus-devel | ||
+ | |||
+ | # get OpenALPR sources | ||
+ | mkdir ~/src; cd ~/src | ||
+ | git clone https:// | ||
+ | cd ~/ | ||
+ | |||
+ | # compile Tesseract (and Leptonica), required by OpenALPR | ||
+ | sudo yum -y install autoconf-archive libjpeg-turbo-devel libpng-devel libtiff-devel zlib-devel | ||
+ | cd ~/src | ||
+ | wget http:// | ||
+ | tar -zxvf leptonica-1.81.1.tar.gz | ||
+ | cd leptonica-1.81.1 | ||
+ | ./configure | ||
+ | make | ||
+ | sudo make install | ||
+ | |||
+ | cd ~/src | ||
+ | wget https:// | ||
+ | tar -zxvf tesseract-4.1.1.tar.gz | ||
+ | cd tesseract-4.1.1 | ||
+ | ./ | ||
+ | export PKG_CONFIG_PATH=/ | ||
+ | ./configure --with-extra-includes=/ | ||
+ | make -j$(nproc) | ||
+ | sudo make install | ||
+ | sudo ldconfig | ||
+ | cd ~/ | ||
+ | wget https:// | ||
+ | |||
+ | # compile OpenCV, | ||
+ | sudo yum -y install epel-release git gcc gcc-c++ cmake3 qt5-qtbase-devel python python-devel python-pip cmake python-devel python34-numpy gtk2-devel libpng-devel jasper-devel openexr-devel libwebp-devel libjpeg-turbo-devel libtiff-devel libdc1394-devel tbb-devel numpy eigen3-devel gstreamer-plugins-base-devel freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel libv4l-devel | ||
+ | |||
+ | mkdir ~/ | ||
+ | git clone https:// | ||
+ | git clone https:// | ||
+ | cd ~/ | ||
+ | cmake3 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/ | ||
+ | # this is going to take some minutes... | ||
+ | make -j$(nproc) | ||
+ | sudo make install | ||
+ | sudo ln -s / | ||
+ | sudo ldconfig | ||
+ | pkg-config --modversion opencv4 | ||
+ | |||
+ | # finally, compile OpenALPR | ||
+ | cd ~/ | ||
+ | cmake3 -DCMAKE_CXX_FLAGS=" | ||
+ | make | ||
+ | sudo make install | ||
+ | </ | ||
+ | |||
+ | Finally as **root** user: | ||
+ | # if [ ! -f / | ||
+ | # sudo ldconfig -v | ||
+ | |||
+ | This is needed so alpr doesn' | ||
+ | |||
+ | Test it: | ||
+ | # alpr --version | ||
+ | | ||
+ | alpr version: 2.3.0 | ||
+ | |||
+ | # alpr --help | ||
+ | [...] | ||
+ | |||
+ | \\ | ||
+ | |||
+ | **LONG VERSION AHEAD:** | ||
===== Step 1. Prepare after a fresh MINIMAL CentOS 7 installation ===== | ===== Step 1. Prepare after a fresh MINIMAL CentOS 7 installation ===== | ||
Línea 24: | Línea 105: | ||
We'll need EPEL repo, wget, git and basic development tools like a C/C++ compiler etc. | We'll need EPEL repo, wget, git and basic development tools like a C/C++ compiler etc. | ||
$ sudo yum -y install epel-release | $ sudo yum -y install epel-release | ||
- | $ sudo yum install git wget | + | $ sudo yum -y install git wget |
$ sudo yum groupinstall " | $ sudo yum groupinstall " | ||
| | ||
Now we can install cmake (2) and cmake3 (3.17) which is found on EPEL repo | Now we can install cmake (2) and cmake3 (3.17) which is found on EPEL repo | ||
- | # sudo yum install | + | # sudo yum install cmake cmake3 |
Now the problem is '' | Now the problem is '' | ||
Línea 34: | Línea 115: | ||
The relevant part is to execute the following two commands, assuming you have installed '' | The relevant part is to execute the following two commands, assuming you have installed '' | ||
<code [enable_line_numbers=" | <code [enable_line_numbers=" | ||
- | $ sudo alternatives --install / | + | sudo alternatives --install / |
- | --slave /usr/local/git-receive-pack git-receive-pack | + | --slave /usr/local/bin/ctest ctest /usr/bin/ctest \ |
- | --slave /usr/local/git-shell git-shell | + | --slave /usr/local/bin/cpack cpack /usr/bin/cpack \ |
- | --slave /usr/local/ | + | --slave / |
- | --slave / | + | --family |
- | --family | + | |
- | $ sudo alternatives --install / | + | sudo alternatives --install / |
- | --slave /usr/local/ | + | --slave / |
- | --slave | + | --slave / |
- | --slave /usr/local/git-shell git-shell / | + | --slave / |
- | --slave | + | --family |
- | --slave /usr/local/ | + | |
- | --slave | + | |
- | --family | + | |
</ | </ | ||
Test '' | Test '' | ||
Línea 86: | Línea 163: | ||
First we need to compile **Leptonica** (a software for image processing and analysis), which is a dependency of Tesseract. | First we need to compile **Leptonica** (a software for image processing and analysis), which is a dependency of Tesseract. | ||
- | $ sudo yum install autoconf-archive libjpeg-turbo-devel libpng-devel libtiff-devel zlib-devel | + | $ sudo yum -y install autoconf-archive libjpeg-turbo-devel libpng-devel libtiff-devel zlib-devel |
$ cd ~/src | $ cd ~/src | ||
$ wget http:// | $ wget http:// | ||
Línea 96: | Línea 173: | ||
Check if libpng is installed: type '' | Check if libpng is installed: type '' | ||
+ | |||
Check if leptonica is installed: type '' | Check if leptonica is installed: type '' | ||
Now let's compile the latest Tesseract released, 4.1.1 at the time of this writing. The process was smooth too: | Now let's compile the latest Tesseract released, 4.1.1 at the time of this writing. The process was smooth too: | ||
$ cd ~/src | $ cd ~/src | ||
- | $ wget https:// | + | $ wget https:// |
$ tar -zxvf tesseract-4.1.1.tar.gz | $ tar -zxvf tesseract-4.1.1.tar.gz | ||
$ cd tesseract-4.1.1 | $ cd tesseract-4.1.1 | ||
Línea 133: | Línea 211: | ||
So we need **OpenCV**, a real-time optimized Computer Vision library, another dependency of // | So we need **OpenCV**, a real-time optimized Computer Vision library, another dependency of // | ||
- | We have a " | + | We have a " |
$ sudo yum list opencv-devel | $ sudo yum list opencv-devel | ||
Línea 146: | Línea 224: | ||
**Why not, we're going to build OpenCV from sources** to get OpenCV **4.x**, which is a bit of extra pain, but this guide helped: https:// | **Why not, we're going to build OpenCV from sources** to get OpenCV **4.x**, which is a bit of extra pain, but this guide helped: https:// | ||
- | $ sudo yum install epel-release git gcc gcc-c++ cmake3 qt5-qtbase-devel python python-devel python-pip cmake python-devel python34-numpy gtk2-devel libpng-devel jasper-devel openexr-devel libwebp-devel libjpeg-turbo-devel libtiff-devel libdc1394-devel tbb-devel numpy eigen3-devel gstreamer-plugins-base-devel freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel libv4l-devel | + | $ sudo yum -y install epel-release git gcc gcc-c++ cmake3 qt5-qtbase-devel python python-devel python-pip cmake python-devel python34-numpy gtk2-devel libpng-devel jasper-devel openexr-devel libwebp-devel libjpeg-turbo-devel libtiff-devel libdc1394-devel tbb-devel numpy eigen3-devel gstreamer-plugins-base-devel freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel libv4l-devel |
$ mkdir ~/ | $ mkdir ~/ | ||
Línea 202: | Línea 280: | ||
===== Step 5. Dependencies resolved, let's try to make ===== | ===== Step 5. Dependencies resolved, let's try to make ===== | ||
+ | |||
+ | Let's finally compile this thing. | ||
+ | |||
+ | <WRAP INFO round> | ||
+ | $ cd ~/ | ||
+ | $ cmake -DCMAKE_CXX_FLAGS=" | ||
+ | $ make | ||
+ | $ sudo make install | ||
+ | The '' | ||
+ | </ | ||
+ | |||
+ | Long version: | ||
$ cd ~/ | $ cd ~/ | ||
Línea 223: | Línea 313: | ||
Evertyhing ok? | Evertyhing ok? | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ===== Finally, alpr command available, but it works? ===== | ||
Let's try if the '' | Let's try if the '' | ||
Línea 242: | Línea 336: | ||
\\ | \\ | ||
- | ===== Woohoo! alpr command | + | ===== Woohoo! alpr command |
Get an image of a vehicle plate, say '' | Get an image of a vehicle plate, say '' |