Wednesday 24 June 2015

Process Mat collectively for Fourier Transform

I am very fond of Matlab because it is very easy to deal with vectors, matrices. This is not the case in Opencv, when you want to process element wise operations for Mat you always have to iterate through every row and column.

Here is an interesting discussion on how to do collective processing. Nevertheless, in case of DFT, it is easy to avoid iterations. What not so easy to comprehend is the Opencv documentation on DFT, which is like a tone-twister.

To compute DFT, use dft and set the flag as DFT_SCALE|DFT_COMPLEX_OUTPUT, which is pointed out here. To compute the element wise multiplication of the resulting matrices of two DFT, use mulSpectrums, which gives x.*y. If you want x.*conj(j), set the last flag as true (DFT_COMPLEX_OUTPUT,true).  

No comments:

Post a Comment