欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

开源车牌识别项目,OpenALPR

发布时间:2025/3/21 34 豆豆
生活随笔 收集整理的这篇文章主要介绍了 开源车牌识别项目,OpenALPR 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

今天在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

2、到github上下载源码。

git clone https://github.com/openalpr/openalpr.git

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

这里给出了有三种安装方法:Compilation instructions (Ubuntu Linux)

测试

alpr支持命令行,直接在命令行输入alpr [图片文件路径]即可。

下载几幅图片:

wget http://plates.openalpr.com/ea7the.jpg wget http://plates.openalpr.com/h786poj.jpg

识别车牌:

输入指令:

alpr -c us ea7the.jpg

识别结果:

输入指令:

alpr -c eu h786poj.jpg

识别结果:

这里两幅图片的车牌是不同国家的,一个是美国的,一个是欧洲的,-c 表示选择车牌的国家,默认选择美国的。

alpr指令说明:
输入alpr --help查看指令说明:

xhb@xhb-GL552JX:~/Study/OpenALPR/pic$ alpr --helpUSAGE: 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., mdfor Maryland, ca for California)--motionUse motion detection on video file or stream. Default=off--clockMeasure/print the total time to process image and all plates. Default=off-d, --detect_regionAttempt to detect the region of the plate image. [Experimental] Default=off--debugEnable debug output. Default=off-j, --jsonOutput recognition results in JSON format. Default=off--, --ignore_restIgnores the rest of the labeled arguments following this flag.--versionDisplays version information and exits.-h, --helpDisplays usage information and exits.<> (accepted multiple times)(required) Image containing license platesOpenAlpr Command Line Utility

接下来可以愉快地玩耍了,可以去阅读源码或是制作各种应用。
︿( ̄︶ ̄)︿

总结

以上是生活随笔为你收集整理的开源车牌识别项目,OpenALPR的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。