http://blog.csdn.net/hongbin_xu/article/details/76377238
今天在github上看到了一个开源的车牌识别项目,OpenALPR。github链接
我以前自己在MATLAB上编写了一个简单的车牌识别的程序,使用的是传统模板匹配法。只是有了初步的效果,还有很多需要完善的。
博文链接:数字图像处理:基于MATLAB的车牌识别项目
简介
OpenALPR是一种使用C ++编写的开源自动车牌识别库,还能支持:
C#,Java,Node.js,Go和Python。
该库可以分析图像和视频流以识别车牌。
输出的结果是车牌上的字符。
环境配置
OpenALPR需要这些依赖的库:
- Tesseract OCR v3.0.4 (https://github.com/tesseract-ocr/tesseract)
- OpenCV v2.4.8+ (http://opencv.org/)
1、安装一些相关的库。
# Install prerequisites
sudo apt-get install libopencv-dev libtesseract-dev git cmake build-essential libleptonica-dev
sudo apt-get install liblog4cplus-dev libcurl3-dev
# If using the daemon, install beanstalkd
sudo apt-get install beanstalkd
- 1
- 2
- 3
- 4
- 5
- 6
2、到github上下载源码。
git clone https://github.com/openalpr/openalpr.git
- 1
3、编译源码并安装。
# Setup the build directory
cd openalpr/src
mkdir build
cd build
# setup the compile environment
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc ..
# compile the library
make
# Install the binaries/libraries to your local system (prefix is /usr)
sudo make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
这里给出了有三种安装方法:Compilation instructions (Ubuntu Linux)
测试
alpr支持命令行,直接在命令行输入alpr [图片文件路径]
即可。
下载几幅图片:
wget http://plates.openalpr.com/ea7the.jpg
wget http://plates.openalpr.com/h786poj.jpg
- 1
- 2
识别车牌:
输入指令:
alpr -c us ea7the.jpg
- 1
识别结果:
输入指令:
alpr -c eu h786poj.jpg
- 1
识别结果:
这里两幅图片的车牌是不同国家的,一个是美国的,一个是欧洲的,-c 表示选择车牌的国家,默认选择美国的。
alpr指令说明:
输入alpr --help
查看指令说明:
xhb@xhb-GL552JX:~/Study/OpenALPR/pic$ alpr --help
USAGE:
alpr [-c <country_code>] [--config <config_file>] [-n <topN>] [--seek
<integer_ms>] [-p <pattern code>] [--motion] [--clock] [-d]
[--debug] [-j] [--] [--version] [-h] <> ...
Where:
-c <country_code>, --country <country_code>
Country code to identify (either us for USA or eu for Europe).
Default=us
--config <config_file>
Path to the openalpr.conf file
-n <topN>, --topn <topN>
Max number of possible plate numbers to return. Default=10
--seek <integer_ms>
Seek to the specified millisecond in a video file. Default=0
-p <pattern code>, --pattern <pattern code>
Attempt to match the plate number against a plate pattern (e.g., md
for Maryland, ca for California)
--motion
Use motion detection on video file or stream. Default=off
--clock
Measure/print the total time to process image and all plates.
Default=off
-d, --detect_region
Attempt to detect the region of the plate image. [Experimental]
Default=off
--debug
Enable debug output. Default=off
-j, --json
Output recognition results in JSON format. Default=off
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
--version
Displays version information and exits.
-h, --help
Displays usage information and exits.
<> (accepted multiple times)
(required) Image containing license plates
OpenAlpr Command Line Utility
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
接下来可以愉快地玩耍了,可以去阅读源码或是制作各种应用。
︿( ̄︶ ̄)︿