| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Image Processing Toolbox |
| Contents | Index |
| Learn more about Image Processing Toolbox |
I = mat2gray(A, [amin amax])
I = mat2gray(A)
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.
The input array A can be logical or numeric. The output image I is double.
I = imread('rice.png');
J = filter2(fspecial('sobel'),I);
K = mat2gray(J);
imshow(I), figure, imshow(K)

gray2ind, ind2gray, and rgb2gray
![]() | maketform | mean2 | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |