mat2gray - Convert matrix to grayscale image

Syntax

I = mat2gray(A, [amin amax])
I = mat2gray(A)

Description

I = mat2gray(A, [amin amax]) converts the matrix A to the intensity image I. The returned matrix I contains values in the range 0.0 (black) to 1.0 (full intensity or white). amin and amax are the values in A that correspond to 0.0 and 1.0 in I.

I = mat2gray(A) sets the values of amin and amax to the minimum and maximum values in A.

Class Support

The input array A can be logical or numeric. The output image I is double.

Examples

I = imread('rice.png');
J = filter2(fspecial('sobel'),I);
K = mat2gray(J);
imshow(I), figure, imshow(K)

See Also

gray2ind, ind2gray, and rgb2gray

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS