1D Gaussian Kernel

This topic is 2872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi guys,

I found a few different formulas for the 1D Gaussian blur kernel and I'm not sure if mine is correct:

float g=1.0f/(sqrtf(2.0f*pi)*sigma)*exp(-(x*x)/(2.0f*sigma*sigma));

Also, for a 5 tap filter do I simply use (-2.0f,-1.0f,0.0f,1.0f,2.0f) for the x-values ?

Thanks.

Share on other sites
What you have there is the gaussian probability density function, centered (median) at x=0, which should work fine for calculating a filter kernel.

Share on other sites
Hidden
The one on wikipedia is this:

float g=1.0f/(sqrtf(2.0f*pi*sigma*sigma))*exp(-(x*x)/(2.0f*sigma*sigma));

...the difference is in the sqrt()

Which one should I use for my Gaussian blur kernel ? Is the difference a typo or are they both correct ?

Thanks

• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 30
• 9
• 16
• 12