changeset 9679:2a7cc21d79c9 octave-forge

mat2gray: more complete documentation
author carandraug
date Tue, 13 Mar 2012 18:25:56 +0000
parents 837267c6ad02
children 4e45e115b943
files main/image/inst/mat2gray.m
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 <http://www.gnu.org/licenses/>.
 
 ## -*- 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