Difference between im2bw and imbinarize?

33 views (last 30 days)
HC
HC on 13 Aug 2019
Edited: Guillaume on 13 Aug 2019
Hello all,
I know newer versions of MATLAB recommend using imbinarize instead of im2bw. I was wondering if there were any significant differences.
I'm also working on a image processing project and im2bw was used with a sensitivity level of 0.9. Is there an equivalent for imbinarize?
Thanks.

Answers (1)

Guillaume
Guillaume on 13 Aug 2019
Edited: Guillaume on 13 Aug 2019
You can look at the source code of both functions to see the difference in implementation
edit im2bw.m
edit imbinarize.m
In the case of a global threshold for imbinarize, the two are exactly equivalent for images of type 'single', 'double', 'uint8', 'uint16', and 'uint32'. For images of type 'int16' (imbinarize also supports 'int8' and 'int32', im2bw doesn't), the two slightly differ in that im2bw temporarilly offset and convert the image to 'uint16 but the end result is the same.
The meaning of the threshold is the same for both functions, so
im2bw(someimage, 0.9)
can be translated directly into
imbinarize(somimage, 0.9)

Categories

Find more on Oceanography and Hydrology in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!