Let's say I have an image that is 512 x 512 pixels. I've been tasked with creating two ideal half-band low-pass filters that will filter the image. The first filter is 8 x 8, and the second one is 16 x 16.

Each filter will represent the same frequency range (0 to Nyquist) and possess the same shape (half-band ideal filter). The bigger filter will feature better frequency resolution resulting in improved roll-off at the cut-off frequency.

However, let's say I wanted to do the filtering in the Fourier domain. How would multiplication work if the filters and images are different sizes?

It seems like the answer is to increase the size of the filter. Two options come to mind:

  • Zero pad the filter's fourier domain. However, this would result in shifting the cut-off frequency such that is no longer a half-band filter.
  • Interpolate the filter fourier domain. Essentially stretch out the pass-region by adding more "ones" to alter the frequency resolution. However, this would seem to alter the roll-off of the filter. Essentially the 8x8 and 16x16 filters would become the same.

So how exactly should multiplication occur if the filters don't match the input size? It seems like there are flaws in both zero padding and interpolation.

  • 2
    $\begingroup$ Does this answer your question? Implementing Convolution in Frequency Domain? $\endgroup$ Feb 7 at 20:58
  • $\begingroup$ Fat32's answer addresses the sizes. $\endgroup$ Feb 7 at 20:58
  • $\begingroup$ Pretty sure that you're going to want to zero pad the 2D filter in the spacial domain before applying the FFT to it. Also you would want to pad to more than 512 points so that you don't get aliasing. $\endgroup$
    – IanJ
    Feb 7 at 23:03
  • $\begingroup$ @MarcusMüller Fat32's answer seems a little convoluted. Hotpaw's seems pretty easy to understand if correct. $\endgroup$
    – Izzo
    Feb 8 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.