1
$\begingroup$

The translation property of Fourier Transform (FT) for a two dimensional image $f$ is as $$ f(x-x_0, y - y_0) = F(u, v)e^{-j2\pi(ux_0/M+vy_0/N)} $$

Using this equation, the following code (in Matlab) computes and shows translation of the input image.

im = im2double(imread('cameraman.tif'));
F = fft2(im);
[r, c] = size(F);
x0 = 20;
y0 = 40;

% [u, v] = meshgrid(1:c, 1:r);
[u, v] = meshgrid(-c/2:c/2-1, -r/2:r/2-1);
A = fftshift(exp(-1i * 2 * pi * (u * x0 / c + v * y0 / r )));

Y = F .* A ;
y = ifft2(Y);
imshow(real(y), [])

The output of above code is as follows transalation using FFT but I need output image be as following desired output

My question: How I can produce The second image using FT? Thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

You can obtain an apparently linear translation using DFT by

  • first zero padding the original image into a large enough size according to the translation you want.

  • then applying DFT for unavoidable circulant translation

  • and finally cropping the original size of the output

Very inefficient using FT but if it's what you want...

$\endgroup$

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.