# Licence plate detection with different backgrounds

I just studied the Algorithm of ANPR (Automatic Number Plate Recognition) from the chp 5 of book Packtpub.Mastering.OpenCV.with.Practical.Computer.Vision.Projects in which they detect the vehicle licence plate , but their are some restriction in that algorithm , i call it restriction because its specific for one country and can not be used in my country , well in that algorithm they use the following algorithms to detect the licence plate area

Sobel filter
Threshold operation (otsu)
Close Morphological operation
Svm classifier


But the thing they used is the background color of licence plate as their keypoint for the recognition and detection , but in my area licence plate have different backgrounds , most common are black , white and green , green is not much common but rarely used , black background used white number and white contain black numbers , they use floodfill algorithm for white background , but what should i use for 2 different backgrounds ?

Is this matter from how much distance you take the image ?
What is the height and width of licence plate ?
What are the height and width of characters on the plate ?
What are the distances between the characters ?

edit retag close merge delete

Hi , can you please tell me that after drawing the contours on the image .how did you extract the plate . I am even following the Mastering Opencv text book . but got stucked how to crop the plate. Thanks in advance.

( 2014-02-17 01:58:29 -0600 )edit

detecting rectangular region and than using SVM approach

( 2014-02-20 09:28:05 -0600 )edit

Sort by ยป oldest newest most voted

Here are a few ideas:

First convert from color to grayscale. It looks like you have fairly good contrast already. There are various methods to perform this conversion; choose the simplest at first: gray = (red + green + blue)/3. Quite often you don't need anything better than that. For some applications, using just the green color plane is sufficient.

If you want the algorithm to operate on black text, but if some images have white or light text on a dark background, reverse the polarity of the grayscale image by swapping grayscale 255 for 0, 254 for 1, and so on until all images have black text on a light-color background. You'll need an algorithm to detect when this is necessary, OR you can run an algorithm on the original grayscale image and on the negative (reversed brightness) image and choose the better result. Keep in mind that the "close" morphological operation has a different meaning for light-on-dark text versus dark-on-light text.

Investigate some adaptive thresholding methods. Using a global Otsu threshold can be problematic--if possible, you should first have some sort of method to detect regions that are likely to be license plates, and then threshold and binarize those regions only. Thresholding an entire image will likely cause trouble.

Look into the Stroke Width Transform and improvements upon it. The SWT or equivalent can help either with segmentation, or with identifying likely license plate regions, or possibly even with providing edges useful for identification.

Since in your region there are only a few color combinations, you might be able to create some method that would could a template for every possible color combination and then try to find a match at each of several image scales. The license plate might be 400 x 250 pixels, or 100 x 65 pixels, or whatever. For multiscale operations, consider holding an image pyramid in memory. In some cases you can perform an initial match in the smallest image of the pyramid and work your way down. With some modification you could create an image pyramid has a scaling factor of less than 2 from level to level.

Pull the sample images into Photoshop or GIMP and play around with the filters. You may be surprised to find a filter that is helpful.

Whenever possible, work on raw, uncompressed images rather than on JPEGs or other compressed images.

You may not have much of a choice in hardware, but given the fuzzy look of your "LEA 1956" sample, it'd be nice to have more resolution (more pixels per image) and/or sharper optics and/or a raw image instead of a JPEG.

Try to generate the best possible images that you can with pre-processing before your SVM goes to work. Thresholding is often the weak link here. Thresholding and binarization is a common approach, but when you see how noisy a binary image can be you should think very hard whether that is the kind of image you actually want to ...

more

Official site

GitHub

Wiki

Documentation