A grayscale image (also called gray-scale, gray scale, or gray-level) is a data matrix
whose values represent intensities within some range. MATLAB® stores a grayscale image as an individual matrix, with each element of the
matrix corresponding to one image pixel. By convention, this documentation uses the
variable name I
to refer to grayscale images.
The matrix can be of class uint8
, uint16
,
int16
, single
, or double
.
While grayscale images are rarely saved with a colormap, MATLAB uses a colormap to display them.
For a matrix of class single
or double
, using
the default grayscale colormap, the intensity 0 represents black and the intensity 1
represents white. For a matrix of type uint8
,
uint16
, or int16
, the intensity
intmin(class(I))
represents black and the intensity
intmax(class(I))
represents white.
The figure below depicts a grayscale image of class double
.
Pixel Values in a Grayscale Image Define Gray Levels