DSPRelated.com
Forums

Help - template matching using FFT2

Started by narcolepsyfreak June 23, 2003
hi..

i am currently working on an image recognition. i am using fft2 to
find correlation value between 2 image.

lets say i have an image of an object and a matching template. when i
use fft2, why is it, in the correlation matriks, the highest
correlation value is not is the centerof the object ? but rather
offset to the lower right.

these are the command i use :

i = imread('object.bmp');
j = imread('template.bmp');
[m n] = size(i);
corrmat = real(ifft2(fft2(i) .* fft(rot90(j,2),m,n));
imshow(corrmat,[]); % -> offset to the lower right ???

anyone can explain this to me ? thanks.