4

I am trying o preform OCR on the following image, and as you may notice many of the letters are not complete. They are missing parts which is causing some bad results from Tesseract.

enter image description here

I have tried to erode the image using the following code but it seems to not be doing much:

Mat eroded;
double element_size = 25;
RNG rng(12345);
Mat element = getStructuringElement( cv::MORPH_ELLIPSE,cv::Size( 2*element_size + 1, 2*element_size+1 ),cv::Point( element_size, element_size ) );
erode(src, eroded, element);

Does anyone know how I can sharpen this text so the letters become consistent?

Clip
  • 3,018
  • 8
  • 42
  • 77
  • You asked a question, 3 users replied, you did not accept any of them, you did not responded any of them. And asked a new question about same problem? You don't worth to be answered... – guneykayim Apr 17 '14 at 08:07

3 Answers3

0

Recalling from digital image processing, I think that a Laplacian-Gaussian Or Sobel filtering will help sharpening you image. Generally differential filters are high-frequency pass/amplifying filters and as such filtering with this kind of filters will result in amplification of high-frequencies in your image (i.e., edges, details). Now as far as it concerns the OCR, intuitively, I think that Laplacian on Gaussian on the original image will improve the performance. Laplacian on Gaussian is actually a double pass filter. First a Gaussian filter will amplify the low frequencies of your image and as such will amplify the intensity of the dim pixels (i.e., the gaps on the image you posted), while the Laplacian as a second order differential filter will amplify the high frequencies and as such will create the desired sharpening effect.

Community
  • 1
  • 1
101010
  • 41,839
  • 11
  • 94
  • 168
0

It seems that you have already done some pre-processing with your image, otherwise I don't think a camera captured image would naturally look that way. In this case, I would suggest using adaptive thresholding (adaptive thresholding api in opencv) instead of doing the threshold yourself. See the difference in (some explanation on how it works). It's generally better than using a magic threshold.

Also, I doubt that morphological operations would help.

James Harper
  • 480
  • 4
  • 8
0

Are you trying to perform OCR on that binary image you've provided or you do some operations on another image and get that binary image? You should not be trying to improve the quality of that image.

Think it this way. You have an image, and some parts of that image is missing. And you are trying to find out what those parts are. It is not a sharpening problem. It is a huge problem. So I think you should get a better binary image from the original image to perform OCR.

Good luck.

guneykayim
  • 5,210
  • 2
  • 29
  • 61