Image Processing Toolbox    
uint8

Convert data to unsigned 8-bit integers

Syntax

Description

B = uint8(A) creates the unsigned 8-bit integer array B from the array A. If A is a uint8 array, B is identical to A.

The elements of a uint8 array can range from 0 to 255. Values outside this range are mapped to 0 or 255. If A is already an unsigned 8-bit integer array, uint8 has no effect.

The fractional part of each value in A is discarded on conversion. This means, for example, that uint8(102.99) is 102, not 103. Therefore, it is often a good idea to round off the values in A before converting to uint8. For example,

MATLAB supports these operations on uint8 arrays:

MATLAB also supports the find function for uint8 arrays, but the returned array is of class double.

Most of the functions in the Image Processing Toolbox accept uint8 input. See the individual reference entries for information about uint8 support.

Remarks

uint8 is a MATLAB built-in function.

Example

See Also

double, im2double, im2uint8


 truesize uint16