# Improving visibility of text in scanned image

I have as example the image below and would like to improve it in such a way that mainly the text is visible and the noisy background is removed.

How can that be done best?

Just to make a functional form of nikie's answer, which can't be marked as a duplicate as it's on another SE site,

improve[img_] :=
ImageCrop@
Binarize@Image[
ImageData[img]/ImageData[Closing[img, DiskMatrix[5]]]]

improve@Import["http://i.stack.imgur.com/vWX65.jpg"]


• Great ... incredible – mrz Feb 3 '16 at 14:29
• Don't forget to follow nikie's link above and upvote that post! – Jason B. Feb 3 '16 at 14:30
• Here might be a good place to point out the existence of LocalAdaptiveBinarize. Its documentation has an example with highly variable text contrast, just in case source material is less than stellar in quality. – kirma Feb 3 '16 at 14:47
• @kirma, I had trouble getting a decent image that way. I used Manipulate like in the example, but I can't get rid of the shading in the corner: LocalAdaptiveBinarize[ Import["http://i.stack.imgur.com/vWX65.jpg"], 23, {0.6, 0.43, 0.25}] – Jason B. Feb 3 '16 at 15:05
• @JasonB Like most heuristic image processing algorithms, sometimes it works, sometimes not... – kirma Feb 3 '16 at 15:27

If a grayscale image is needed, we can do as in Jason answer but replacing the binarize with an ImageAdjust.

src = ColorConvert[Import@"http://i.stack.imgur.com/vWX65.jpg", "Grayscale"];
white = Closing[src, DiskMatrix[5]];
imgWithUniformBkg = Image[ImageData[src]/ImageData[white]];


But this results in an image that is too light:

A much better results is found after using a manipulate to explore the possible settings:

Manipulate[

• Whether to delete it or not is of course up to you. Perhaps you could differentiate it further? Your solution returns a grayscale image rather than a black and white one, perhaps you could point that out; maybe your need for ImageAdjust stemmed from there? – MarcoB Feb 3 '16 at 14:51