# HG changeset patch # User carandraug # Date 1331663156 0 # Node ID 2a7cc21d79c99d5a0e90f87b126204d90782301e # Parent 837267c6ad022c5e6fdf24da28fd341c4f879a47 mat2gray: more complete documentation diff -r 837267c6ad02 -r 2a7cc21d79c9 main/image/inst/mat2gray.m --- a/main/image/inst/mat2gray.m Tue Mar 13 18:08:40 2012 +0000 +++ b/main/image/inst/mat2gray.m Tue Mar 13 18:25:56 2012 +0000 @@ -15,8 +15,25 @@ ## this program; if not, see . ## -*- texinfo -*- -## @deftypefn {Function File} {@var{I} =} mat2gray (@var{M}, [@var{min} @var{max}]) -## Converts a matrix to a intensity image. +## @deftypefn {Function File} {@var{I} =} mat2gray (@var{M}) +## @deftypefnx {Function File} {@var{I} =} mat2gray (@var{M}, [@var{min} @var{max}]) +## Convert a matrix to an intensity image. +## +## The returned matrix @var{I} is a grayscale image, of double class and in the +## range of values [0, 1]. The optional arguments @var{min} and @var{max} will +## set the limits of the conversion; values in @var{M} below @var{min} and +## above @var{max} will be set to 0 and 1 on @var{I} respectively. +## +## @var{max} and @var{min} default to the maximum and minimum values of @var{M}. +## +## If @var{min} is larger than @var{max}, the `inverse' will be returned. Values +## in @var{M} above @var{max} will be set to 0 while the ones below @var{min} +## will be set to 1. +## +## @strong{Caution:} For compatibility with @sc{matlab}, Octave's mat2gray +## will return a matrix of ones if @var{min} and @var{max} are equal, even for +## values below @var{min}. +## ## @seealso{gray2ind, ind2gray, rgb2gray, im2double, im2uin16, im2uint8, im2int16} ## @end deftypefn