# If I want to apply a filter to an Image should I use the IIR or FIR filters?

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?

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.

• 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.
– Peter K.
Nov 1 '13 at 15:48
• @PeterK. Yes, hopefully this will elucidate the taxonomy somewhat so that it can help them massage the question. Nov 1 '13 at 15:53
• 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. Nov 1 '13 at 16:10
• @user1084113 See my edit. Nov 1 '13 at 16:40
• @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? Nov 1 '13 at 16:52