# 1D Gaussian Kernel

This topic is 2571 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

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013654
×