Mercurial > forge
changeset 11383:fc6a0b0a3a8b octave-forge
corr2: fix typo on call to isimage and turn into wrapper for corr()
* fix typo on call to isimage (was ismage)
* replaced code to wrapper around the core function corr()
author | carandraug |
---|---|
date | Mon, 14 Jan 2013 00:59:01 +0000 |
parents | 1ad96d9ee4a5 |
children | e49f79b744f3 |
files | main/image/inst/corr2.m |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/main/image/inst/corr2.m Mon Jan 14 00:43:08 2013 +0000 +++ b/main/image/inst/corr2.m Mon Jan 14 00:59:01 2013 +0000 @@ -15,21 +15,22 @@ ## -*- texinfo -*- ## @deftypefn {Function File} @var{r} = corr2 (@var{I},@var{J}) -## Returns the correlation coefficient between @var{I} and @var{j}. -## @var{I}, @var{J} must be real type matrices or vectors of same size. -## @seealso{cov, std2} +## Compute correlation coefficients of images. ## +## The two images @var{I} and @var{J} must be real type matrices or vectors of +## same size. +## @seealso{corr, cov, std2} ## @end deftypefn function r = corr2 (I, J) if (nargin != 2) print_usage (); - elseif (!ismage (I) || !isimage (J)) - error ("corr2: argument must be real matrices"); - elseif (!size_equal (I, J)) - error ("corr2: arguments must be of same size") + elseif (! isimage (I) || ! isimage (J)) + error ("corr2: I and J must be real matrices"); + elseif (! size_equal (I, J)) + error ("corr2: I and J must be of same size"); endif - r = cov (I (:), J (:)) / (std2 (I) * std2 (J)); + r = corr (I(:), J(:)); endfunction