Can anyone advise on the correct FFT to be using (Real or Complex)? I have looked here but still have questions.
I want to do image correlation to identify the location of a sub image within a master image. I understand the basics of FFTs and iFFTs.
The plan:
- Perform an FFT on a master image. 512x512
- Take complex conjugate of sub image.
- Perform an FFT on the sub image. 30x30 but padded with zeros to 512x512
- Complex Multiply the two resulting matrixes
- Perform iFFT on result
- Even though the result should be (mostly) real, take the magnitude of resulting matrix
- Look for maximum value which should correspond to maximum correlation.
I am having trouble getting the results that I anticipate.
If I use the real 2d fft (vDSP_fft2dzrip), the result is in a packed format that makes it hard to use a vDSP_zvmul to multiply to two result matrixes.
If I use the complex fft (vDSP_fft2dzip), I fail to get any correlation at all.
The apple examples and most of the audio examples don't do anything with the results of the forward FFT other than do the inverse.
Can anyone help me get started with image correlation? First question...can I use the complex FFT and avoid the packed format?