车牌识别 opencv linux,Edison + opencv + webcam 实现车牌识别

1. Edison basic environment setup:

2. download the latest image: edison-image-ww05-15.zip from:

这个image 已经支持了web camera kernel module.

3. flash edison-image-ww05-15.zip image.

4. 切换到USB host mode,就是把switch拨向usb standard A port. connect a uvc compatable usb camera in the standard A port. 如何确认你的摄像头是uvc compatiable:

root@edison:~/opencv# lsmod

Module                  Size  Used by

uvcvideo               71516  0

videobuf2_vmalloc      13003  1 uvcvideo

videobuf2_memops       13001  1 videobuf2_vmalloc

videobuf2_core         37707  1 uvcvideo

usb_f_acm              14335  1

u_serial               18582  6 usb_f_acm

g_multi                70813  0

libcomposite           39245  2 usb_f_acm,g_multi

bcm_bt_lpm             13676  0

bcm4334x              578947  0

root@edison:~/opencv# lsusb

Bus 001 Device 002: ID 046d:081b Logitech, Inc. Webcam C310

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

5. Use the code:

we can get the image captured by the usb camera, then we have approved that the webcamera is working well.

6. 从github上获取车牌识别的代码:

7. 在eclipse中创建EasyPR project.

怎么在eclipse的环境中创建一个edison的项目:

http://tec.gekius.com/blog/1069.html

easypr用到了opencv,在上述的过程中需要加入opencv的支持:file:///C:/Users/Administrator/AppData/Local/YNote/data/qqDD2686A7B2EA8359FD8F84A95101F0A8/992c40f8fb7a4ae59279cac0bd2b1603/clipboard.png

Add the opencv include in the include path:

${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/opencv

${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/

${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/c++

${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/i586-poky-linux

${DEVKIT_HOME}/devkit-x86/sysroots/i586-poky-linux/usr/include/c++/bits

file:///C:/Users/Administrator/AppData/Local/YNote/data/qqDD2686A7B2EA8359FD8F84A95101F0A8/649a490fc4c4436d9b2c1b6156f146a9/clipboard.png

in the linker flag add the opencv library.

${LDFLAGS} -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videostab -lrt -lpthread -lm -ldl

file:///C:/Users/Administrator/AppData/Local/YNote/data/qqDD2686A7B2EA8359FD8F84A95101F0A8/18f5f59dd2bc42198d74a00710bcf66a/clipboard.png

8. 编译通过后就可以在edison上运行了。 最后将所得的车牌信息显示在 led上。

use the library: ${LDFLAGS} -lupm-i2clcd

and the headfile is:

#include "jhd1313m1.h"

int main(int argc, char *argv[])

{

cout << "test_plate_recognize start" << endl;

IplImage *frame = NULL;

upm::Jhd1313m1 *lcd = new upm::Jhd1313m1(0, 0x3E, 0x62);

input_camera = cvCaptureFromCAM(-1);

signal(SIGINT,sigroutine);

int result;

char c;

while (1)

{

#ifdef CAMERA_CAPTURE

frame = cvQueryFrame(input_camera);

if(frame!=NULL)

{

cvSaveImage("car_detect.png",frame);

}

Mat src = imread("car_detect.png");

#else

Mat src = imread("image/test.jpg");

#endif

c = getchar();

if(c!='e'|| c!='E')

{

CPlateRecognize pr;

pr.LoadANN("model/ann.xml");

pr.LoadSVM("model/svm.xml");

pr.setLifemode(true);

pr.setDebug(true);

vector plateVec;

result = pr.plateRecognize(src, plateVec);

if (result == 0)

{

int num = plateVec.size();

for (int j = 0; j < num; j++)

{

cout << "plateRecognize: " << plateVec[j] << endl;

lcd->setCursor(0,0);

lcd->write(plateVec[j]);

}

}

if (result != 0)

cout << "result:" << result << endl;

}

else

break;

}

cvReleaseCapture(&input_camera);

lcd->close();

return result;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值