3
$\begingroup$

Adobe Acrobat has this as a feature called ClearScan. While doing OCR it allows image enhancement, by smoothing irregularities on font outlines.

For example, this source:

enter image description here

turns to this:

enter image description here

Are there other tools with such feature, or public algorithms (Matlab/Python) that can smooth contours of arbitrary font-like objects?

$\endgroup$
  • 1
    $\begingroup$ There's an open-source command-line program called potrace that you might try. It converts bitmaps to bezier curves and has a bunch of options allowing you to trade off smoothness and accuracy. It's also built in to the Inkscape vector editor (under the Path -> Trace Bitmap menu option). $\endgroup$ – Wandering Logic May 18 '13 at 0:22
  • 1
    $\begingroup$ Yes, I was just thinking the same. If you can make your comment as answer, I'll accept it. Further to your idea, we can use Google's tesseract to segment, classify, recognize and store bounding box positions for all characters and then use potrace on just the set, so that it will be same workflow as Acrobat is doing, but with freedom to make adjustments. Acrobat is storing results in CID font and use it make PDF, while we can think about something else... $\endgroup$ – zetah May 18 '13 at 0:49
4
$\begingroup$

I think the open-source command-line program potrace, might do what you want. It converts bitmaps to bezier curves and has a bunch of options allowing you to trade off smoothness and accuracy.

The open-source Inkscape vector (svg) editor has potrace built in (under the Path->Trace Bitmap menu option.) The result of applying your example in Inkscape, (I used the mode Inkscape calls "Brightness cutoff" with the default threshold of .45, since your image was already black-and-white rather than grayscale) scaling the size of the resulting bezier curves up a bit, and then having Inkscape output a bitmap is:

enter image description here

One of the cute side-effects of converting to bezier and then back to grayscale is that you get nice anti-aliasing around the curves.

With grayscale input images I find that the "Edge detection" mode works a little better. There are also options for choosing less or more smoothing, and less or more speckle elimination.

$\endgroup$

protected by jojek Jan 30 '17 at 11:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.