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

(1) Input : image sourced from linked article.

enter image description here

So I tried LocalAdaptiveBinarize in order to reproduce:

pic = Import[
LocalAdaptiveBinarize[ImageCrop[pic], 100]

(2) Result :

Mathematica graphics

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

enter image description here

Is there a better method?

  • $\begingroup$ 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. $\endgroup$ – Yves Klett Aug 8 '16 at 11:44
  • $\begingroup$ @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. $\endgroup$ – yode Aug 8 '16 at 12:23
  • $\begingroup$ well, did you try that already? $\endgroup$ – Yves Klett Aug 8 '16 at 12:50
  • $\begingroup$ Slightly related: dsp.stackexchange.com/questions/1932 $\endgroup$ – Niki Estner Aug 8 '16 at 13:17
  • $\begingroup$ @nikie Thanks a lot. $\endgroup$ – yode Aug 8 '16 at 13:21

Have you seen that LocalAdaptiveBinarize has some more possible arguments?

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

enter image description here

  • $\begingroup$ Wow,I have not noted it before this. $\endgroup$ – 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

enter image description here

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

enter image description here

Of course, manual local adjustments can make wonders!


Your Answer

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

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