dft

KISS FFT output with or without windowing

孤街醉人 提交于 2019-12-10 15:50:31
问题 I am currently trying to implement fft into avr32 micro controllers for signal processing purposes using kiss fft. And having a strange problem with my output. Basically, I am passing ADC samples (testing with function generator) into fft (real input, 256 n size) and retrieved output makes sense to me. However, if I apply Hamming window to ADC samples and then pass these to FFT, the frequency bin of the peak magnitude is wrong (and different from previous result without windowing). ADC

OpenCV DFT_INVERSE different from Matlab's ifft

狂风中的少年 提交于 2019-12-10 10:23:31
问题 I try to filter a signal using opencv's dft function. The way I try to this is taking the signal in time domain: x = [0.0201920000000000 -0.0514940000000000 0.0222140000000000 0.0142460000000000 -0.00313500000000000 0.00270600000000000 0.0111770000000000 0.0233470000000000 -0.00162700000000000 -0.0306280000000000 0.0239410000000000 -0.0225840000000000 0.0281410000000000 0.0265510000000000 -0.0272180000000000 0.0223850000000000 -0.0366850000000000 0.000515000000000000 0.0213440000000000 -0

fft2 in MATLAB vs dft in OpenCV C++ speed comparison

你说的曾经没有我的故事 提交于 2019-12-09 19:39:47
问题 I'm wondering why the dft function in OpenCVC++ is a lot slower than fft2 for 2D matrices. The following C++ code is from the documentation: void fft2(const Mat in, Mat &complexI) { Mat padded; int m = getOptimalDFTSize(in.rows); int n = getOptimalDFTSize(in.cols); copyMakeBorder(in, padded, 0, m - in.rows, 0, n - in.cols, BORDER_CONSTANT, Scalar::all(0)); Mat planes[] = {Mat_<float>(padded), Mat::zeros(padded.size(), CV_32F)}; merge(planes, 2, complexI); dft(complexI, complexI); } int main()

unit of fft(DFT) x axis [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-09 00:03:19
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to get Frequency from FFT result I am somehow confused with the x axis of fft(DFT) command in Matlab. When we do a fft command for a signal which has sampled in n point, we get a plot in which the x axis is 0 to n-1. Does it mean frequency in Hz? For example when I have a spike on n=2 is it mean that the signal frequency is 2Hz? 回答1: The X axis is dimensionless. To get the correspondence between bin index

FFTW fftwf_plan_r2r_2d() with FFTW_REDFT01 equivalent

别来无恙 提交于 2019-12-08 11:52:29
问题 I am trying to port code that uses FFTW to use KissFFT. The code uses fftwf_plan_r2r_2d() with FFTW_REDFT01. What would be the equivalent call in KissFFT? If this call (with FFTW_REDFT01 ) is equivalent to a DCT, could I just use a direct DCT transform instead, e.g. such as OpenCV cv::dct? Is there some input data modification I'd need to do, like reflections and symmetrizations? 回答1: Answering my own question... With the help of these two references, I ended up not using DFT at all, but

How to calculate the energy per bin in a DFT?

折月煮酒 提交于 2019-12-07 15:15:52
问题 I am testing my knowledge about Discrete Fourier Transforms. What I am testing now is how to calculate the central frequency of a wave using DFT. For that purpose I create a sinusoidal data using this code: // create a 100 Hz wave with a sampling rate of 512 samples per second var data : [Double] = [] for i in 0...511 { let t = Double(i) * 100/256 let f = 10 * sin(2 * Double.pi * t) data.append(f) } Then I do a DWT on data and get two vectors, one containing the real part and one containing

Implementing FFT over finite fields

冷暖自知 提交于 2019-12-06 23:52:04
问题 I would like to implement multiplication of polynomials using NTT. I followed Number-theoretic transform (integer DFT) and it seems to work. Now I would like to implement multiplication of polynomials over finite fields Z_p[x] where p is arbitrary prime number. Does it changes anything that the coefficients are now bounded by p , compared to the former unbounded case? In particular, original NTT required to find prime number N as the working modulus that is larger than (magnitude of largest

OpenCV DFT_INVERSE different from Matlab's ifft

不问归期 提交于 2019-12-06 03:03:56
I try to filter a signal using opencv's dft function. The way I try to this is taking the signal in time domain: x = [0.0201920000000000 -0.0514940000000000 0.0222140000000000 0.0142460000000000 -0.00313500000000000 0.00270600000000000 0.0111770000000000 0.0233470000000000 -0.00162700000000000 -0.0306280000000000 0.0239410000000000 -0.0225840000000000 0.0281410000000000 0.0265510000000000 -0.0272180000000000 0.0223850000000000 -0.0366850000000000 0.000515000000000000 0.0213440000000000 -0.0107180000000000 -0.0222150000000000 -0.0888300000000000 -0.178814000000000 -0.0279280000000000 -0

How to calculate the energy per bin in a DFT?

为君一笑 提交于 2019-12-06 02:08:26
I am testing my knowledge about Discrete Fourier Transforms. What I am testing now is how to calculate the central frequency of a wave using DFT. For that purpose I create a sinusoidal data using this code: // create a 100 Hz wave with a sampling rate of 512 samples per second var data : [Double] = [] for i in 0...511 { let t = Double(i) * 100/256 let f = 10 * sin(2 * Double.pi * t) data.append(f) } Then I do a DWT on data and get two vectors, one containing the real part and one containing the imaginary part. I understand that the inside each vector I will have this: data has 512 samples

How can I transfer a discrete set of data into the frequency domain and back (preferrably losslessly)

拟墨画扇 提交于 2019-12-05 10:15:15
问题 I would like to take an array of bytes of roughly size 70-80k and transform them from the time domain to the frequency domain (probably using a DFT). I have been following wiki and gotten this code so far. for (int k = 0; k < windows.length; k++) { double imag = 0.0; double real = 0.0; for (int n = 0; n < data.length; n++) { double val = (data[n]) * Math.exp(-2.0 * Math.PI * n * k / data.length) / 128; imag += Math.cos(val); real += Math.sin(val); } windows[k] = Math.sqrt(imag * imag + real *