I want to perform automatic character recognition on licence plates. One of my preprocessing step is binarization. However I have four different class of images and I have to use a different automatic thresolding algorithm on each class to get good binarization results.

I would like to choose the right algorithm automaticaly, my idea is to first perform classification on the licence plates images. In the following picture, each row represent a class.



I'm working with MATLAB, how can I do that?? what is the best way? Any ideas are appreciated.


2 Answers 2


Here's a procedure you should try in a first attempt :

You have RGB images, so each images is a 3*RC matrix, where R is the number of rows and C the number of columns.
We will consider each pixel of an image as a realization of a random vector $\mathbf{x}$ of dimention 3. Hence, having an image, you have R
C realization of $\mathbf{x}$. With the classification exemple you gave, each classe has 4 images, so we have 4*R*C realization of $\mathbf{x}$. We are abble to estimate some stastical moments, that we hope will be good descriptor, such as mean, covariance etc ... (mean can be estimated with empirical mean or median).
Let's just stick with the mean for now. Let us call $m_1,m_2,m_3,m_4$ the means of each class you gave.
Now we have a new image we want to classify, we estimate it's 3-dimensional mean $\mathbf{\mu}$, then using nearest neighbour, the class is given by : $$ C=\arg_i\min\left(\lVert\mathbf{\mu}-m_i \rVert _2\right) $$

This is very basic.
You may improve this scheme using additional features like variance (diagonal of the covariance matrix) or covariance matrix. You may estimate variance or covariance using empirical variance or empirical covariance estimator (realy just the classical formulae). However the euclidian distance won't be a good distance since you will comparing inhomogenous vector (the features will be composed of mean + covariance), you'll want to use a more advanced distance such as Bhattacharyya distance for the special case of gaussian distribution.

  • $\begingroup$ Thanks dear @Antoine ,I have many license plate images which I must binarize them, I binarize these LP images with 4 adaptive thresholding methods, I want to automate this process(choose corresponding method to License Plate image).therefore I couldn't Binarize them first. $\endgroup$
    – Karo Amini
    Commented Jun 1, 2015 at 12:30
  • $\begingroup$ Are the results between your 4 methods realy very differents ? You'll always have false alarms and miss detections, don't you have one method that provide good results on average ? please give more precision about what you already tried (eventualy add images) $\endgroup$ Commented Jun 1, 2015 at 12:34
  • $\begingroup$ Dear @Antoine cuz of variety of my LP images, I couldn't Binarize all of em with single method.I had to use 4 algorithm to Binarize them.so I want to classifying LP images and then Binarize them. $\endgroup$
    – Karo Amini
    Commented Jun 1, 2015 at 12:43
  • $\begingroup$ Ok, my bad, I didn't understand that each line of your image was a class. Have you tried to perfom simple classification algorithm (logistic regression and SVM) with imple features like : median / std of the red component of the image + median / std of the grey-level image ? given your images, it looks like than even a neareast neighour method could work : manualy build some classes, estimate the RGB probability density of all the pixel of the classes using a kernel density estimator (or even regular histogram if you have enough pixel) $\endgroup$ Commented Jun 1, 2015 at 13:06
  • $\begingroup$ then associate each new image to the class such that the euclidian norm of the class RGB pdf minus the images RGB pdf is minimum. $\endgroup$ Commented Jun 1, 2015 at 13:10

Take a look at this example that uses MSER regions to detect text, and the ocr function to recognize it.

  • $\begingroup$ Dear @Dima , I really appreciate what you have done for me. "Automatically Detect and Recognize Text in Natural Images" is a great algorithm.I try it on my LP images, but unfortunately this algorithm has not satisfying results on my images.quality of my image is so bad :( . Thanks you again (f) . $\endgroup$
    – Karo Amini
    Commented Jun 2, 2015 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.