Image Type Conversion
Image Processing Toolbox™ supports binary, indexed, grayscale, and truecolor image types. In each image type, pixels are stored in different formats. For example, truecolor images represent a pixel as a triplet of red, green, and blue values, whereas grayscale images represent a pixel as a single intensity value.
Pixel values of the different image types can be stored in floating-point, signed and unsigned integers, or logical data types. Toolbox functions enable you to convert between the image types and data types.
Convert Between Image Types
|Convert RGB colormap to grayscale colormap|
|Convert grayscale or binary image to indexed image|
|Convert RGB image to grayscale|
|Convert indexed image to grayscale image|
|Convert matrix to grayscale image|
|Convert RGB image or colormap to grayscale|
|Convert RGB color values to lightness values|
|Convert RGB image to indexed image|
|Convert indexed image to RGB image|
|Convert label matrix into RGB image|
|Convert Bayer pattern encoded image to truecolor image|
|Split multichannel image into its individual channels|
Convert to Binary Image Using Thresholding
|Binarize 2-D grayscale image or 3-D volume by thresholding|
|Adaptive image threshold using local first-order statistics|
|Global histogram threshold using Otsu's method|
|Global image threshold using Otsu's method|
Convert to Indexed Image Using Quantization
|Quantize image using specified quantization levels and output values|
|Multilevel image thresholds using Otsu’s method|
|Convert grayscale image to indexed image using multilevel thresholding|
- Image Types in the Toolbox
Image types determine how MATLAB® interprets data matrix elements as pixel intensity values. The toolbox supports many image types including binary, grayscale, truecolor, multispectral, and label images.
- 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 Data Types
You can convert image data between data types using functions that automatically rescale and offset the original data.