So, according to this article.
For a 2D mean filter,
$$ H[f(x,y)]=\frac{1}{NM}\sum_{k=0}^{N-1}\sum_{p=0}^{M-1}f(x-k,y-p)=g(x,y)\tag{1} $$ $$ g(x+x_0,y+y_0)=\frac{1}{NM}\sum_{k=0}^{N-1}\sum_{p=0}^{M-1}f(x+x_0-k,y+y_0-p)\tag{2} $$ $$ H[f(x+x_0,y+y_0)]=\frac{1}{NM}\sum_{k=0}^{N-1}\sum_{p=0}^{M-1}f(x+x_0-k,y+y_0-p)\tag{3} $$ because (2) equals to (3), a 2D mean filter is shift-invariant.
Is the proof right?

BTW, if f(x,y) is a 2D image, such as

1 2 1
2 3 2
1 2 1

and g(x,y) is (using zero padding)

 8/9 11/9  8/9
11/9 15/9 11/9
 8/9 11/9  8/9

What does these $$ H[f(x+x_0,y+y_0)]\tag{4} $$ and $$ g(x+x_0,y+y_0)\tag{5} $$ mean? (I want to prove it by using a image.)

I read this article and this Wikipedia page.
However, I still don't know what it means for (or how to apply to) a mean filter.
Can anyone give me an image example?
(for example, https://dsp.stackexchange.com/a/14435 is easier to understand)


3 Answers 3


The 1D mean filter defined by the following I/O relation is time/shift invariant;

$$y[n] = T\{x[n]\} = \frac{1}{d_1 + d_2 + 1} \sum_{k=n-d_1}^{n+d_2}{x[k]}$$

For $d_1$ and $d_2$ being positive integers, the filter computes the mean (or the average) of its input $x[n]$ in the range of its summation index. To show that it is shift invariant we shall simply show the truth of the following statement: $y[n-d] = T\{x[n-d]\}$ for and $d$ and any input $x[n]$

$$ y[n-d] = \frac{1}{d_1 + d_2 + 1} \sum_{k=n-d-d_1}^{n-d+d_2}{x[k]} ~~~\overset{?}{=}~~~ T\{x[n-d]\} = \frac{1}{d_1 + d_2 + 1} \sum_{k=n-d_1}^{n+d_2}{x[k-d]}$$

Which is easily shown to be true by making the simple change of variable in the second sum as $k-d=k'$ and then optionally replacing $k'$ with $k$ again: \begin{align} T\{x[n-d]\} &= \frac{1}{d_1 + d_2 + 1} \sum_{k=n-d_1}^{n+d_2}{x[k-d]} ~~~~ &\scriptstyle{\text{replace k-d with k'}}\\ T\{x[n-d]\} &= \frac{1}{d_1 + d_2 + 1} \sum_{k'=n-d-d_1}^{n-d+d_2}{x[k']} &\scriptstyle{\text{replace k' with k again}}\\ T\{x[n-d]\} &= \frac{1}{d_1 + d_2 + 1} \sum_{k=n-d-d_1}^{n-d+d_2}{x[k]} &\scriptstyle{\text{recognise that this is = y[n-d]}}\\ T\{x[n-d]\} &= y[n-d] &\scriptstyle{\text{Hence the given System is LTI}}\\ \end{align}

This is extended to 2D in a straight-forward manner


Suppose your mean filter is: $$ y[n] = \frac{1}{N} \sum_{k=0}^{N-1} x[n-k] \tag{1} $$ then shift invariance means that if an input $x_1[n]$ generates $y_1[n]$ then an input $x_2[n] = x_1[n-n_0]$ results in $y_2[n] = y_1[n - n_0]$

For an 2D mean filter, $$ y[n,m] = \frac{1}{NM} \sum_{k=0}^{N-1} \sum_{p=0}^{M-1} x[n-k, m-p] \tag{2} $$ then shift invariance means that if an input $x_1[n, m]$ generates $y_1[n, m]$ then an input $x_2[n, m] = x_1[n-n_0, m-m_0]$ results in $y_2[n, m] = y_1[n - n_0, m - m_0]$

What part is unclear? All you have to do is apply the definition to the formulae (1) or (2) and see if the conditions are true.


At the risk of sounding picky, I would say that:

  • the mean filter, seen as a system, is shift-invariant (or translation-invariant),
  • the mean operation is shift equi-variant (its results moves equally with the shift)

The difference between the two ideas is explained at Difference between “equivariant to translation” and “invariant to translation”.

Here, as a system, you are concerned with the following: if the input is delayed, is the result delayed as well? In other words: if you combine temporal values in a mean today, or next year, will it yield the same result (time-invariance)? If you combine spatial values in a mean here, or a few meters away, will it yield the same result (space-invariance)?

The mean filter works this way. To DSP engineers, it is called shift-invariant.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.