1

I'm using the 2D Fast Hartley Transform to do fast correlation of two images in the frequency domain, which is the equivalent of NCC (normalized cross correlation) in the spatial domain.

However, with NCC, I can get a confidence metric that gives me an idea of how strong the correlation is at a certain offset. In the frequency domain version, I end up with a peak-finding problem in the inverse FHT after doing the correlation, so my question is:

Can I use the value of the peak that I find in the correlation image to derive the same (or similar) confidence metric that I can get from NCC? If so, how do I calculate it?

1 Answers1

2

Without knowing what you actually computed I can only assume that the following is probably what you want. I interpret "correlation image" as the cross correlation $I_1 \star I_2$ of the two images $I_1$ and $I_2$. Depending on normalizations in your FHT and IFHT there might be an additional scale factor. In what follows I assume that you used a normalized FHT that is exactly its own inverse. Otherwise you have to correct for the additional factor.

The FHT is only a tool to compute the correlation image, just as the FFT is. So it gives you exactly $I_1 \star I_2$. Therefore the confidence can be computed exactly the same way as for the FFT. That is, let $P$ be the peak value, $N$ the total number of pixels in either image, $\mu_1$ and $\sigma_1$ the mean and standard deviation of $I_1$ and $\mu_2$ and $\sigma_2$ the mean and standard deviation of $I_2$. Then the correlation coefficient between the two images at the offset of the peak is

$$ \frac{P - N \, \mu_1 \mu_2}{N \, \sigma_1 \sigma_2}. $$

This is a value between $-1$ (maximal negative correlation) and $1$ (maximal positive correlation). The maximal score $1$ means that the two images are the same (up to an offset and gain correction of their intensities).

WimC
  • 32,192
  • 2
  • 48
  • 88
  • This is extremely useful, thank you - it allows me to pursue my development with a proper understanding of what my correlation image should contain, and as you point out I probably am missing a scale factor somewhere because I couldn't relate the two numbers satisfactorily. I will post back if I have further problems but for now I'm rolling again. – Roger Rowland Mar 17 '13 at 10:06
  • Ok, all solved, stupid mistake - it was a slight inaccuracy in my sub-pixel peak finding routine that - along with a missing scale factor - perturbed the peak values enough so that I couldn't numerically correlate with the spatial NCC score. Bounty awarded - many thanks. – Roger Rowland Mar 18 '13 at 15:59
  • WimC do you know how get correlation coefficient between two audio samples? And how calculate peak? – tmt Jul 02 '13 at 10:39