Convert image to double precision
If the data type of the input image I
is
double
, single
, or
logical
, then the output pixel values are identical to
the input pixel values.
Note
Many MATLAB®functions expect pixel values to be in the range [0, 1] for
truecolor images of data type single
or
double
. The im2double
function
does not rescale the output when the input image has
single
or double
data type. If
your input image is a truecolor image of data type single
or double
with pixel values outside this range, then you
can use the rescale
function to scale pixel values to the expected range
[0, 1].
If I
is a grayscale or truecolor image with data type
uint8
, uint16
or
int16
, then im2double
rescales output
pixel values to the range [0, 1].
If I
is an indexed image with data type
uint8
or uint16
, then
im2double
adds an offset of 1
to the
output pixel values.
double
| im2int16
(Image Processing Toolbox) | im2single
(Image Processing Toolbox) | im2uint16
(Image Processing Toolbox) | im2uint8
(Image Processing Toolbox) | gpuArray
(Parallel Computing Toolbox)