How to remove repititve pattern from an image using FFT

Here is a simple and effective linear filtering strategy to remove the horizontal line artifact: Outline: Estimate the frequency of the distortion by looking for a peak in the image’s power spectrum in the vertical dimension. The function scipy.signal.welch is useful for this. Design two filters: a highpass filter with cutoff just below the distortion … Read more

DSP – Filtering in the frequency domain via FFT

There are two issues: the way you use the FFT, and the particular filter. Filtering is traditionally implemented as convolution in the time domain. You’re right that multiplying the spectra of the input and filter signals is equivalent. However, when you use the Discrete Fourier Transform (DFT) (implemented with a Fast Fourier Transform algorithm for … Read more

Calculate autocorrelation using FFT in Matlab

Just like you stated, take the fft and multiply pointwise by its complex conjugate, then use the inverse fft (or in the case of cross-correlation of two signals: Corr(x,y) <=> FFT(x)FFT(y)*) x = rand(100,1); len = length(x); %# autocorrelation nfft = 2^nextpow2(2*len-1); r = ifft( fft(x,nfft) .* conj(fft(x,nfft)) ); %# rearrange and keep values corresponding … Read more

FFT for Spectrograms in Python

Python’s wave library will let you import the audio. After that, you can use numpy to take an FFT of the audio. Then, matplotlib makes very nice charts and graphs – absolutely comparable to MATLAB. It’s old as dirt, but this article would probably get you started on almost exactly the problem you’re describing (article … Read more

How to multiply two 2D RFFT arrays (FFTPACK) to be compatible with NumPy’s FFT?

Correct functions: import numpy as np from scipy import fftpack as scipy_fftpack from scipy import fft as scipy # FFTPACK RFFT 2D def fftpack_rfft2d(matrix): fftRows = scipy_fftpack.fft(matrix, axis=1) fftCols = scipy_fftpack.fft(fftRows, axis=0) return fftCols # FFTPACK IRFFT 2D def fftpack_irfft2d(matrix): ifftRows = scipy_fftpack.ifft(matrix, axis=1) ifftCols = scipy_fftpack.ifft(ifftRows, axis=0) return ifftCols.real You calculated the 2D FFT … Read more