This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals 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.


gray2ind Convert grayscale or binary image to indexed image
ind2gray Convert indexed image to grayscale image
mat2gray Convert matrix to grayscale image
rgb2gray Convert RGB image or colormap to grayscale
ind2rgb Convert indexed image to RGB image
label2rgb Convert label matrix into RGB image
demosaic Convert Bayer pattern encoded image to truecolor image
imbinarize Binarize image by thresholding
imquantize Quantize image using specified quantization levels and output values
multithresh Multilevel image thresholds using Otsu's method
adaptthresh Adaptive image threshold using local first-order statistics
otsuthresh Global histogram threshold using Otsu's method
graythresh Global image threshold using Otsu's method
grayslice Convert grayscale image to indexed image using multilevel thresholding
im2double Convert image to double precision
im2int16 Convert image to 16-bit signed integers
im2java2d Convert image to Java buffered image
im2single Convert image to single precision
im2uint16 Convert image to 16-bit unsigned integers
im2uint8 Convert image to 8-bit unsigned integers

Examples and How To

Converting Between Image Types

Converting between the image types

Converting Between Image Classes

Converting image data from one class to another


Image Types in the Toolbox

Fundamental image types supported by the Image Processing Toolbox™ software

Was this topic helpful?