So I have discrete pixel values in the image and each row or column would make a signal. I would like to filter some of the rows or columns to remove high frequency components from them. Should I use the Z transform (difference equations) or work with the FFT of the data to perform the filtering?
1 Answer
Some important vocabulary first to get the terminology right:
- DFT - Discrete Fourier Transform. This is a transform. It is quite computationally intensive. ($O(N^2)$).
- FFT - This is an algorithm that makes computing the DFT very fast. ($O(N \log N)$)
- Z-transform: This is just a mathematical generalization of the DTFT - it is not an algorithm. When $z = e^{jw}$, then we have the DTFT. Moreover, the DFT is a (uniform) sampling of the DTFT.
So from a practitioner's standpoint, what you will use in your filtering technique is the FFT - at least with a lot of classical techniques. This is because as stated above, the FFT is an algorithm.
In relation to implementing actual difference equation VS doing your filtering via FFT: Most of the time, implementing a convolution is done via the FFT, because of the computational simplicity. There is a point however at which it becomes most efficient to perform a convolution directly, but that is only if your image/signal sizes/lengths are really small.
-
$\begingroup$ Yes, the OP seems confused. I think what they are asking is whether they should implement filtering using the FFT or just do the time-domain implementation of the linear, constant-coefficient difference equation. $\endgroup$– Peter K. ♦Nov 1, 2013 at 15:48
-
1$\begingroup$ @PeterK. Yes, hopefully this will elucidate the taxonomy somewhat so that it can help them massage the question. $\endgroup$ Nov 1, 2013 at 15:53
-
$\begingroup$ Right sorry, @PeterK. is correct I wanted to ask is it better if I use difference equations to do the filtering or perform some manual multiplicative filtering on the FFTed data. $\endgroup$ Nov 1, 2013 at 16:10
-
-
$\begingroup$ @user4619 I'm sorry I should be more clear, performance is not an issue, say if I was to implement a second order high pass filter through difference equations (bilinear transform of H(z) then use the digital biquad generalization to get y[n]) VS FFT the data and window past a certain frequency (retain all values above a certain frequency and make the rest zero) which of the two approaches would yield better results? $\endgroup$ Nov 1, 2013 at 16:52