# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

# im2double

Convert image to double precision

## Syntax

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

## Description

example

````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.```

## Examples

collapse all

```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 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);```

## Input Arguments

collapse all

Input image, specified as a scalar, vector, matrix, or multidimensional array.

• If `I` is an intensity or truecolor image, it can be `uint8`, `uint16`, `double`, `logical`, `single`, or `int16`.

• If `I` is an indexed image, it can be `uint8`, `uint16`, `double` or `logical`.

• If `I` is a binary image, it must be `logical`.

If the Parallel Computing Toolbox is installed, `I` can be a gpuArray and `im2double` converts `I` on a GPU.

Data Types: `single` | `double` | `int16` | `uint8` | `uint16` | `logical`

## Tips

• `im2double` supports the generation of efficient, production-quality C/C++ code if you have MATLAB® Coder™ installed.

## See Also

Was this topic helpful?

#### The Manager's Guide to Solving the Big Data Conundrum

Download white paper