normalized cross-correlation for analytic signals
1 view (last 30 days)
Show older comments
I am trying to write a function for template matching using normalized cross-correlation. The normxcorr2 function seems to be an ideal solution but it does not accept non-real template and it returns only double result:
??? Error using ==> iptcheckinput Function NORMXCORR2 expected its first input, T, to be real.
Error in ==> normxcorr2>ParseInputs at 242 iptcheckinput(T,{'logical','numeric'},{'real','nonsparse','2d','finite'},mfilename,'T',1)
Error in ==> normxcorr2 at 61 [T, A] = ParseInputs(varargin{:});
Unfortunately my data are 2D analytic signals and to find the best match for the template I should use the zero crossing of the normalized cross-correlation (complex) phase in the vicinity of the maximum of the normalized cross-correlation (complex) magnitude.
Is it possible to slightly modify the normxcorr2 function so that it will accept complex images? Or the best solution is to use the xcorr2 function, however then abs(xcorr2) will not be normalized.
0 Comments
Answers (1)
Sean de Wolski
on 2 Dec 2011
You could perhaps normalize xcorr2 by dividing by the product of the standard deviations. I'd recommend against trying to modify normxcorr2.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!