<< ind2rgb Image Types and Color Space Conversions ntsc2rgb >>

IPCV >> Image Types and Color Space Conversions > mat2gray

mat2gray

Convert matrix to grayscale image

Syntax

G = mat2gray(M)
G = mat2gray(M, [mmin, mmax])

Parameters

M :

An matrix/image.

[mmin, mmax] :

[mmin, mmax] is the values in M that correspond to 0.0 and 1.0 in G . The elements in M which is lower than mmin will be converted to 0.0 , and greater than mmax will be converted to 1.0 .

G :

A double precision matrix/image which data value in the range [0,1].

Description

mat2gray(M,[mmin, mmax]) converts the matrix M to the double precision image. The output matrix contains values in the range [0.0, 1.0]. mmin and mmax are the values in M that correspond to 0.0 and 1.0 in the output image.

When [mmin, mmax] is not specified, minimum and maximum of M are the values in M that correspond to 0.0 and 1.0 in the output image.

Examples

M = [0:10;0:10];
I = mat2gray(M);

See also

Authors


Report an issue
<< ind2rgb Image Types and Color Space Conversions ntsc2rgb >>