changeset 614:3a17c7402cc3

mean2: use other isimage internally
author carandraug
date Wed, 26 Sep 2012 07:36:15 +0000
parents c33c12769b71
children 8d3210ae9a4a
files inst/mean2.m
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/inst/mean2.m
+++ b/inst/mean2.m
@@ -14,21 +14,21 @@
 ## this program; if not, see <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} @var{m}= mean2 (@var{I})
-## Returns the mean value for a 2d real type matrix.
-## Uses @code{mean(I(:))}
-## @seealso{std2,mean}
+## @deftypefn {Function File} {@var{m}=} mean2 (@var{I})
+## Compute the mean value of the 2D image @var{I}.
+##
+## Note that @var{m} will be of class double, independently of the input class.
+## This is equivalent to @code{mean (I(:))}.
+##
+## @seealso{mean, std2}
 ## @end deftypefn
 
 function m = mean2 (I)
 
-  if !(nargin == 1)
+  if (nargin != 1)
     print_usage();
+  elseif (!isimage (I) || ndims (I) != 2)
+    error("mean2: argument must be a 2D image");
   endif
-
-  if !(ismatrix(I) && isreal(I))
-    error("mean2: argument must be a real type matrix");
-  endif
-
   m = mean (I(:));
 endfunction