This is machine translation

Translated by Microsoft
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.

Image Type Conversion

Convert between the image types, such as RGB (truecolor), binary, grayscale, and indexed.


gray2indConvert grayscale or binary image to indexed image
ind2grayConvert indexed image to grayscale image
mat2grayConvert matrix to grayscale image
rgb2grayConvert RGB image or colormap to grayscale
rgb2indConvert RGB image to indexed image
ind2rgbConvert indexed image to RGB image
label2rgbConvert label matrix into RGB image
demosaicConvert Bayer pattern encoded image to truecolor image
imbinarizeBinarize 2-D grayscale image or 3-D volume by thresholding
imquantizeQuantize image using specified quantization levels and output values
multithresh Multilevel image thresholds using Otsu’s method
adaptthreshAdaptive image threshold using local first-order statistics
otsuthreshGlobal histogram threshold using Otsu's method
graythreshGlobal image threshold using Otsu's method
graysliceConvert grayscale image to indexed image using multilevel thresholding
im2doubleConvert image to double precision
im2int16Convert image to 16-bit signed integers
im2java2dConvert image to Java buffered image
im2singleConvert image to single precision
im2uint16Convert image to 16-bit unsigned integers
im2uint8Convert image to 8-bit unsigned integers


Image Types in the Toolbox

Image types determine how MATLAB® interprets data matrix elements as pixel intensity values. The toolbox supports binary, indexed, grayscale, and truecolor image types.

Convert Between Image Types

Certain image processing operations support only a subset of the image types. You can convert images between the image types to suit the operation.

Convert Image Data Between Classes

You can convert image data between classes using functions that automatically rescale and offset the original data.

Was this topic helpful?