Reputation: 430
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)])
Upvotes: 2
Views: 76
Reputation: 933
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.
Upvotes: 1