Apply Gaussian Blur on images.
The formula for Gaussian blur is:
G(x, y) = (Math.E
^ (-(x^2 + y^2) / (2 * SIGMA^2))) / sqrt(2 * Math.PI
* SIGMA^2))
Where
SIGMA
is the standard deviation,
x
and
y
represent the distance from the horizontal and vertical axis respectively.
In this implementation
SIGMA
is always 1/3 of the radius of the
applied filter.
Since the Gaussian filter is separable, meaning that can be applied to a
two-dimensional image as two independent one-dimensional calculations,
so this filter will first create a
Kernel
for the horizontal
direction and then a second
Kernel
for the vertical one.