Determine Parameters of gaussian distribution to fit a certain Image-Filter I'd like to know what the parameters for the two-dimensional gaussian distributions are, which create this (I think) quite common image-processing filter:
$$
h_\sigma(x,y)=
\left[
\matrix
{
1&amp;2&amp;1\\
2&amp;4&amp;2\\
1&amp;2&amp;1    
}
\right]
$$
The two-dimensional gaussian equation looks like:
$h_\sigma(x,y)= A\cdot e^{-\frac{x^2+y^2}{2\sigma^2}}$, where $A = \frac{1}{{2\pi}\sigma^2}$, but I think $A$ is not important as it is only a factor, isn't it?

With $\sigma=1$ I get:
$$h_{\sigma=1}(x,y)=
\left[
\matrix
{
h(-1,-1)=0.3679&amp;h(0,-1)=0.6065&amp;h(1,-1)=0.3679\\
h(-1,0)=0.6065&amp;h(0,0)=1.0&amp;h(1,0)=0.6065\\
h(-1,1)=0.3679&amp;h(0,1)=0.6065&amp;h(1,1)=0.3679   
}
\right]
$$
As you see, I think the entries in the filter-matrix correspond to sampling values of the gaussian function from [-1|-1] to [1|1]. I hope that is at least right.

Multiplied $h_{\sigma=1}(x,y)$ with $4$, and then rounded gives me my desired filter, but I don't think that is the correct way, is it?

$$\mbox{round}(4\cdot h_{\sigma=1}(x,y))=
\mbox{round}(4\cdot
\left[
\matrix
{
0.3679&amp;0.6065&amp;0.3679\\
0.6065&amp;1.0&amp;0.6065\\
0.3679&amp;0.6065&amp;0.3679   
}
\right]
)=
$$
$$
h_{\sigma=1}(x,y)=
\mbox{round}(
\left[
\matrix
{
1.4716&amp;2.4260&amp;1.4716\\
2.4260&amp;4.0&amp;2.4260\\
1.4716&amp;2.4260&amp;1.4716
}
\right]
)=
$$
$$
\left[
\matrix
{
1&amp;2&amp;1\\
2&amp;4&amp;2\\
1&amp;2&amp;1    
}
\right]
=h_\sigma(x,y)
$$

There must be a better solution, or mathematical explanation for creating that matrix? I especially dislike the rounding operation, as the values are all close to $.5$ and not to $.0$ which should results in a huge error...

My question in other words: How do I determine the filter from scratch...
The filter you referenced is known as a Binomial filter. It is an approximation to a Gaussian, but for smaller filters it's a very crude one. The design is oriented more toward efficiency than accuracy. Rather than sampling a Gaussian directly, the idea behind the approximation is based on the Central Limit Theorem. In this case, it means that a small moving average filter $[ 1 \space  1 ]$ convolved with itself over and over will become more and more Gaussian. It also happens to yield the rows of Pascal's Triangle. The coefficients for larger filters are given by the following formula:

$$
{N \choose k} = \frac{N!}{(N - n)!\space N!}.
$$

For example, for $N = 5$, taking the outer product of the corresponding row of Pascal's triangle with itself yields

$$
\begin{bmatrix} 1 \\ 4 \\ 6 \\ 4 \\ 1 \end{bmatrix}\begin{bmatrix} 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \end{bmatrix} = 
\begin{bmatrix} 
1 &amp;   4 &amp;   6  &amp;  4  &amp;  1 \\
4 &amp;  16 &amp;  24 &amp;  16  &amp;  4 \\
6 &amp;  24 &amp;  36 &amp;  24  &amp;  6 \\
4 &amp;  16 &amp;  24 &amp;  16  &amp;  4 \\
1 &amp;   4 &amp;   6 &amp;   4  &amp;  1 
\end{bmatrix}.
$$

The paper I referenced in the first link has the following diagram which shows how the quality of the approximation increases with increasing filter order: