147
edits
Changes
→The parameters to a Gaussian blur are:
There are a couple ways to calculate a Gaussian kernel.
A better way is to use the Gaussian function which is this: e<sup>-x<sup>2</sup>/(2 * σ<sup>2</sup>)</sup>
Where the sigma is your blur amount and x ranges across your values from the negative to the positive. For instance , if your kernel was 5 values, it would range from -2 to +2.
An even better way would be to integrate the Gaussian function instead of just taking point samples. Refer to the diagram on the right.<br/>
Below you can find a plot of the continuous distribution function and the discrete kernel approximation. One thing to look out for are the tails of the distribution vs. kernel support:<br/>
For the current configuration , we have 13.36% of the curve’s area outside the discrete kernel. Note that the weights are renormalized such that the sum of all weights is one. Or in other words:<br/>
the probability mass outside the discrete kernel is redistributed evenly to all pixels within the kernel. The weights are calculated by numerical integration of the continuous gaussian distribution<br/>
over each discrete kernel tap. Take a look at the java script source in case you are interested.
Whatever way you do it, make sure and normalize the result so that the weights add up to 1. This makes sure that your blurring doesn’t make the image get brighter (greater than 1) or dimmer (less than 1).