Can we change the scale of image by using FFT? I mean, how should i do process on frequency domain of image to upscale or downscale the orginal image?

The other question of mine is that how can changing scale of image affect on fft of this image?

  • $\begingroup$ What do you mean by 'scale'? Resolution? $\endgroup$
    – lxop
    Dec 13 '18 at 12:58
  • $\begingroup$ @Ixop yes, I mean upscaling or downscaling the resolution of image. $\endgroup$
    – Mert Ege
    Dec 13 '18 at 13:01

Yes image scaling can also be performed in frequency domain using DFT/FFT.

For example, given an $N \times M$ image, you can implement the interpolation by integer $K$ in the frequency domain by enlarging the $N \times M$ point DFT/FFT of the original image into $K \cdot N \times K \cdot M$ size where new DFT/FFT samples are all zero; except at the four corners; effectiveley you are zero padding the original DFT/FFT in frequency domain. The effect in time domain wil be interpolation.

The following is an example of 2x image zooming using FFT.

K = 2;
I = im2double(imread('Cameraman.tif');
S = size(I);

F = fft2(I);
F2 = repmat( K*K*F , K , K);

Mask = zeros(K*S);
Mask(1:S(1)/2+1 , 1:S(2)/2+1) = 1;
Mask(end-S(1)/2 : end , 1:S(2)/2+1) = 1;
Mask(1:S(1)/2+1 , end-S(2)/2 :end ) = 1;
Mask(end-S(1)/2 : end , end-S(2)/2 :end ) = 1;

F2 = Mask.*F2;

I2 = real( ifft2( F2 ));
figure,ishow(I2);title('2x Zoomed');

You should adjust the mask carefully for even and odd length dimensions...

  • $\begingroup$ Where should i locate the zero pads in frequency domain? $\endgroup$
    – Mert Ege
    Dec 13 '18 at 11:58
  • 1
    $\begingroup$ as I said only the corner sub rectangles are nonzero, the rest is zero. $\endgroup$
    – Fat32
    Dec 13 '18 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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