[int32] [Up] [uint16] Data Type Conversion

uint8
Convert an image to an uint8 image.

Synopsis

img = uint8( f )

Implemented in Python.

Input

f Image

Any image

Output

img Image Gray-scale uint8 image.

The converted image

Description

uint8 clips the input image between the values 0 and 255 and converts it to the unsigned 8-bit datatype.

Examples

>>> a = int32([-3,0,8,600])

              
>>> print uint8(a)
[  0   0   8 255]

Source Code

def uint8(f):
    from Numeric import array, clip
    img = array(clip(f,0,255)).astype('b')
    return img
    

See also

uint16 Convert an image to a uint16 image.
int32 Convert an image to an int32 image.
mmdatatype Return the image datatype string
[int32] [Up] [uint16] Python