# Character segmentation in poor quality grayscale

Given grayscale lines from a receipt like this:

,

in which parts of the letters sometimes appear almost as light as the background, my goal is to determine the $x$-positions of the centres of the bounding boxes of the characters, to uncover the monospaced text grid.

The problem is that, due to the bad quality of the scan, a binarization either disconnects pars of letters that belong together, or connect letters that should be considered separate component. Using MorphologicalBinarize[ColorNegate[#],thres] has given best results so far:

,

but this result is unsatisfactory.

My question is: What is a good way to separate the letters, in order to find their centers and recover the horizontal grid. The shape of the characters does not necessarily have to be saved in this step.

More lines like the example can be found at https://www.dropbox.com/s/ghlyxl6l1rop41s/lines.zip?dl=0.

• LocalAdaptiveBinarize gives you more control over the binarization then MorphologicalBinarize
– paw
Dec 1 '14 at 20:44