0

Following up on this post

Hello community. I am trying to solve the same problem as mentioned in the above post. I want to pre-process the image before sending it into OCR so that I could get a decent output. For this reason I wanted to increase the DPI for the image and the suggested solution was to use Imagemagik. Can some one help me with how to resample the image using Imagemagick. It got many resampling filters and I am not sure on how to proceed further. Here is the link for ImageMagick resampling page Resampling .

I am new to signal processing and computer vision. I hope some guru could advice me on what and how to do.

Random
  • 909
  • 1
  • 9
  • 14
  • DPI is a very arbitrary measure, it is a mere piece of metadata that can be changed at will. What you want to do is really upscale the image (more pixels for same physical size: more DPI). But IMHO adding pixels that way won't work. The OCR software requires more DPI because it normally means more information to work on (at 300DPI a lowercase character is about 20x20px). But when you upscale the picture you don't add information in the image (the net effect is that the upscaled image is either pixellated or blurry, depending on the algorithm used) and OCR doesn't get more data to crunch. – xenoid Aug 26 '17 at 20:15
  • @xeniod Your reply here should be an answer! – dlemstra Aug 26 '17 at 20:22
  • @xenoid So you suggest to stay away from resampling? Also I am planning to use wiener filter to sharpen the image. I thought I would do resampling first and then use wiener filter from scikit Image to remove the added blur. Like I mention I am new to this field and highly value your opinion. – Random Aug 26 '17 at 20:56
  • @dlemstra OK, added. – xenoid Aug 26 '17 at 21:13

1 Answers1

4

DPI is a very arbitrary measure, it is a mere piece of metadata that can be changed at will. What you want to do is really upscale the image (more pixels for same physical size: more DPI).

But IMHO adding pixels that way won't work. The OCR software requires more DPI because it normally means more information to work on. At 300DPI a 10 point lowercase character is about 20x20px (400pixels), at 100DPI, it is only 7x7.

When you upscale the picture you don't add information in the image. The new pixels are just computed from the existing ones. The net effect is that the upscaled image is either pixellated or blurry, depending on the algorithm used, and OCR doesn't really get more data to crunch.

TL;DR: You can try resampling but it's not too likely to work.

On the otter hand DPI is meaningless here. It's only useful as an indication when scanning printed text of the usual size (around 10 points), what really count is the size of the characters in pixels. If they are already around 20x20 (small font at high DPI, or big font at low DPI) then you should be OK.

xenoid
  • 8,396
  • 3
  • 23
  • 49