You are here : matlabImage Processingim2double

im2double() - Image Processing

I2 = im2double(I) converts
the intensity image I to double precision, rescaling
the data if necessary. I can be a grayscale intensity
image, a truecolor image, or a binary image.If the input image is of class double, then
the output image is identical.I2 = im2double(I,'indexed') converts
the indexed image I to double precision, offsetting
the data if necessary.


Syntax

I2 = im2double(I) exampleI2 = im2double(I,'indexed')


Example

Convert Image to Double PrecisionOpen This Example
I = imread('peppers.png');
whos I
  Name        Size                Bytes  Class    Attributes

  I         384x512x3            589824  uint8              

I2 = im2double(I);
whos I2
  Name        Size                 Bytes  Class     Attributes

  I2        384x512x3            4718592  double              

Convert Image to Double Precision on GPU
Convert an array to class double on
the GPU. This example requires the Parallel Computing Toolbox™.
I1 = gpuArray(reshape(uint8(linspace(1,255,25)),[5 5]));
I2 = im2double(I1);


Output / Return Value


Limitations


Alternatives / See Also


Reference