SIVP Toolbox
Last update : April, 2006
mat2gray - Convert matrix to grayscale image
Calling Sequence
- 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(im);
Authors
-
Shiqi Yu <shiqi.yu[at]gmail.com>
Availability
The latest version of SIVP can be found at
http://sivp.sourceforge.net
See Also
rgb2gray, im2bw, im2uint8, im2int8, im2uint16, im2int16, im2int32, im2double,