0

I want to rotate an image in frequency domain. However there is something in picture like aliasing. What is the problem and how can I solve it? Assume that, I only have FFT result of the image and know the rotation angle in image domain.

My code and samples pictures are below:

close all
f=imread('cameraman.tif');
theta=pi/3;
T=[cos(theta) sin(theta) 0;
  -sin(theta) cos(theta) 0
      0          0       1];

t2 = maketform('affine',T);
g2 = imtransform(f,t2);
figure,imshow(f),title('Original image') % original image
figure,imshow(g2),title('Rotate image')  % rotated image

f_shift = fftshift(f);
f_fft   = fftshift(fftn(f_shift));
g2 = imtransform(f_fft,t2);   % rotation frequency domain
figure,imshow(abs(g2),[]),imcontrast % rotation in frequency domain
image_rotate = ifftshift(ifftn(g2));
figure,imshow(abs(image_rotate),[])  % result in image domain

enter image description here

toygan kılıç
  • 422
  • 4
  • 16
  • 1
    @rayryeng I think that it is not duplicate of the question you show. In my question, We are assuming we have only FFT result of the image. In my real problem I dont of the image itself. – toygan kılıç Mar 28 '16 at 09:34
  • 1
    @rayryeng OP asks for an arbitrary rotation, not just a ±90¸ ±180 one. I think the answer is NO WAY, but I'd be curious to see if someone can come with a solution to _this_ problem – gboffi Mar 28 '16 at 10:03
  • Why do you think it is not possible? – toygan kılıç Mar 28 '16 at 10:28
  • Because by transposing/shifting/complementing the DCT coefficients you can obtain a 90 etc rotation only, and I cannot think of a convolution in the spatial domain that amounts to an image rotation. But, as I said, I'd be happy to be wrong. – gboffi Mar 28 '16 at 10:56
  • http://stackoverflow.com/questions/23876034/image-rotation-in-frequency-domain this link could the task I want. However it uses the shifting property of the fourier transform. I wonder whether it is possible doing this task using rotation. – toygan kılıç Mar 28 '16 at 11:57
  • @toygankılıç It isn't. gbolfi is correct. I haven't seen anyone try to rotate an image in frequency domain... why don't you just rotate it in spatial domain? I chose this as a duplicate so you can start with this. – rayryeng Mar 28 '16 at 14:46
  • @rayryeng Because I have the information of rotation, translation. In addition to this, i have the data which is taken from MRI and they are in frequency domain. You say that it is not possible? – toygan kılıç Mar 28 '16 at 17:59
  • I've personally never seen any rotations done in frequency domain. The spatial domain equivalent is quite fast and an easy operation. Why don't you convert back to frequency domain and rotate? If someone can show me the error of my ways, I'd be happy to see how it's done. – rayryeng Mar 29 '16 at 01:11
  • The reason for doing this task in frequency domain is that the analysis I will be in frequency domain. All data should be registered in frequency domain. I think I could do it using the shifting property of the fourier transform as I gave the link. – toygan kılıç Mar 29 '16 at 01:35
  • @rayryeng http://stackoverflow.com/questions/25827916/matlab-shifting-an-image-using-fft As you solved this link. Instead of usage of x0 and y0 , I will use rotation matrix coefficients. – toygan kılıç Mar 29 '16 at 01:38
  • That is not the right way to approach what you're asking. It is simply shifting the image using the well known properly. Modifying to solve for the rotation matrix parameters will give you the wrong results. – rayryeng Mar 29 '16 at 01:51
  • Why doesn't this approach work? – toygan kılıç Mar 29 '16 at 02:22
  • It only shifts the image horizontally or vertically. It doesn't rotate the image. – rayryeng Mar 29 '16 at 04:27

0 Answers0