Ask Your Question

image processing to improve tesseract OCR accuracy

asked 2014-10-29 02:08:12 -0600

Deepak Kumar gravatar image

updated 2020-11-02 10:48:49 -0600

I've been using tesseract to convert screenshot image into text. The size of image is small, and I'm looking for tips on what sort of image processing/image enhancement might improve the results. I've noticed that text in the image looks find and perfect to read through eye but when i pass it to tesseract it is unable to find text from image.

edit retag flag offensive close merge delete


I think you would be better to put it in the tesseract forum itself.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-29 03:19:24 -0600 )edit

If you are using open-source OCR engine, it may be the case that it does not implement an "omni-font" OCR algorithm (note: not to be confused with a similarly-named commercial OCR vendor.) * An "omni-font" OCR algorithm is able to recognize Latin alphabets from many typefaces, including unforeseen ones without having specifically being trained against that typeface. Without an "omni-font" algorithm, one will sometimes have to run the OCR training algorithm using the same document text that one would like to recognize. *(Posting as a comment since I do not know concretely whether Tesseract OCR is omni-font or not.)

rwong gravatar imagerwong ( 2014-10-29 16:43:48 -0600 )edit

why not try the online service, i used this online ocr service, it's accuracy well and free to use.

JonyGreen gravatar imageJonyGreen ( 2015-09-07 00:46:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-10-29 16:14:10 -0600

Hi! Without seeing your images, it's quite difficult to know which specific problem your images have. But I suggest you to resize images if they are too small, convert them to grayscale and normalize them.

You can also try to deblur (sharpen) your images using for instance Wiener filter. Unfortunately, there is no such function in opencv, so you will have to do it yourself. For instance, here is a small code which will sharpen your image:

  //convert first your image to float to improve precision...
  img.convertTo(imgTmp, CV_32F);
  GaussianBlur(imgTmp, imgResult, cv::Size(0, 0), 3);
  addWeighted(imgTmp, 1.5, imgResult, -0.5, 0, imgResult);

  // convert back to 8bits gray scale
  imgResult.convertTo(imgResult, CV_8U);
edit flag offensive delete link more


my image is not visible after applying these functions. i dont know how to post image in this website. if u give me your mail id i can send u.


Deepak Kumar gravatar imageDeepak Kumar ( 2014-11-03 00:18:35 -0600 )edit

Question Tools


Asked: 2014-10-29 02:08:12 -0600

Seen: 9,672 times

Last updated: Oct 29 '14