A 3x3 Gaussian kernel is usually shown as
$$\frac{1}{16} \begin{bmatrix}1 & 2 & 1\\ 2 & 4 & 2\\ 1 & 2 & 1\end{bmatrix}$$
But where does that actually come from?
A 3x3 Gaussian kernel is usually shown as
$$\frac{1}{16} \begin{bmatrix}1 & 2 & 1\\ 2 & 4 & 2\\ 1 & 2 & 1\end{bmatrix}$$
But where does that actually come from?
Copyright © 2021 JogjaFile Inc.
This is actually an approximation from pascal's triangle.
For a 3x3 kernel, you need to take the the third row of this triangle and create this operation:
$$\frac{1}{4} \begin{bmatrix}1\\ 2\\ 1\end{bmatrix} \circ \frac{1}{4} \begin{bmatrix}1 & 2 & 1\\ 1 & 2 & 1\\ 1 & 2 & 1\end{bmatrix} = \frac{1}{16} \begin{bmatrix}1 & 2 & 1\\ 2 & 4 & 2\\ 1 & 2 & 1\end{bmatrix}$$
The value of $\frac{1}{4}$ is actually just one over the sum of the pascal row.
This approximation can apply to any $n * n$ kernel, and will give a discretized and normalized matrix.