Scan Image Preprocessing to OCR

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
suresh
Posts: 3
Joined: 2018-05-02T07:51:18-07:00
Authentication code: 1152

Scan Image Preprocessing to OCR

Post by suresh »

Hi.,

What are the Predefined Image Magick Methods Use to Improve Scan Image Quality.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Scan Image Preprocessing to OCR

Post 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.
suresh
Posts: 3
Joined: 2018-05-02T07:51:18-07:00
Authentication code: 1152

Re: Scan Image Preprocessing to OCR

Post 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,
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Scan Image Preprocessing to OCR

Post 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.
suresh
Posts: 3
Joined: 2018-05-02T07:51:18-07:00
Authentication code: 1152

Re: Scan Image Preprocessing to OCR

Post by suresh »

Thanks for Your Reply.

Can you Know how to Remove vertical lines in Images.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Scan Image Preprocessing to OCR

Post 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.
Post Reply