If you code Computer Graphics stuff, or if you work in any field of science, then you are necessarily familiar with the Gaussian function (a.k.a. Normal distribution, Gaussian point-spread function, …).
The formulations below, where s=sigma is the standard deviation, assume that the mean m is 0:
The Gaussian function is commonly used as a convolution kernel in Digital Image Processing to blur an image. Computing a convolution is generally very slow, so choosing a convolution kernel that is as small as possible is always desirable.
The image below depicts a canonical Gaussian function where m=0 and s=1 in the range x=[-4..+4]. Changing the mean shifts the function to the left or right, and changing the standard deviation stretches or compresses the bell-shaped curve, but always leaving its surface (integral in [-INF..+INF]) unaffected and equal to 1.
The red, green, and blue regions are the intervals of radius sigma, 2·sigma, and 3·sigma around the mean. Interestingly, the red region comprises around 68% of the total integral of the Gaussian. The red+blue regions comprise around 95%, and the red+blue+green regions comprise more than 97% of the total.
(Wikipedia has a fantastic explanation of this in the Percentile page).
In other words, ignoring a Gaussian function beyond a radius of 3·sigma still leaves you with more than 97% of its total information.
In 2D, the Gaussian function can be described as the product of two perpendicular 1D Gaussians, and due to radial symmetry, the same principle applies:
This knowledge is very valuable when building a Gaussian-based blur convolution kernel.
As a summary:
Say that you intend to do a Gaussian blur of sigma=5 pixels. The optimal kernel dimensions would be [(15+1+15)x(15+1+15)] => [31×31].
The difference between using an infinite or a size-limited Gaussian kernel is negligible to the naked eye. The animated image below presents two Gaussian convolutions of the same sigma=5. One of them uses a kernel of radius 3·sigma=15, and the other one uses an infinite radius. As you can see, the difference can only be slightly noticed around areas of very high power. The base image used for this example intentionally features a very high dynamic range of approx. [0..625].
More on convolutions soon…