Image Processing Toolbox    
im2bw

Convert an image to a binary image, based on threshold

Syntax

Description

im2bw produces binary images from indexed, intensity, or RGB images. To do this, it converts the input image to grayscale format (if it is not already an intensity image), and then converts this grayscale image to binary by thresholding. The output binary image BW has values of 0 (black) for all pixels in the input image with luminance less than level and 1 (white) for all other pixels. (Note that you specify level in the range [0,1], regardless of the class of the input image.)

BW = im2bw(I,level) converts the intensity image I to black and white.

BW = im2bw(X,map,level) converts the indexed image X with colormap map to black and white.

BW = im2bw(RGB,level) converts the RGB image RGB to black and white.

Class Support

The input image can be of class uint8, uint16, or double and it must be nonsparse. The output image, BW, is of class logical.

Example

See Also

graythresh, ind2gray, rgb2gray


  ifftn im2col