Convert image to binary image, based on threshold
im2bw is not recommended. Use imbinarize instead. For more information, see Compatibility Considerations.
converts the grayscale image BW = im2bw(I,level)I to binary image
BW, by replacing all pixels in the input image with
luminance greater than level with the value
1 (white) and replacing all other pixels with the value
0 (black).
This range is relative to the signal levels possible for the image's class.
Therefore, a level value of 0.5 corresponds
to an intensity value halfway between the minimum and maximum value of the
class.
If the input image is not a grayscale image, im2bw converts the
input image to grayscale using ind2gray or rgb2gray, and then converts this
grayscale image to binary by thresholding.
graythresh | imbinarize | ind2gray | rgb2gray