1
$\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$
9
  • $\begingroup$ is the original image square? $\endgroup$ Aug 9, 2019 at 10:00
  • $\begingroup$ yes it is 256*256 $\endgroup$
    – SheppLogan
    Aug 9, 2019 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$
    – SheppLogan
    Aug 9, 2019 at 10:03
  • $\begingroup$ and look what happens if I remove the ifftshift... I get him rotated indeed but with artefacts ... why ?! $\endgroup$
    – SheppLogan
    Aug 9, 2019 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$
    – SheppLogan
    Aug 9, 2019 at 10:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.