normxcorrn

PURPOSE ^

Normalized n-dimensional cross-correlation.

SYNOPSIS ^

function C = normxcorrn( T, A, shape, Tm )

DESCRIPTION ^

 Normalized n-dimensional cross-correlation.

 For 2 dimensional inputs this function is exactly the same as normxcorr2,
 but also works in higher dimensions.   For more information see help on
 normxcorr2.m.  Also see Forsyth & Ponce 11.3.1 (p241).

 Also, it can take an additional argument that specifies a figure ground
 mask for the T.  That is Tm must be of the same dimensions as T, with
 each entry being 0 or 1, where zero specifies regions to ignore (the
 ground) and 1 specifies interesting regions (the figure).  Essentially Tm
 specifies regions in T that are interesting and should be taken into
 account when doing normalized cross correlation. This allows for
 templates of arbitrary shape, and not just squares. Note: with a mask,
 this function is approximately 3 times slower because it cannot use the
 trick of precomputing running sums.

 USAGE
  C = normxcorrn( T, A, [shape], [Tm] )

 INPUTS
  T           - template to correlate to each window in A
  A           - matrix to correlate T to
  shape       - ['full'] 'valid', 'full', or 'same', see convnFast help
  Tm          - [] figure/ground mask for the template

 OUTPUTS
  C           - correlation matrix

 EXAMPLE
  T=gaussSmooth(rand(20),2); A=repmat(T,[3 3]);  Tm=ones(size(T));
  C1=normxcorrn(T,A);  C2=normxcorr2(T,A);  C3=normxcorrn(T,A,[],Tm);
  figure(1); im(C1);  figure(2); im(C2);  figure(3); im(C3);
  figure(4); im(abs(C1-C2));  figure(5); im(abs(C2-C3));

 See also XEUCN, XCORRN, CONVNFAST

 Piotr's Computer Vision Matlab Toolbox      Version 2.0
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]

Generated by m2html © 2003