0

I'm using OpenCV to implement ANPR program.

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.

enter image description here

There are 3 letters in the plate (that are bounded with the Red rectangles).

there 3 letter cannot detect with cvLabel() because they are stick with plate bound. 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!

TTGroup
  • 3,575
  • 10
  • 47
  • 79

1 Answers1

1

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

Shangtong Zhang
  • 1,579
  • 1
  • 11
  • 18
  • thank you! I tried to use Erosion, It's ok for this image with the proper parameter. But It make lost some foreground pixels of other blobs, so It's not good way to apply for this case. Any more suggestion for me? Thank you! – TTGroup May 19 '16 at 11:41