Image Processing Toolbox    
im2uint8

Convert image array to eight-bit unsigned integers

Syntax

Description

im2uint8 takes an image as input, and returns an image of class uint8. If the input image is of class uint8, the output image is identical to it. If the input image is of class logical, uint16, or double, im2uint8 returns the equivalent image of class uint8, rescaling or offsetting the data as necessary.

I2 = im2uint8(I1) converts the intensity image I1 to uint8, rescaling the data if necessary.

RGB2 = im2uint8(RGB1) converts the truecolor image RGB1 to uint8, rescaling the data if necessary.

I = im2uint8(BW) converts the binary image BW to an intensity image of class uint8.

X2 = im2uint8(X1,'indexed') converts the indexed image X1 to uint8, offsetting the data if necessary. Note that it is not always possible to convert an indexed image to uint8. If X1 is of class double, max(X1(:)) must be 256 or less; if X1 is of class uint16, max(X1(:)) must be 255 or less. To convert a uint16 indexed image to uint8 by reducing the number of colors, use imapprox.

See Also

im2uint16, double, im2double, uint8, imapprox, uint16


  im2java im2uint16