Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Character recognition (OCR algorithm) [closed]

Tags:

ocr

I am working on a project in which I have to develop OCR Algorithm ( I have to read the text from Image and then convert it to different language ).So my first task is to get text from image.

Steps to complete first task.

  1. Loading any image format (bmp, jpg, png) from given source. Then convert the image to grayscale and binarize it using the threshold value (Otsu algorithm). //completed(How to remove noise from output Image???)

Results

Input Image

Output Image

  1. Detecting image features like resolution and inversion. So that we can finally convert it to a straightened image for further processing. (completed the code of rotation of Image but not able to detect Image angle about which we have to rotate the Image,So still working on angle detection part)

  2. Lines detection and removing. This step is required to improve page layout analysis, to achieve better recognition quality for underlined text, to detect tables, etc.(Decided To Complete that part in End)

  3. Page layout analysis. In this step I am trying to identify the text zones present in the image. So that only that portion is used for recognition and rest of the region is left out.

  4. Detection of text lines and words. Here we also need to take care of different font sizes and small spaces between words.

  5. Recognition of characters. This is the main algorithm of OCR; an image of every character must be converted to appropriate character code. Sometimes this algorithm produces several character codes for uncertain images. For instance, recognition of the image of "I" character can produce "I", "|" "1", "l" codes and the final character code will be selected later.

  6. Saving results to selected output format, for instance, searchable PDF, DOC, RTF, TXT. It is important to save original page layout: columns, fonts, colors, pictures, background and so on.

So I need help in part6.I have completed line detection part (get n Images from a paragraph containing n lines) but stuck in next part getting words and character recognisation.If you know good links related to OCR and character recognisation part then please post Here.

For character recognisation I am thinking to use asprise(Java library) http://asprise.com/product/ocr/index.php?lang=java

like image 533
TLE Avatar asked Mar 03 '13 16:03

TLE


People also ask

Which algorithm is used for OCR?

Popular Answers (1) The tesseract algorithm is available on Google Code, and is one of the best open source OCR out there.

How does OCR read the characters in a document?

The OCR software uses pattern-matching algorithms to compare text images, character by character, to its internal database. If the system matches the text word by word, it is called optical word recognition.

Is OCR a solved problem?

In the featured image, we observe that the interest in OCR is relatively stable in the last three years. This leads some experts to claim that OCR is a “solved” problem, and no further progress is required. However, OCR provides outstanding results only on particular use cases.


2 Answers

To detect the rotation angle, use the Hough transformation.

For noise reduction, replace any pixel, that does not have a neighbour (north, east, south or west) with the same color (a similar color, using a tolerance threshold), with the average of the neighbours.

Search for vertical white gaps for layout detection. Slice along the vertical gap. For each slice, now search horizontal gaps, and slice. If the slices have the same (a similar) height, you are at line level. Otherwise repeat vertical/horizontal slicing, until you only have lines left. The last step then is again a vertical slicing, giving you the single characters (or ligatures in some cases). Long and narrow or short and wide slices are lines.

Compare the character slices with a character library. If performance is not the main concern, try to find the characters within different font libraries, until you can identify the font used. Then stick with that font for character recognition.

In the original image, replace each character with the background color, which is determined by interpolating pixels that not are part of the character for each pixel of the character. This gives you the background image, if any.

like image 155
nibra Avatar answered Nov 12 '22 22:11

nibra


You should use Adaptive treshold instead Otsu method.. I think it will be helpful http://www.csse.uwa.edu.au/~shafait/papers/Shafait-efficient-binarization-SPIE08.pdf This method will automatically remove the noise.

like image 42
Stupi Avatar answered Nov 12 '22 22:11

Stupi