3
$\begingroup$

I have a JPEG file with a 200 dpi scan of a sample printout from a badly maintained old drum printer. I was able to segment it and to collect all instances of each letter together, for example

Letters A Letters G Letters Q Letters W

I would like to recreate its font; as the first step I've written a utility that estimates the shift amount (in pixels) between two images using MSE, then weighted-averages them according to that shift amount, and continues until all instances of a character have been processed.

My results look like

Sample result

Is this the best I can hope for, or are there smarter algorithms that are able to deal with low-quality samples?

Specifically, I would like to get rid of the ink smear at the top of the characters due to the rotational momentum of the drum with respect to the hammers.

(As far as I understand, super-resolution is not a good match for this task, and I couldn't find a good open source implementation of it.)

The second step is to use Potrace, of course.

$\endgroup$
  • $\begingroup$ Can it be assumed that the orientation of all instances of a character are identical? That is, that there is zero rotation? $\endgroup$ – trichoplax May 27 '17 at 13:32
  • $\begingroup$ Are you able to share the raw data for people to experiment? $\endgroup$ – trichoplax May 27 '17 at 13:33
  • 1
    $\begingroup$ @trichoplax There is a very slight consistent rotation clockwise as a scanning artifact. I've accounted for it when segmenting. There is no variation of rotation of individual characters. Initial image Charset encoding Segmented $\endgroup$ – Leo B. May 27 '17 at 16:44
  • $\begingroup$ Interesting indeed. just an idea- since you make own program, how is about setting different threshold by averaging, depending on which pixel row it is - say the top pixel row contributes pixels which are >95% black, second slightly more, say, all pixels which are >94% black ... and so on. $\endgroup$ – Mikhail V May 29 '17 at 21:58
  • $\begingroup$ @Mikhail That's a good idea, but it definitely requires tuning. $\endgroup$ – Leo B. May 30 '17 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.