Image Processing Toolbox | ![]() ![]() |
Working with uint8 and uint16 Data
Use
imread
to read graphics images into MATLAB as uint8
or uint16
arrays; use imshow
to display these images; and use
imwrite
to save these images. Most of the functions in the Image Processing Toolbox accept uint8
and uint16
input. See the reference entries for more information about imread
, imshow
, uint8
, and uint16
.
MATLAB provides limited support for storing images as 8-bit or 16-bit unsigned integers. In addition to reading and writing uint8
and uint16
arrays, MATLAB supports the following operations:
reshape
, cat
, and permute
all
and any
functionsfind
function. Note that the returned array is of class double.
Mathematical Operations Support for uint8 and uint16
The following MATLAB mathematical operations support uint8
and uint16
data: conv2
, convn
, fft2
, fftn
, sum
. In these cases, the output is always double
.
If you attempt to perform an unsupported operation on one of these arrays, you will receive an error. For example,
BW3 = BW1 + BW2 ??? Function '+' not defined for variables of class 'uint8'.
![]() | Converting The Image Type of Images | Converting The Storage Class of Images | ![]() |