SIP - Scilab Image Processing Toolbox >> SIP - Scilab Image Processing Toolbox > im2bw
Convert an image to binary by thresholding
BW = im2bw(Img, threshold [, maxvalue])
BW = im2bw(Index, map, threshold [, maxvalue])
- M x N x 3 truecolor image or M x N grayscale intensity image.
- M x N indexed image and its M x 3 colormap.
- the maximum value to assume
Img can take. (Optional, defaults to 1)
- the threshold level, between 0 to 1 (a ratio, like percentage). Pixels of the
image that are higher or equal than the threshold are mapped to 1, while pixels
that are strictly lower than the threshold are mapped to zero.
- Resultant black and white binary image.
im2bw converts RGB images, indexed images and grayscale intensity images to binary, by thresholding.
initial_dir = PWD;
chdir (SIPDIR + 'images');
[Img,map] = imread('indian.bmp');
bw = im2bw(Img, map,0.5);
bw = im2bw(Img, map,0.2);
- Ricardo Fabbri <ricardofabbri[at]users.sf.net>
The latest version of SIP can be found at