您的位置:首页 > 运维架构

openalpr编译步骤-vs2013

2017-03-20 14:17 225 查看
最近公司在搞车牌,偶然间发现国外一个比较好的车牌开源项目,于是决定移植过来学习学习。

本文最终实现openalpr在VS2013下的移植。参考网上很多资料,发现openalpr下还用到了很多其他的库,在此贴出我用的库。

giflib416-static-mtdll.lib

libjpeg8c-static-mtdll.lib

liblept171-static-mtdll.lib

libpng143-static-mtdll.lib

libtesseract304-static.lib

libtiff394-static-mtdll.lib

zlib128-static-mtdll.lib

这里贴出的是64位Release静态库,当然还有Debug版本,动态库的版本,32位的版本。

知道依赖库了,首先就是移植,编译这些依赖库。其中最重要的就是libtesseract304-static.lib

因为openalpr依赖于libtesseract304-static.lib,libtesseract304-static.lib再依赖于上面列出的其他库。

首先,我们移植libtesseract工程,项目主页为:https://github.com/tesseract-ocr/tesseract 因为我的是vs2013,所以参考的教程是https://vorba.ch/2014/tesseract-3.03-vs2013.html

 

下面一步一步贴出我移植的步骤:

1、安装环境,包括Git,SVN,OPENCV。并且需要更新这些执行文件到环境变量里面。

2、Building thedependencies

基本按照教程走,只是把目录换成我自己的了。

3、BuildingTesseract

这里需要注意的是,Tesseract代码已经不在Google管理了,所以SVN下载的时候要换成GitHub的地址。https://github.com/tesseract-ocr/tesseract

再按照教程走就能得到Tesseract的vs2013的工程了。这里注意vs中要配置属性中的opencv库。

4、按照这个教程,移植openalpr为vs2013的工程。

2015年2月2日发布

Update: Building OpenALPR with GCCtested on Windows 10 (More Easy Way)

Click Here: https://youtu.be/YYvxUef3l3E

How to statically compiling, linking and using OpenALPR and Tesseract withVisual Studio 2013 on Windows?

All library is official I used. it consists of five parts:

Part 1: Downloading, installing and extracting tools.

Part 2: Building Tesseract OCR

Part 3: Reconfiguring OpenALPR with CMAKE for VS2013

Part 4: Building OpenALPR

Part 5: Using and testing OpenALPR

--------------------------------- PART 1 ----------------------------------

Let's download tools before

CMAKE WINDOWS INSTALLER: http://www.cmake.org/download/

OPENCV: http://sourceforge.net/projects/openc...

TESSERACT SOURCE CODES: https://tesseract-ocr.googlecode.com/...

TESSERACT INCLUDES: https://tesseract-ocr.googlecode.com/...

TESSERACT VS2008: https://tesseract-ocr.googlecode.com/...

LEPTONICA INCLUDES: https://leptonica.googlecode.com/file...

OPENALPR SOURCE CODES: https://github.com/openalpr/openalpr/...

I have already installed CMAKE

I have already downloaded TESSERACT

I have already downloaded LEPTONICA

I have already downloaded OPENALPR

I have already downloaded OPENCV

I extracted OpenCV 3.0 to "D:\GoruntuIsleme\OpenCV" directory

I will extract all codes to "C:\build" directory

PART 1 IS COMPLETE
注1:
CMAKE和OPENCV自己在網上下載就可以了。
TESSERACT和LEPTONICA庫就用上面編譯出來的庫。

-------------------------------- PART 2 ----------------------------------

I WILL BUİLD TESSERACT

Follow me now

I using libtesseract project 

I changing project to "Release" mode

I adding INCLUDE DIRS to project

Finally I building project+

it is not important

Follow me for this message

rebuild

It was successfuly builded+

Now I moving .lib file to lib directory

PART 2 IS COMPLETE
注2:
此步驟就是將上面編譯出來的庫拷貝到openalpr源代碼的lib目錄下,并把頭文件放到include目錄下。

--------------------------------- PART 3 ----------------------------------

I WILL RECONFIGURE OPENALPR

I creating new folder for reconfigured codes for VS2013

I opening CMAKE

I adding path of openalpr source codes to CMAKE

I setting reconfigured source codes path

I setting CMAKE for Visual Studio 2013

I adding LEPTONICA and TESSERACT path

I adding OPENCV build path

I generating reconfigureed project+

Generating done

PART 3 IS COMPLETE

--------------------------------- PART 4 ----------------------------------

I WILL BUILD OPENALPR

I opening Reconfigured OpenALPR code: "src.sln"

I changing project to "Release" mode

I removing "openalpr" project from "Solution Explorer"because is dynamic library

I building "openalpr-static" project

Follow me for this error

I rebuilding now

it is done

I adding Tesseract lib directory to "AdditionalLibraryDirectories" on"alpr" project

I changing "Additional Dependencies"; openalpr.lib toopenalpr-static.lib

I adding following lines to "Additional Dependencies"

libtesseract302-static.lib

liblept168-static-mtdll.lib

libtiff394-static-mtdll.lib

libjpeg8c-static-mtdll.lib

libpng143-static-mtdll.lib

giflib416-static-mtdll.lib

I changing "Image Has Safe Exception Handlers" to NO

I adding same settings to "unittest" project.

I building...

It was successfully builded

aplr.exe and unittest.exe in here

PART 4 IS COMPLATE
注3:
附加庫的名稱要用剛才添加到lib目錄下的名稱,不然會存在找不到庫的問題。

--------------------------------- PART 5 ----------------------------------

I WILL TEST OPENALPR WITH A CAR IMAGE

At first, This folder not important, is empty, you can delete it

I adding OPENCV bin dir to PC Environment

I copying runtime_data folder to Release folder

I copying openalpr.conf to Release folder

I copying image file to Release folder

I opening CMD

cd into Release

And running alpr.exe with this:

alpr dd.jpg -c eu

ALL DONE

THANKS FOR WATCHING

Mr. Kozmon

Byee+
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息