title: Get rotational shift using phase correlation and log polar transform
body: <p>I have been working on a script which calculates the rotational shift between two images using cv2's <code>phaseCorrelate</code> method.</p>
  
  <p>I have two images, the second is a 90 degree rotated version of the first image. After loading in the images, I convert them to log-polar before passing them into the <code>phaseCorrelate</code> function. </p>
  
  <p>From what I have read, I believe that this should yield a rotational shift between two images.  </p>
  
  <p>The code below describes the implementation. </p>
  
  <pre class="lang-py prettyprint-override"><code>
  #bitwise right binary shift function
  def rshift(val, n): return (val % 0x100000000)
  
  base_img = cv2.imread('img1.jpg')
  cur_img = cv2.imread('dataa//t_sv_1.jpg')
  
  curr_img = rotateImage(cur_img, 90)
  
  rows,cols,chan = base_img.shape
  x, y, c = curr_img.shape
  
  #convert images to valid type
  ref32 = np.float32(cv2.cvtColor(base_img, cv2.COLOR_BGR2GRAY))
  curr32 = np.float32(cv2.cvtColor(curr_img, cv2.COLOR_BGR2GRAY))
  
  value = np.sqrt(((rows/2.0)**2.0)+((cols/2.0)**2.0))
  value2 = np.sqrt(((x/2.0)**2.0)+((y/2.0)**2.0))
  
  polar_image = cv2.linearPolar(ref32,(rows/2, cols/2), value, cv2.WARP_FILL_OUTLIERS)
  log_img = cv2.linearPolar(curr32,(x/2, y/2), value2, cv2.WARP_FILL_OUTLIERS) 
  
  shift = cv2.phaseCorrelate(polar_image, log_img)
  
  sx = shift[0][0]
  sy = shift[0][1]
  sf = shift[1]
  
  polar_image = polar_image.astype(np.uint8)
  log_img = log_img.astype(np.uint8)
  
  cv2.imshow("Polar Image", polar_image)
  cv2.imshow('polar', log_img)
  
  #get rotation from shift along y axis
  rotation = sy * 180 / (rshift(y, 1));
  print(rotation) 
  
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>I am unsure how to interpret the results of this function. The expected outcome is a value similar to 90 degrees, however, I get the value below.</p>
  
  <pre><code>Output: -0.00717516014538333
  </code></pre>
  
  <p>How can I make the output correct?</p>