2

Does the (i)fftshift operation which changes the position of an certain value have something to do with the reconstructed image? If using zero-filling, cutting the data in frequency-domain also make no sense? A MATLAB demonstration:

I = imread('cameraman.tif');

% making 3 different frequency data
kraw = fft2(I);
kshift = fftshift(kraw);
kcut = kshift(:,1:end-64);

imshow(abs([kraw,kshift,kcut]),[])
% reconstructing
ToImage = @(x) uint8(abs(x));
Rraw = ToImage(ifft2(kraw));
Rshift = ToImage(ifft2(kshift));
Rcut = ToImage(ifft2(kcut,size(I,1),size(I,2)));
imshow([I,Rraw,Rshift,Rcut])

% metric the difference
ssim_raw = ssim(uint8(abs(Rraw)),I);
ssim_shift = ssim(uint8(abs(Rshift)),I);
ssim_cut = ssim(uint8(abs(Rcut)),I);
title(['SSIM:    1-----|-----',num2str(ssim_raw),'----|-----',num2str(ssim_shift),'----|-----',num2str(ssim_cut)])
Shannon
  • 323
  • 1
  • 11

1 Answers1

1

I can't run matlab right now, but the general answer is that they have to produce different results. The DFT is an isomorphism, which means that there is one and only one spectrum for any image and one and only one image for any spectrum.

You should probably look at the actual coherent differences of the results. For instance, an fftshift in the frequency domain is equivalent to a linear phase multiplication in the spatial domain and will not affect the magnitude. The cut example surprises me, so I suspect its the result of how the ssim metric works. I am not familiar with it so I can't give any specifics.

AnonSubmitter85
  • 933
  • 7
  • 14
  • Will the location of each component affect the result after ifft2? I can get an apt image like this: `Rcut_shift = ToImage(ifft2(ifftshift(kcut),size(I,1),size(I,2)));` **The zero-frequency component is not at top-left for ifftshift(kcut)** – Shannon Jan 04 '18 at 02:28
  • If I understand what you are asking correctly ... shifting the location of the samples in the frequency domain changes the phase of the image domain samples but not their magnitude. For instance, try the following: `x = ones(5,5); X = fft2(x); x2 = ifft2(ifftshift(X));` You will see that the magnitudes of `x` and `x2` are equal but their phases are not. – AnonSubmitter85 Jan 04 '18 at 17:12