Hello this is my sample image I am going to do real time character detection on images like that.

I've tried SURF, SIFT, MSER and template matching on original image without any preprocessing. I can detect characters but when the image changes this feature detection methods does not work because there isn't a lot of interested points in the characters on the image. I am not exactly sure what kind of preprocessing I should do for higher accuracy.

so my question is what methods can you guys suggest me to do for character detection with higher accuracy.

thanks in advance.

enter image description here


1 Answer 1


Here is what I did for a client (What you are asking is the same).

Assuming that you have access to certain type of a pattern on the image (or the center of the hole), you could always detect the template to obtain the location of a possible unwarp:

Pattern matching

Note that in the transformed image, two region of interests are defined and the region within which we would like to read the characters is the torus lying between two circles. Using this information, we could warp this image using an inverse polar transform to obtain:


I also provide the MATLAB code for this transformation at this file-exchange post.

In the next step, thanks to the template matching, the characters to be read always lie in the local region defined in the image above. Now, if you have appropriate illumination the character segmentation is nothing but a trivial set of image processing operations:

character segmentation

The connected components obtained eventually are fed into a neural network or an SVM, first to train and then to classify. This part is composed only of a basic machine learning task, which I won't go into the details, here.

Don't forget to take good care of the illumination, as it is almost solving the problem half way.

  • $\begingroup$ thanks for the answer! do you mind sharing inverse polar function to obtain linear image ? $\endgroup$ Commented Dec 30, 2014 at 14:02
  • 1
    $\begingroup$ I posted a sample implementation to MATLAB FileExchange. You can find it here: mathworks.com/matlabcentral/fileexchange/48911 $\endgroup$ Commented Dec 30, 2014 at 16:23
  • $\begingroup$ @TolgaBirdal Is it possible for you to explain how you implemented the character segmentation? $\endgroup$
    – ahasbini
    Commented Aug 16, 2017 at 8:41
  • $\begingroup$ Well, respectively, it's composed of local thresholding + connected component analysis + size filtering + dynamic programming to divide the remaining region of interest into individual characters. I think every step is self descriptive : ) $\endgroup$ Commented Aug 16, 2017 at 21:12
  • 1
    $\begingroup$ yes it would connect it. Then one could search over the possible division points and split the 'pend' text horizontally into disjoint pieces. This will result in 'p', 'e', 'n' and 'd'. To decide where to chop it up, one can use many techniques including some form of a dynamic programming to globally satisfy constraints. I won't get into details of this now. A simple greedy approach would just cut the text from a point where the character width is sufficiently large and the touching point is a few pixels. $\endgroup$ Commented Aug 21, 2017 at 9:33

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.