fft

KissFFT (kiss_fftr to kiss_fftri) - How to reconstruct the original signal?

半世苍凉 提交于 2019-12-10 19:23:52
问题 I'm having some trouble understanding how to use KissFFT (1.2.9) correctly. All I am trying to achieve for now is to perform an FFT and then immediately perform an iFFT to reconstruct the original signal again. The code snippet below demonstrates what I'm doing: void test(short* timeDomainData, int length) { // Create the configurations for FFT and iFFT... kiss_fftr_cfg fftConfiguration = kiss_fftr_alloc( length, 0, NULL, NULL ); kiss_fftr_cfg ifftConfiguration = kiss_fftr_alloc( length, 1,

Fastest method to compute convolution

此生再无相见时 提交于 2019-12-10 18:42:11
问题 I have to apply a convolution filter on each row of many images. The classic is 360 images of 1024x1024 pixels. In my use case it is 720 images 560x600 pixels. The problem is that my code is much slower than what is advertised in articles. I have implemented the naive convolution, and it takes 2m 30s. I then switched to FFT using fftw. I used complex 2 complex, filtering two rows in each transform. I'm now around 20s. The thing is that articles advertise around 10s and even less for the

CUFFT: How to calculate fft of pitched pointer?

吃可爱长大的小学妹 提交于 2019-12-10 18:33:22
问题 I'm trying to calculate the fft of an image using CUFFT. It seems like CUFFT only offers fft of plain device pointers allocated with cudaMalloc . My input images are allocated using cudaMallocPitch but there is no option for handling pitch of the image pointer. Currently, I have to remove the alignment of rows, then execute the fft, and copy back the results to the pitched pointer. My current code is as follows: void fft_device(float* src, cufftComplex* dst, int width, int height, int

computational complexity of convolution

拈花ヽ惹草 提交于 2019-12-10 16:47:45
问题 I read that the computational complexity of the general convolution algorithm is O(n^2) , while by means of the FFT is O(n log n) . What about convolution in 2-D and 3-D? Any reference? 回答1: As for two- and three-dimensional convolution and Fast Fourier Transform the complexity is following: 2D 3D Convolution O(n^4) O(n^6) FFT O(n^2 log^2 n) O(n^3 log^3 n) Reference: Slides on Digital Image Processing, slide no. 34. 来源: https://stackoverflow.com/questions/16164749/computational-complexity-of

the Length of signal in calculating FFT

早过忘川 提交于 2019-12-10 14:38:33
问题 I want to ask some questions related to the last question of mine so I don't want to post in another thread. My question contains a code, I therefore can't post it as a comment. So I have to edit my old question into a new one. Please take a look and help. Thank you. I'm new to FFT and DSP and I want to ask you some questions about calculating FFT in Matlab. The following code is from Matlab help, I just removed the noise. Can I choose the length of signal L different from NFFT? I'm not sure

Extracting an amplitude list from *.wav file for use in Python

梦想与她 提交于 2019-12-10 14:23:45
问题 I'm having a little bit of programing and conversion trouble. I'm designing an AI to recognize notes played by instruments and need to extract the raw sound data from a wave file. My objective is to perform a FFT operation over chunks of time in the file for use by the AI. For this I need an amplitude list of the audio file, but I can't seem to find a conversion technique that will work. The files start as MP3's and then I convert them to wav file, but I always end up with a compressed file

FFT in numpy vs FFT in MATLAB do not have the same results

南笙酒味 提交于 2019-12-10 14:11:14
问题 I have a vector with complex numbers (can be found here), both in Python and in MATLAB. I am calculating the ifft -transformation with ifft(<vector>) in MATLAB and with np.fft.ifft(<vector>) in Python. My problem is that I get two completely different results out of it, i.e. while the vector in Python is complex, it is not in MATLAB. While some components in MATLAB are zero, none are in Python. Why is that? The fft -version works as intended. The minimal values are at around 1e-10 , i.e. not

fftw shift zero-frequency to image center

半城伤御伤魂 提交于 2019-12-10 11:53:03
问题 I am struggling on the result of FFTW applied on image. I can do the Fourier transform and inverse Fourier transform on image, I am sure the two functions are working. Now I am trying to analyze the result of Fourier transform and try to apply a filter on it, etc. Currently I am confusing on the FT result. As I know the the zero-frequency should be on the top-left corner. I should shift it to the image center if I want to check frequency friendly. There are at least two way I have tested. one

How can i calculate the peak using kissFFT?

时光毁灭记忆、已成空白 提交于 2019-12-10 11:44:59
问题 I want to apply FFT on the real audio device and calculate the peak from it here is my code.. N=8192 kiss_fft_cpx out[N/2 +1]; int len = fft->N / 2 + 1; kiss_fft_scalar* samples = &samples2[0]; //inputs from the mic kiss_fftr(fft->config, samples, out); for (int i = 0; i < len; i++) { float re = scale(out[i].r) * N; float im = scale(out[i].i) * N; if (i > 0) spectrum[i] = sqrtf(re * re + im * im) / (N / 2); else spectrum[i] = sqrtf(re * re + im * im) / N; } Now i calculate the pick using code

Fast Fourier Transform results: frequency axis scale?

只谈情不闲聊 提交于 2019-12-10 11:43:48
问题 I successfully implemented code that takes array data and runs a fast fourier transform on it, using Apple's Accelerate Framework (performed on iOS device). My question now is what is the scale of the frequency axis? The results have peaks as expected in certain frequency ranges, but I'm not sure what the frequency should be. The Accelerate Framework's FFT functions take in an array and spit out an array with the same (or more) number of data points. Does it assume that all those points are