|
-
Sep 4th, 2010, 03:18 PM
#1
Calculating a gaussian lookup table
I've been pondering on writing a relatively efficient drop shadow effect using a gaussian blur. I've pretty much everything nailed except the most important thing: the calculation of the gaussian lookup table itself.
I'm planning to use a very simple one dimensional table, starting from the furthest away value and then getting up to the peak value. I'll then apply the weighted average first in X dimension and then in Y dimension using this lookup table: I can only assume this will give good enough results for my needs vs. the speed I wish to have. I'm dealing with a single color so it shouldn't be that bad.
Anyway... the biggest problem is that I don't understand how to turn the mathematical function into a real function to fill the lookup table values. I've taken a look into Wikipedia, but all it gives is maths functions. For example, for a gaussian blur that will effect 9 pixels I need a lookup table with 5 values, I guess roughly 0.05, 0.09, 0.12, 0.15 and 0.18 – and calculating these dynamically goes over my head.
From Wikipedia's Gaussian blur article:

Yeah, I'm simply not compatible with that stuff. I guess I can understand it up to the pi.
I've tried to find a code example, but I've failed in it pretty badly. There is this gaussian blur example, but it isn't actually gaussian because the average it uses isn't weighted: every pixel is equal!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|