# What is an arithmetic mean filter?

Defined as:

$$\hat{f}(x,y)=\frac{1}{mn}\sum_{(s,t)\in S_{xy}}g(s,t)$$

As far as I understand:

• $g(x, y)$ is the original image
• $g(s, t)$ is a sub-image of $g(x, y)$ with a dimension of mxn
• $\hat f(x, y)$ is the filtered image
• Sub-images are summed up and then multiplied by ${ \frac {1}{mn}}$.

Am I correct?

If yes, then, I have several questions:

• Is $g(s,t)$ a pixel in the neighborhood? What does it mean by that?
• What is $S_{xy}$ ?
• What are the meanings of $s$ and $t$?
• What is the meaning of $(s,t) \in S_{xy}$?

## 3 Answers

In one picture: here, the mask is of size $m=3\times n=5$, filled with value $\frac{1}{3\times 5}$, the light gray shadow on the input image defines the neighborhood of the dark gray pixel: a set of pixels (all your $g(s,t)$) close to the center one (it moves with the pixel). Let us suppose the dark gray pixel has coordinates $x=5$ and $y=6$. The shadow defines $S_{5,6}$ having $s\in[5-(m-1),\dots,5+(m-1)]$ and $t\in[6-(n-1),\dots,6+(n-1)]$. $(s,t)\in S_{5,6}$ means for instance that the light gray pixel on the bottom left of the dark gray one, with coordinates $(6,5)$ belongs to the shadow.

I guess from pure logic, filter naming and its definition claimed to be average that

1. Is $g(s,t)$ a pixel in the neighborhood? What does it mean by that? I do not know what is a pixel neighbourhood but it is just a value, the height you have in the point $(s,t)$. $g(s,t)$ is an invocation of a function that will give you a value (numeric one, I guess, to be summable).

2. What is $S_{xy}$ ? I guess it is what called support. It is the place where your function is defined or non-zero because it makes no sense to sum up the infinite number of places where height is zero because it adds up noting to your sum but just makes your average 0 if you divide by infinity. In simplest case, you have one-dimensional array and one-dimensional support. In the case of average filter, it plays a role of sliding window, supposedly.

3. What are the meanings of $s$ and $t$? These are just loop variables. You iterate over the space and the point in that space is controlled by s and t. In the case of one-dimensional array, support will have only one index variable.

4. What is the meaning of $(s,t) \in S_{xy}$? It means that if your array is int[10], it is defined on the range 0..9 and you cannot index (variable) to transcend this range. Your function will $g(s,t)$ fail or you will sum a wrong number of samples because I expect that sxt spans a rectangular area of size MxN and adding points outside this range to your sum will invalidate your average.

Yes, you are correct. By dividing the sum of pixels of the sub-image by 1/mn, you compute the average of the sub-image. Then it's an average filter.

So it is in fact a convolution filter with a kernel having the same weight 1/mn.