# Get better binarized image

There is an example of adaptive binarization in a MATLAB Blog.

(1) Input : image sourced from linked article.

So I tried LocalAdaptiveBinarize in order to reproduce:

pic = Import[


(2) Result :

But as we see, the result is much worser than MATLAB's:

Is there a better method?

• LocalAdaptiveBinarize[ImageCrop[pic], 50] is better already. What did you try? Using the additional parameters (see help) will get you even better results, so go ahead and experiment. – Yves Klett Aug 8 '16 at 11:44
• @YvesKlett I don't think the 50 is enough.I think maybe we sholud get is threshold image firstly.the TopHatTransform maybe can help a little. – yode Aug 8 '16 at 12:23
• well, did you try that already? – Yves Klett Aug 8 '16 at 12:50
• Slightly related: dsp.stackexchange.com/questions/1932 – Niki Estner Aug 8 '16 at 13:17
• @nikie Thanks a lot. – yode Aug 8 '16 at 13:21

Have you seen that LocalAdaptiveBinarize has some more possible arguments?

LocalAdaptiveBinarize[pic, 4.5, {.72, .55, 0}]


• Wow,I have not noted it before this. – yode Aug 8 '16 at 14:18

We can use the highpass filter:

hp = HighpassFilter[pic, 0.12]
Binarize[hp, 0.01]


with the result

For comparison, that is what one can achieve with Photoshop without using any local adjustments

Of course, manual local adjustments can make wonders!