Convert image to binary
im2 = im2bw(im, thresh)
An matrix/image, which can be ANY image supported by IPCV.
Threshold value. You specify thresh in the range [0,1], regardless of the class of the input image.
Boolean matrix.
im2bw convert intensity or RGB images to binary images. The output is a boolean matrix, which has value of %T for all pixels in the input image with luminance grater than thresh and %F for all the other pixels. (You specify thresh in the range [0,1], regardless of the type of the input image.)
S = imread(fullpath(getIPCVpath() + "/images/balloons.png")); S2 = rgb2gray(S); Sbin = im2bw(S2,0.5); imshow(Sbin); | ![]() | ![]() |