0
$\begingroup$

Please consider the following small example:

x=im2double(imread('cameraman.tif'));
X=fft2(x);

Xr=imrotate(fftshift(X),90);

xRec=ifft2(ifftshift(Xr));

figure;
subplot(2,2,1);
imshow(x);
subplot(2,2,2);
imshow(xRec);
subplot(2,2,3);
imshow(log(fftshift(abs(X))+1),[]);
subplot(2,2,4);
imshow(fftshift(log(abs(fft2(xRec))+1)),[]);

%magnitudes of both have same total energy
sum(sum(abs(X)))-sum(sum(abs(Xr)))

the result xRec is indeed rotated by 90 degrees when reconstructed from rotated Fourier domain, but a dark band appears in the center. Can someone help me to implemented in the correct manner? The goal is of course to show the Fourier rotation property. That rotation in one domain is equivalent to rotation in the other.

enter image description here

even more interesting, if i remove the ifftshift I almost get my rotated cameraman but with artefacts ! enter image description here

also some trick with polar coordinates is mentioned here (slide 22) ... but I would need help ...

https://www.kth.se/social/upload/528393f5f276545b305c8dfd/13_lecture05b.pdf

$\endgroup$
  • $\begingroup$ is the original image square? $\endgroup$ – Marcus Müller Aug 9 at 10:00
  • $\begingroup$ yes it is 256*256 $\endgroup$ – Machupicchu Aug 9 at 10:03
  • $\begingroup$ i ve also tried padding it like x=padarray(x,[256 256]); but then result is black but same (visually I mean) spectrum (rotated) $\endgroup$ – Machupicchu Aug 9 at 10:03
  • $\begingroup$ and look what happens if I remove the ifftshift... I get him rotated indeed but with artefacts ... why ?! $\endgroup$ – Machupicchu Aug 9 at 10:09
  • $\begingroup$ These artifacts seem periodic however, and I wonder if some kind of interpolation is needed ...or something like that ... but why and how ...it seems quite a difficult problem? $\endgroup$ – Machupicchu Aug 9 at 10:29

Your Answer

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

Browse other questions tagged or ask your own question.