Ask Your Question
0

dft function

asked 2017-05-31 04:51:35 -0600

Philippe gravatar image

I am using the dft function (tried with both real and complex input.... where imaginary part was set to zero). The output of the dft is in a compressed format.

1) how do I convert this into the natural format?

2) is there a way to calculate the dft without this intermediate step?

3) If I use a real signal with a pure tone (e.g. sine wave), I get artifacts in the dft (instead of only that specific frequency, I get perturbations other frequencies also). Is this a known issue?

4) when I do the inverse dft (to get the original signal), the results typically have 2 orders of magnitude more noise than LabView (language similar to Matlab, with its own FFT algorithm), does OpenVC take shortcuts that include rounding of values?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-05-31 09:35:44 -0600

LBerger gravatar image

updated 2017-05-31 11:15:31 -0600

Question 1 and 2 it is written in doc :

Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} & \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2}

If you don't want this flag use DFT_COMPLEX_OUTPUT

Mat sigX=(Mat_<double>(1,8)<<1,1,0,0,0,0,0,0),fftsigx;
dft(sigX, fftsigx);
cout << "flag=0 : " << fftsigx << "\n";
dft(sigX, fftsigx, DFT_COMPLEX_OUTPUT);
cout << "flag=DFT_COMPLEX_OUTPUT : " << fftsigx << "\n";

flag=0 : [2, 1.707106781186547, -0.7071067811865475, 1, -1, 0.2928932188134524, -0.7071067811865475, 0]

flag=DFT_COMPLEX_OUTPUT : [2, 0, 1.707106781186547, -0.7071067811865475, 1, -1, 0.2928932188134524, -0.7071067811865475, 0, 0, 0.2928932188134524, 0.7071067811865475, 1, 1, 1.707106781186547, 0.7071067811865475]

Question 3 it is well known issue but not in opencv : window effect.

Question 4 : I want to see your code but with this code no problem

dft(fftsigx, sigX, DFT_COMPLEX_OUTPUT+DFT_INVERSE+DFT_SCALE);
cout << "flag=DFT_COMPLEX_OUTPUT+INVERSE : " << sigX << "\n";
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-31 04:51:35 -0600

Seen: 406 times

Last updated: May 31 '17