简体   繁体   English

如何提取车牌号?

[英]How to extract the numbers in license plate?

I'm using OpenCV to implement ANPR program. 我正在使用OpenCV实施ANPR程序。

I tried to extract the numbers in the plate. 我试图提取盘子里的数字。 The sample code is below 示例代码如下

adaptiveThreshold(src_gray, binary_image, THESHOLD_MAX, ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY_INV, BLOCK_SIZE, MEAN_OFFSET);

CvBlobs blobs;
IplImage binary = binary_image;
IplImage *labelImg = cvCreateImage(cvGetSize(&binary), IPL_DEPTH_LABEL, 1);
unsigned int result = cvLabel(&binary, labelImg, blobs);
cvReleaseImage(&labelImg);
cvFilterByArea(blobs, DETECT_BLOB_AREA_MIN, DETECT_BLOB_AREA_MAX);

Everything is almost OK with the adaptiveThreshold() and `cvLabel(), however there are some images give the ouput of adaptiveThreshold() is not good, the following is an example. 使用adaptiveThreshold()和`cvLabel()几乎一切都可以,但是有些图像给出了AdaptiveThreshold()的输出不好,下面是一个示例。

在此处输入图片说明

There are 3 letters in the plate (that are bounded with the Red rectangles). 印版中有3个字母(以红色矩形为边界)。

there 3 letter cannot detect with cvLabel() because they are stick with plate bound. cvLabel()无法检测到3个字母,因为它们粘在板上。 In this case, my algorithm cannot extract these letter. 在这种情况下,我的算法无法提取这些字母。

Someone tell me there are any way to extract those 3 letter in this case? 有人告诉我在这种情况下有什么方法可以提取这三个字母吗?

Thank you very much! 非常感谢你!

You may want to use eroding. 您可能要使用腐蚀。 Erosion can remove some part of image. 侵蚀会去除图像的某些部分。 It's very likely that erosion can remove the connection part between plate bound and letter. 腐蚀很可能会去除印版装订和字母之间的连接部分。 http://docs.opencv.org/2.4/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html http://homepages.inf.ed.ac.uk/rbf/HIPR2/erode.htm http://docs.opencv.org/2.4/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html http://homepages.inf.ed.ac.uk/rbf/HIPR2/erode.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM