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?

  • $\begingroup$ Can you give more info, perhaps formula for confidence metric? After inverse FHT is the result different to NCC result? $\endgroup$ Mar 15 '13 at 9:21
  • $\begingroup$ NCC in the spatial domain gives a value between -1 and +1. The positive values are effectively a percentage confidence score. The correlation image that I get after inverse FHT has a peak with e.g. a very large value - I assume some combination of original pixel values that I can't easily relate to the -1..+1 equivalent. $\endgroup$ Mar 15 '13 at 9:28
  • $\begingroup$ I'm thinking is that the NCC via FHT has a problem. Can you post the code for your implementation? $\endgroup$ Mar 15 '13 at 16:54
  • $\begingroup$ No, the NCC via FHT is fine, I can recover the translation shift with sub-pixel precision. The only problem I have is that I need to do a spatial NCC using the recovered shift to get the confidence. I just want to do this faster, so I want to use the peak value in the correlation image to calculate the same score that NCC gives me. $\endgroup$ Mar 15 '13 at 20:20

Ok, I finally found the reason for my confusion - thanks to this answer.

There were a number of reasons why I couldn't get my spatial NCC and frequency domain peak values to agree numerically. Some obvious, some subtle, all stupid. For the sake of completeness, here they are:

  1. I had missed an offset and scale factor that was introduced when normalising my image data after importing the pixel values in preparation for FHT.
  2. I was using a predicted maximum value for the peak, from my sub-pixel shift calculation instead of the actual peak.
  3. I had a low-pass filter in the pipeline, which - for performance - I was applying concurrently with the correlation operation. So my peak value was scaled by the filter.

Not being mathematically inclined, I was wrongly attempting to "explain" my problem by assuming that using FHT was somehow inherently different to using FFT. After being pointed in the right direction I found the above issues and finally got the results I was expecting.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.