diff scripts/image/gray2ind.m @ 21223:f6aab24ed82e

maint: Periodic merge of stable to default.
author Rik <rik@octave.org>
date Mon, 08 Feb 2016 20:36:40 -0800
parents 516bb87ea72e 732ec49d1ec5
children ecce63c99c3f
line wrap: on
line diff
--- a/scripts/image/gray2ind.m	Mon Feb 08 17:10:30 2016 -0800
+++ b/scripts/image/gray2ind.m	Mon Feb 08 20:36:40 2016 -0800
@@ -1,4 +1,4 @@
-## Copyright (C) 1994-2015 John W. Eaton
+## Copyright (C) 1994-2016 John W. Eaton
 ##
 ## This file is part of Octave.
 ##
@@ -41,12 +41,10 @@
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
-  elseif (! isreal (I) || issparse (I))
+  elseif (! isreal (I) || issparse (I) || ! ismatrix(I))
     error ("gray2ind: I must be a grayscale or binary image");
   elseif (! isscalar (n) || n < 1 || n > 65536)
     error ("gray2ind: N must be a positive integer in the range [1, 65536]");
-  elseif (! ismatrix (I) || ndims (I) < 2)
-    error ("gray2ind: I must be a grayscale or binary image");
   endif
 
   ## default n is different if image is logical
@@ -110,6 +108,7 @@
 %!error <I must be a grayscale or binary image> gray2ind ({1})
 %!error <I must be a grayscale or binary image> gray2ind ([1+i])
 %!error <I must be a grayscale or binary image> gray2ind (sparse ([1]))
+%!error <I must be a grayscale or binary image> gray2ind (ones (2,2,3))
 %!error <N must be a positive integer> gray2ind (1, ones (2,2))
 %!error <N must be a positive integer> gray2ind (1, 0)
 %!error <N must be a positive integer> gray2ind (1, 65537)