0

I am trying to extract character' images from a text line image, so that I can feed these images into my K-Nearest Neighbor classification (I am building my own OCR system).

I have retrieve the text line image, and wonder how should I proceed to extract the characters.

My first attempt is to use horizontal projection to cut the images (from the binary image): Horizontal Projection

My second attempt is to retrieve the contours for connected components, and tread them as separated characters. This attempt get good results, but for example the letter 'i' cannot be retrieved because of two disconnected contours.

Both these attempt failed when the two characters are too close (or collapsed) on each other.

Do you have any suggestions? I'm trying a way to combine two of them but still unsuccessful.

Note: this is for learning purposes. That's why I don't want to use existing solutions, except using OpenCV for normal image processing. The K-Nearest Neighbor is mandatory, since it's the main part of this OCR system.

npvinhphat
  • 33
  • 1
  • 1
  • 4
  • 1
    Using vertical projection histogram should work good enough in this context. You just need to set a threshold on the projection histogram to retrieve the _between letters_ space. You can have a look [here](http://stackoverflow.com/a/35014061/5008845) which does basically the same thing (in horizontal to extract text line, instead of vertically to extract single letters) – Miki Nov 08 '16 at 13:30
  • @Miki I have tried that method, but the problem is when two characters are close to each other, it cannot be detected. Do you have any solutions, or perhaps a way to get optimum threshold for cutting the characters by horizontal projection? – npvinhphat Nov 08 '16 at 16:01
  • To me it seems that you can cut the histogram at 10000 – Miki Nov 08 '16 at 16:52
  • @AtM5 IMHO you need to expect that this method of segmentation may give you some false positives as well as false negatives and detect and handle those cases. For example, [Tesseract](http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/33418.pdf) has algorithms for both splitting joined characters as well as merging broken ones. – Dan Mašek Nov 08 '16 at 18:40

0 Answers0