3

Here is my code. What should I do next? How can I calculate horizontal and vertical offset amount of two images? (I3 and I4 are shifted images)

I1 = imread('cameraman.tif');
I3 = I1(65:196, 65:196); 
I4 = I1(75:206,65:196);

F3 = fft2(I3);
F4 = fft2(I4);

FF = conj(F3).* F4;
Is = ifft2(FF);

figure, mesh(fftshift(Is))

and here is my output enter image description here

1

1 Answer 1

2

While you tried to implement cross correlation efficiently using fft, to gain some intuition it would be better to do it in spatial domain.

Basically the location of the peak of the cross correlation relatively to the origin of the 2D support is the shift between the 2 images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.