1
function C = dic_normxcorr2(OPTIMIZE, hwid, icp, T, base, sum_T, denom_T)
2
% Copyright 1993-2004 The MathWorks, Inc.
3
% $Revision: 1.12.4.6 $ $Date: 2004/10/20 17:54:20 $
5
% We normalize the cross correlation to get correlation coefficients using
6
% the definition of Haralick and Shapiro, Volume II (p. 317), generalized
12
outsize = size(base.sub_base_fft);
15
FT = fft2_cuda(double(rot90(T,2)),outsize(1),outsize(2));
16
xcorr_TA = real(ifft2_cuda(FT .* base.sub_base_fft));
18
FT = fft2(double(rot90(T,2)),outsize(1),outsize(2));
19
xcorr_TA = real(ifft2(FT .* base.sub_base_fft));
22
denom = denom_T*base.denom_A;
24
numerator = (xcorr_TA - base.local_sum_A*sum_T/mn ) / (mn-1);
26
i_nonzero = base.i_nonzero;
28
% We know denom_T~=0 from input parsing;
29
% so denom is only zero where denom_A is zero, and in
30
% these locations, C is also zero.
31
C = zeros(size(numerator));
32
C(i_nonzero) = numerator(i_nonzero) ./ denom(i_nonzero);