Page 1 of 1

Smoothing scanned text jagged/rough edges using Hit-And-Miss

Posted: 2013-02-15T09:18:25-07:00
by ashvant
Hi, short and sweet

Input: Scanned text pages, pure black/white pixels with rough/jagged edges
Image
What I have done so far
file.jpg -> -depth 1 -compress none binarized.pgm -> HMT Thicken, Thinning using custom kernels -> Adaptive blur 0x0.55

What I wish for?
I will be using these images further down the stream as input to potrace, OCR and stuffs. Before that I want the text enhanced further morphologically.

What morphological changes I would love to have?
In the jagged/staircase edge, is it possible to fill the triangular part with black color so that they may look more curved than rough? Something like the bottom right character where I have painted the rough edges. How to achieve this.

Assumptions:
No background image
No colors
No skews

P.S: Am just an entry level to ImageMagick or image enhancement. Please forgive my ignorance if the answer is very obvious or simple.

Between, I LOVE IMAGEMAGICK :)

Re: Smoothing scanned text jagged/rough edges using Hit-And-

Posted: 2013-02-17T22:54:19-07:00
by Wolfgang Woehl
Just FYI: Tesseract recognizes all lines in your sample correctly.

Re: Smoothing scanned text jagged/rough edges using Hit-And-

Posted: 2013-02-19T07:51:54-07:00
by ashvant
Hi,

My ultimate goal is to convert the source image into an enhanced, cleaner final image(The final artifact). OCR is just another assisting tool in my workflow. In other words am worried more with visually pleasantness than OCR accuracy.

Thanks

Re: Smoothing scanned text jagged/rough edges using Hit-And-

Posted: 2013-02-19T08:28:27-07:00
by snibgo
That letter "d" looks as if it has been crudely enlarged from a small version. So, as a first attempt, I screen-caught the letter, shrunk it to (very approximately) the original size, and re-enlarged it using IM's more sophisticated methods.

Code: Select all

convert d.png -resize 23x30! -resize 232x303! -threshold 50% dr.png
The result is already (IMO) more pleasing than your hand-drawn version, although it has rounded off the sharp corners of the vertical. Getting the scale-down exactly right would probably be even better.