Gauss filter is a famous image denoising tool in image processing domain. I saw lots of opensource software choose the template like this:
Where do these value come from?
Gauss filter is a famous image denoising tool in image processing domain. I saw lots of opensource software choose the template like this:
Where do these value come from?
You linked the Answer yourself. These values are a discrete representation of the Gaussian Function.
The 2D Gaussian looks like this:
To get the Filter Values you evaluate the 2D-Gaussian Function at the discrete x-y Position corresponding to your Kernel Size and sigma.
On this website you can find a detailed explanation of the Gaussian Filter.
That is an approximation of a Gaussian filter called Binomial Filter. You can see the difference here: http://www.cse.yorku.ca/~kosta/CompVis_Notes/binomial_filters.pdf.old
If you want to get a discrete Gaussian filter you can see this video https://www.youtube.com/watch?v=3z3GDUFR4Lw
So, for example, if you want a Gaussian filter 3x3 with standard deviation σ = 1.
From 2D Gaussian:
If matrix dimension is 3x3 (nxn), then the coefficient k is 1, (because the gaussian function goes -k,..., 0, ..., k, in this case: -1, 0, 1, and that's why the dimension is 3)
So, you have to calculate the matrix like this:
The solution will be:
Note that there's no even dimension since the matrix dimension is depending on n = 2k+1, which refer to odd numbers.