Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to detect the Licence plate?

I am trying to detect the number plate in an image. Usually licence plates in my country are black texts with white or yellow background. So, I detect these colors from an image. But my algo gives me everything except the licence plate. The code I used is

Mat img_hsv;
cvtColor(input_image, img_hsv, CV_BGR2HSV);

Mat img_yellow;
int lowerHue = 22;  //For yellow
int upperHue = 38;
inRange(img_hsv, Scalar(lowerHue, 100, 100), Scalar(upperHue, 255, 255), img_yellow);

Mat img_white;
inRange(img_hsv, Scalar(0, 0, 200), Scalar(255, 55, 255), img_white);

Mat img_black;
inRange(img_hsv, Scalar(0, 0, 0), Scalar(255, 55, 50), img_black);

Mat mask = img_black + img_white + img_yellow;
Mat img_result;
bitwise_and(input_image, input_image, img_result, mask);

and the result is image description