# Why is a circular mask appropriate for Fourier filtering rectangular images?

Suppose I apply 2D DFT to an image with dimensions $$H{\times}W$$ where $$H \neq W$$, then shift the DC component to the center. Why does a circular mask capture the lowest frequency components, i.e. why is it not an ellipse given that the image is rectangular? My concern is that for rectangular images, the K lowest frequencies might be arranged in a non-circular pattern.

• Why shouldn't it? I honestly don't understand where your question is coming from, so maybe explaining the reason why you're asking this would help us point you in the right direction. – Marcus Müller Oct 11 at 16:05
• my concern was that for rectangular images, the K lowest frequencies might be arranged in a non-circular pattern, but this is mostly based on my poor understanding of what the shifting actually does. I'm looking into it now while awaiting responses here – tmakino Oct 11 at 18:12
• ah, that would actually make a very good edit to your question (so that people don't have to read our comments to make out what your concern is)! Question from my side: If you have a pattern of frequency $F_\text{diag}$ in the image that lies diagonal, what is its frequency in H- and W-direction? – Marcus Müller Oct 11 at 18:38

For simplicity, let's not do any shifting and only consider non-negative frequencies.

Let's assume that the horizontal and vertical image dimensions are even integers $$W$$ and $$H$$. Looking at the output of a $$H\times W$$ 2-d DFT of the image, the $$u$$th column with $$u\le W/2$$ represents a horizontal frequency of $$u/W$$ times the horizontal sampling frequency and the $$v$$th row with $$v\le H/2$$ represents a vertical frequency of $$v/H$$ times the vertical sampling frequency. For a square image grid the horizontal and vertical sampling frequencies are equal and in the following denoted by a single variable $$f_s$$. The frequency-magnitude of a 2-d frequency at bin $$u, v$$ will then be $$\sqrt{(u/W)^2 + (v/H)^2}f_s$$.

For a cut-off frequency $$\omega_c$$ your mask would select frequencies:

$$\sqrt{\left(\frac{u}{W}\right)^2 + \left(\frac{v}{H}\right)^2}f_s < \omega_c\tag{1}$$ $$\Rightarrow\frac{f_s^2}{W^2\omega_c^2}u^2 + \frac{f_s^2}{H^2\omega_c^2}v^2 < 1.\tag{2}$$

That indeed defines an ellipse in coordinates $$u, v$$.

However, if you consider the actual frequencies $$\frac{u}{W}f_s$$, $$\frac{v}{H}f_s$$ as coordinates, then what you have is a circle:

$$\text{Eq. 1}$$ $$\Rightarrow\frac{1}{\omega_c^2}\left(\frac{u}{W}f_s\right)^2 + \frac{1}{\omega_c^2}\left(\frac{v}{H}f_s\right)^2 < 1.\tag{3}$$

To summarize, it depends on how you express your frequencies.

In one dimension, there is one natural way to arrange frequencies. A filter can be devised, to reduce frequencies $$\omega \le \omega_c$$. In 2D, there are many ways. Indeed, it depends a lot on the information content in each pixel. For instance: are the width and the height of each pixel comparable? What relative weights ($$w_h$$, $$w_v$$) should we give to horizontal or vertical frequencies, to create a global "2D" frequency? One shall remind that, for the human visual system, vertical frequencies are better detected than horizontal frequencies. In image processing, it is common to combine frequencies under $$\ell_p$$ quasinorms or norms: $$(w_h\omega_h^p+w_v\omega_v^p )^{1/p}\le \omega_c$$

For $$p=2$$, you get an ellipse (or circular way). With $$p=1$$, axes are weighted along diagonals. When $$p$$ is large, only the maximum matters.