| Image Processing Toolbox User's Guide | ![]() |
Convert a matrix to a grayscale intensity image
Syntax
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.
Example
I = imread('rice.png'); J = filter2(fspecial('sobel'),I); K = mat2gray(J); imshow(I), figure, imshow(K)
See Also
| maketform | mean2 | ![]() |
© 1994-2005 The MathWorks, Inc.