title: image rotation in frequency domain
body: <p>I found a code about image rotation in frequency domain. But I couldn't understand this code. This code works correct. Can anyone describe this code? Actually I have to write a code to rotate an image in frequency domain in polar coordinates. Do you think this code 
  meet the requirements.</p>
  
  <pre><code>clear;
  img=imread('cameraman.tif');
  imshow(img); title('original image');
  theta=26,5;
  N=size(img,1);
  M=size(img,2);                                      
  
  fimg=fftshift(fft2(fftshift(img)));
  
  p=ones(N,1)*[-N/2:(N-1)/2];               % horizontal axis
  q=-p';                                                     % vertical axis
  
  theta=2*pi*theta/360;
  g=1/(N^2).*fimg;
  z1=exp(i*pi/N.*((p.^2-q.^2)*cos(theta)-2*p.*q*sin(theta)));
  z2=exp(-i*pi/N.*((p.^2-q.^2)*cos(theta)-2*p.*q*sin(theta)));
  k=ifft2(fft2(g.*z1).*(fft2(z2)));
  figure,
  imshow(abs(fftshift(flipud(k))), [0 255]); 
  title(['Cameraman rotated at ' num2str(theta*360/(2*pi))  ' Degrees']); axis off
  </code></pre>