Jump to content
  • Advertisement
Sign in to follow this  
ocase

mean and variance of a gaussian filter mask

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have a 3 x 3 gaussian filter mask: 1 2 1 2 4 2 1 2 1 does anyone know how to calculate mean and variance of this mask ? thanks, markus

Share this post


Link to post
Share on other sites
Advertisement
Maybe I'm wrong, but it is a 2d discrete function, so the mean is:


double mean,s=0;
int x,y;
for (x=0;x<3;x++)
for (y=0;y<3;y++)
s+=filter[x][y];
mean=s/9.0;



Variance is:

double v,s=0;
int x,y;
for (x=0;x<3;x++)
for (y=0;y<3;y++)
{
double diff=(filter[x][y]-mean);
s+=diff*diff;
}
}
v=s/9.0;



Hope this is right and helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!