The main problem is likely to be how you declared fft_input. Based on your previous question, you are allocating fft_input as an array of kiss_fft_cpx. The function kiss_fftr on the other hand expect an array of scalar. By casting the input array into a kiss_fft_scalar with: kiss_fftr(fftConfig, (kiss_fft_scalar * )fft_input,...

You are almost there. Just missed to include the imaginary plane which is all zeroes. Mat planes[] = {Mat_<float>(dataPad), Mat::zeros(dataPad.size(), CV_32F)}; Mat complexI; merge(planes, 2, complexI); dft(complexI, complexI, DFT_COMPLEX_OUTPUT); std::cout << complexI ; Of lesser importance is OpenCV's way of padding is to use copyMakeBorder and getOptimalDftSize. Mat dataPadded; //expand...

Here are some lines of your code : char* interferogram = new char[imN]; ... double value = 0; double window = 0; for (int y = 0; y < imSize; y++) { for (int x = 0; x < imSize; x++) { value = 127.5 + 127.5 * cos((2*PI) /...

the outcome of the dft (magI) is a float Mat, but you can only save uchar images with imwrite. since you normalized the image to [0..1] , the resulting uchar - grayscale img only has 0 and 1 values, which will look pretty black indeed. also, applying cv::cvtColor(magI, gs_bgr, CV_RGB2GRAY);...

c,signal-processing,fft,fftw,dft

There are a lot of good questions and answers on this subject on SO already, but a few general pointers: the spectrum of your sample will typically be time-varying you usually choose a window size (== FFT size) where there will be little short-term change in the spectrum, e.g. 10...

This error is caused by incompatibility of data type. You are probably working with image which is a uint8 type data but other arithmetic needs double. I suggest you that convert your signal to double firstly. For example, before the loops write this: I = double(I); %// Now your signal...

I think the code could be like this: load('eeg_4m.mat') fs=2048; x=val(1,:); N=length(x); ts=1/fs; tmax=(N-1)*ts; t=0:ts:tmax; plot(t,x); % plot time domain nfft = 2^( nextpow2(length(x)) ); df = fs/nfft; f = 0:df:fs/2; X = fft(x,nfft); X = X(1:nfft/2+1); figure; plot(f,abs(X)); axis([0,50,0,10e6]); % plot freq domain ...

matlab,image-processing,fft,dft

You just need to cast the data to double, then run your code again. Basically what the error is saying is that you are trying to mix classes of data together when applying a matrix multiplication between two variable. Specifically, the numerical vectors and matrices you define in dft1 are...

signal-processing,dft,windowing,kissfft

Frequency domain output clarifications In the frequency domain, the rectangular and Hamming windows look like: As you may be aware, multiplication in the time domain by a window corresponds to a convolution in the frequency domain, which essentially spreads the energy of the signal over multiple frequency bins in what...

ios,c,audio,signal-processing,dft

I think one problem is with these lines: float *data=(float*)inCompleteAQBuffer->mAudioData; int nn = sizeof(data)/sizeof(float); which I believe is intended to tell you the number of samples. I don't have the information or resources to reproduce your code, but can reproduce the bug with this: #include <stdio.h> #include <stdlib.h> int main(void)...

Like @VladimirF already said, the ordering of the values is a bit different, than you might expect. The first half of the array holds the positive frequencies, the second half holds the negative frequencies in reverse order (see this link). And you might have to check the sign convention used...

Try N <- 3 w <- exp(-2*pi*1i/N) outer(0:(N-1), 0:(N-1), function(i, j) w^(i*j)) / sqrt(N) # [,1] [,2] [,3] #[1,] 0.5773503+0i 0.5773503+0.0i 0.5773503+0.0i #[2,] 0.5773503+0i -0.2886751-0.5i -0.2886751+0.5i #[3,] 0.5773503+0i -0.2886751+0.5i -0.2886751-0.5i ...

I'll summarize my comments into an answer. When one thinks of doing a Fourier transform to work in the inverse domain, the assumption is that doing the inverse transform will return the same function/vector/whatever. In other words, we assume This is the case with many programs and libraries (e.g. Mathematica,...

This will be a numerical problem. The values are in the range of 1e-15, while the DFT of your signal has values in the range of 1e+02. Most likely this won't lead to any errors when doing further processing. You can calculate the total squared error between your DFT and...