前提已安装opencv,默认安装目录,资源存放目录/usr/local/src,for mark
资源版本:
opencv3.3.0;log4cplus2.0;tesseract 4.00.00;leptonica-1.74.4;openalpr2.3。
资源网站:
https://github.com/opencv
https://sourceforge.net/projects/log4cplus/files/log4cplus-stable/2.0.0/https://github.com/tesseract-ocr/tesseract
http://www.leptonica.org/
https://github.com/openalpr/openalpr
1.编译log4cplus新版1.2-3.1以后,不要从网页clone,缺少头文件
./configure CXXFLAGS="-std=c++0x"
make
make install
2.安装依赖库
sudo apt-get install g++ # or clang++ (presumably)
sudo apt-get install autoconf automake libtool
sudo apt-get install autoconf-archive
sudo apt-get install pkg-config
sudo apt-get install libpng-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libtiff5-dev
sudo apt-get install zlib1g-dev
//训练
sudo apt-get install libicu-dev
sudo apt-get install libpango1.0-dev
sudo apt-get install libcairo2-dev
3.编译安装leptonica需要前面那些库安装完整,否则后面问题一堆
./configure --prefix=/usr/local
make
make install
4.编译安装tesseract
//修改ccutil/unichar.h 增加using std::string;
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
5.编译安装openalpr
gedit CMakeLists.txt &
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
SET(OpenCV_DIR "/usr/local/lib")
SET(Tesseract_DIR "/usr/local/src/tesseract-ocr")
cmake ./
//修改alprd.dir buid.make alprd: /usr/local/lib/liblog4cplus.so
make
make install
6.copy tessdata字体集到$TESSDATA_PREFIX(/usr/local/share/)
7.验证tesseract
root@ubuntu:/work/OCR/photo# tesseract -v
tesseract 4.00.00alpha
leptonica-1.74.4
libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8
Found AVX2
Found AVX
Found SSE
8.验证alpr
root@ubuntu:/work/OCR/photo# alpr --version
alpr version: 2.3.0