I need to fill an nXn matrix with a Gaussian filter programatically. I’ve been trying to work this out for a graphics project, but i’m a little stuck.
To clarify, an example 3×3 Gaussian filter matrix would be:
[1, 2, 1]
[2, 4, 2] / 16.0
[1, 2, 1]
You just need a formula for a 2d gauss kernel and fill in your x and y values.
e.g. symmetric gauss kernel:
For an explanation with nice graphs see:
http://www.librow.com/articles/article-9
especially: 3. 2D case