# how to build a Gaussian mask?

Hi everybody,

I intend to do following but no idea has come across my mind yet.

c) control the transparency (alpha channel) of the mask in an arbitrary point of the mask according to a 2D Gaussian profile. That is, the alpha channel of the mask should smoothly go from min = 0 = fully transparent (in the center of the Gaussian) to max = 1 = fully opaque (outside the Gaussian).
e) once the punctured mask is built, apply it to the previously loaded image

The point is: I don’t know how to build 2D Gaussian mask, make it work on alpha channel and then how to apply it on the image.

Any idea?
Thanks a lot

Well a Gaussian bell in 3d is symmetric and therefore separable as a kernel so you only need to consider the 2d case. The curve goes as G(x) = exp(-s x) = 1 / exp(s x), so it has a max at G(0)=1 and a min at G(inf) = 0. Clearly infinity isn’t much use so you’d want to pick a value for s that brings it close to 0 for a given x. You could pick a small epsilon say to equate with G then take the log of both sides to find a reasonable s.