Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Gaussian filter confusion


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 lipsryme   Members   -  Reputation: 1031

Like
0Likes
Like

Posted 30 August 2013 - 01:32 PM

I'm a little confused about the gaussian filter function which can be found on several sources.

What's confusing to me is that I've found at least 3 different equations for the same thing...

I've marked the differences in red color.

 

Wikipedia lists it as: (http://en.wikipedia.org/wiki/Gaussian_filter)

 

g(x) = (1 / (sqrt(2 * PI) * rho)) * exp(-(x*x) / (2 * (rho * rho)))

 

While the one found in Real-Time-Rendering, Third Edition defines it as:

 

g(x) = (1 / (sqrt(2 * PI) * rho * rho)) * exp(-(x*x) / (2 * (rho * rho)))

 

And finally the code that I've got from one of MJP's samples:

 

g(x) = (1 / (sqrt(2 * PI * rho * rho))) * exp(-(x*x) / (2 * (rho * rho)))

 

 

What am I missing here ?


Edited by lipsryme, 30 August 2013 - 02:24 PM.


Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 8429

Like
1Likes
Like

Posted 30 August 2013 - 01:55 PM

Assuming that you meant to divide by rho instead of multiplying by rho at all places, as indicated by the Wikipedia link, the first and third are identical, and the second is different only by a scale factor. I'd say the first and third ones are the "correct" ones as they have unit scaling, but if you disregard the scaling then the second one is no less correct than the other two.



#3 lipsryme   Members   -  Reputation: 1031

Like
0Likes
Like

Posted 30 August 2013 - 02:03 PM

Not sure what you mean by "Assuming that you meant to divide by rho instead of multiplying by rho at all places". What scaling are you talking about ?

 

RTR defines it as: http://d.pr/i/3Dsg

 

Where is this squared rho coming from ?


Edited by lipsryme, 30 August 2013 - 02:06 PM.


#4 David Neubelt   Members   -  Reputation: 794

Like
0Likes
Like

Posted 30 August 2013 - 02:11 PM

Hmm, I'd imagine the RTR is a typo because typically you don't want to scale and you want to be normalized to 1 when you integrate over the domain -\inf to \inf. That's what the term out in the front is for. I don't have the book on me at the moment to see in context what they are talking about.

 

-= Dave


Graphics Programmer - Ready At Dawn Studios

#5 Brother Bob   Moderators   -  Reputation: 8429

Like
0Likes
Like

Posted 30 August 2013 - 02:19 PM

The σ symbol in that equation is sigma, not rho, but never mind that. If you look at the equation, σ2 is in the denominator so you need to divide by σ, not multiply by σ (or rho; ρ) as you have in your original posts. Basically, your original post stated 1/sqrt(2π)*σ, where the correct equation in 1/(sqrt(2π)*σ). Likewise in the exponent, the correct equation is exp(-x*x/(2*σ*σ)). Note the parentheses to get the factors, dividends and the divisors correct.

 

Scaling refers to the linear scaling perform by the filter. If the filter has a scaling by for example 2, it means that the values of the signal is filtered but also scaled by 2 in amplitude. Your first and third equations does not have any additional scaling as the second equation has. Your second filter is scaled by 1/σ, which means that if σ=0.25, then the filtered signal is four times larger than the input signal apart from the actual filtering.


#6 lipsryme   Members   -  Reputation: 1031

Like
0Likes
Like

Posted 30 August 2013 - 02:23 PM

Ah yes sorry I keep confusing these symbols names smile.png  (maybe I should just call it the standard deviation rolleyes.gif ) and yes it seems I've made some mistakes in the parentheses (fixed it now) but that scaling factor is basically what I'm confused about the reason why it's in there.


Edited by lipsryme, 30 August 2013 - 02:26 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS