# Log-Polar DFT Based Scale-Invariant Image Registration

I'm trying to do image registration using phase correlation as described in the Reddy Chatterji paper. In my case, the images may be scaled and translated relative to each other.

The algorithm for finding the relative scale, as I understand it, is (see: the flowchart from the paper):

F1 = DFT(I1)
F2 = DFT(I2)
H1 = Highpass(F1)
H2 = Highpass(F2)
L1 = LogPolar(Magnitude(H1))
L2 = LogPolar(Magnitude(H2))
PC = PhaseCorrelate(L1,L2)
PM = norm(PC)
R = IDFT(PhaseCorr/PM)
P = Peak(R)
Scale = LogBase^P[1]


Scale gives me seemingly nonsensical values (wildly different from image to image and never correct).

But ignoring scale, the same phase correlation approach works fine for translation; and so I suspect I have a problem with my log-polar transform. Here's an example, where I've solved for translation--the left image is the original and the right has been cropped and translated--the solution is shown on top of the orignal:

For the log-polar transform, I first transform into polar space: $$\hat{I}(\rho,\theta) = I\left(r+\rho\cos\left(\frac{2\pi\theta}{N_{\theta}}\right),r-\rho\sin\left(\frac{2\pi\theta}{N_{\theta}}\right) \right)$$ where $I$ is the original image, $r$ is the image radius (half-width) and $N_{\theta}$ is the number of samples in the $\theta$ direction. I then sample from this to transform into log polar space: $$\hat{I}_{log}(\rho,\theta) = \hat{I}\left(\log_{b}(\rho),\theta\right)$$ where $b = (2r)^{-N_{\rho}}$ as described in 1 so that it spans the whole polar space.

Here're the example images in log-polar space with $\rho=\theta=256$ (in case there's something glaringly wrong):

Lastly, this shows the actual transformation the images go through before the phase correlation step (top is DFT magnitude post highpass filter, bottom is that in log polar space):

I'm using OpenCV, which has LogPolar and PhaseCorrelate methods. While the PhaseCorrelate, like my manual implementation, gives me the correct answer for translation, it's incorrect on scale. Since using the OpenCV LogPolar or my own doesn't affect the correctness, I must be missing something.

Any help would be appreciated.

• Did you figure out what was wrong? Jan 9 '16 at 21:52
• @Mr.WorshipMe Unfortunately not. Jan 15 '16 at 19:29
• @Drew Cummins, I guess it was due to the test image you used, because there was sharp transition from the background. How about other test images? Also, from the last figure, there were apparent differences between the two magnitudes, thus it is better to preform proper windowing pre-processing before the DFT.
– lxg
Mar 27 '17 at 3:19
• A couple of days before I found that paper and I've been trying to implement the algorithm without success. I was wondering if you could share your implementation to a beginner :) Jul 31 '18 at 17:14