Page 1 of 1

Scan Image Preprocessing to OCR

Posted: 2018-05-02T08:26:46-07:00
by suresh
Hi.,

What are the Predefined Image Magick Methods Use to Improve Scan Image Quality.

Re: Scan Image Preprocessing to OCR

Posted: 2018-05-02T09:05:26-07:00
by fmw42
Define or provide an example of the contents of the scan? Is it black text on a plan background or is the background busy or contain images?

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

If on Unix-like system, see my script textcleaner at my link below. Or use ImageMagick -lat function.

Re: Scan Image Preprocessing to OCR

Posted: 2018-05-02T23:41:17-07:00
by suresh
Thanks for your valuable Reply.

1. I am Used This Type of Image Below Link.

https://static1.squarespace.com/static/ ... ormat=500w

https://static1.squarespace.com/static/ ... ormat=500w

3. Text Cleaner i used FredsImageMagickScripts.TextCleaner.1.0.6436.32248

2. Magick.NET-Q16-AnyCPU 7.4.5 This Version Used in C#

4. I am Used This Code
MagickImage MagickImag = new MagickImage(Image);
TextCleanerScript objCleaner = new TextCleanerScript();
objCleaner.BackgroundColor = Color.White;
objCleaner.Unrotate = true;
objCleaner.Trim = true;
objCleaner.MakeGray = true;
objCleaner.SmoothingThreshold = (Percentage)50;
objCleaner.Enhance = TextCleanerEnhance.Normalize;
objCleaner.FilterOffset = (Percentage)5;
objCleaner.FilterSize = 15;
objCleaner.Sharpen = 1.0f;
IMagickImage img = objCleaner.Execute(MagickImag);
img.Deskew((Percentage)50);
img.Despeckle();
img.Write(AppDomain.CurrentDomain.BaseDirectory + "Images\\Output.jpeg");

I did't Get good Output Please Let Me Know What are The Predefined Process used to Improve Quality.

Thank You,

Re: Scan Image Preprocessing to OCR

Posted: 2018-05-02T23:58:05-07:00
by fmw42
My textcleaner script will not help those kinds of images. My textcleaner will not work on Windows except via Magick.NET. See https://github.com/dlemstra/FredsImageMagickScripts.NET

I do not know how to improve those images. You could try some morphology close, but it might remove the dots, but make your text worse.

Re: Scan Image Preprocessing to OCR

Posted: 2018-05-03T00:08:13-07:00
by suresh
Thanks for Your Reply.

Can you Know how to Remove vertical lines in Images.

Re: Scan Image Preprocessing to OCR

Posted: 2018-05-03T09:06:03-07:00
by fmw42
suresh wrote: 2018-05-03T00:08:13-07:00 Thanks for Your Reply.

Can you Know how to Remove vertical lines in Images.
Please supply an example image. Often, you can use -morphology with a custom linear kernel to remove lines.