Convert matrix to grayscale image
G = mat2gray(M) G = mat2gray(M, [mmin, mmax])
An matrix/image.
[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 .
A double precision matrix/image which data value in the range [0,1].
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.