Reply by sangthong February 18, 20082008-02-18
Hi,

Could anybody tell me how to shift the 2D cross correlation result in
matlab. For example, in 1D cross correlation, the result of cross
correlation will be twice of the maximum signal length minus 1, which then
the first half of the graph will be padded to zero. The result will spread
from right to left according to the length of signal to be correlated.
From this, we can plot the graph back to its right location (in term of
peak location) by using the code below;

%If there are signals of x and y doing the cross correlation

k=xcorr(x,y);
N=max(length(x)-1,length(y)-1); 
p=(1:2*N)-N;
plot(p,k)

%the result of cross correlation will shift back to get the correct 
%location of peak

My question is how can we do this in 2D cross correlation since the length
of signals are in 2D array?

Thanks,
Sangthong