# The Effect of the Finite Radius of Gaussian Kernel

Page 168 of Digital Image Processing, Global Edition says:

we know that the values of a Gaussian function at a distance larger than 3𝜎 from the mean are small enough that they can be ignored.

If we get the mean of Gaussian to be 0 and 𝜎 = 1, then It seems above says elements in kernel which their values are equal to $$\frac{1}{\sqrt{2\pi}} e^{-\frac{9}{2}}$$ or less than it, can be ignored. I calculated its value:

(1/sqrt(2*pi))*e^(-9/2)
ans = 4.4318e-03


Although it is a small number; but if we multiply it by 255 the result will be 1.1301 that will round to 1 and not to the 0. So the first question is: why we ignore elements which may affect on result, at least for white pixels?

Then the book continues and says:

This means that if we select the size of a Gaussian kernel to be ⎡6𝜎⎤ × ⎡6𝜎⎤ (...), we are assured of getting essentially the same result as if we had used an arbitrarily large Gaussian kernel.

Now another question rises: If 3𝜎 is enough for ignoring, why surely select ⎡6𝜎⎤ × ⎡6𝜎⎤ for size of kernel, and not ⎡3𝜎⎤ × ⎡3𝜎⎤ or ⎡4𝜎⎤ × ⎡4𝜎⎤?

If 3𝜎 is enough for ignoring, why surely select ⎡6𝜎⎤ × ⎡6𝜎⎤ for size of kernel, and not ⎡3𝜎⎤ × ⎡3𝜎⎤ or ⎡4𝜎⎤ × ⎡4𝜎⎤?

It is 3𝜎 on either side of the middle, so the total width of the kernel is 6𝜎. In the discrete case, where the center is on a pixel, and the kernel is symmetric around that middle pixel, we usually compute 2⎡3𝜎⎤+1 as the kernel size.

Although it is a small number; but if we multiply it by 255 the result will be 1.1301 that will round to 1 and not to the 0.

I don’t think this is a meaningful analysis. Instead, integrate the part of the Gaussian from -3𝜎 to 3𝜎, this gives 0.9973. This means that at most 0.27% of the Gaussian weight is missing. This is the error we make when we cut the kernel off at 3𝜎. If you limit yourself to 8-bit images, then 0.27% of the dynamic range is less than 1. But even with higher dynamic range, it is a relatively small error. For some applications this might not suffice, but for most applications it is fine.

• Thank you for answering to "why 6𝜎?" Jan 19 at 4:32

This is the balance between the accuracy the computation efficiency.

In theory the FIR representation of the Gaussian Blur filter is infinite (Please overlook the semantic contradiction).

We need make it finite with some approximation and the approximation is usually by defining the energy ratio to keep.

Look at the Gaussian distribution curve for 1D.
Within the range $$\left[ - \lceil 3 \sigma \rceil, \lceil 3 \sigma \rceil \right]$$ one can keep ~99% of the energy of the distribution. So this is usually the minimum used.

For higher quality people use $$\left[ - \lceil 4 \sigma \rceil, \lceil 4 \sigma \rceil \right]$$.

Pay attention that for small values of $$\sigma$$ it is better to use other methods than the direct FIR approximation as it won't yield accurate results.

See Parameters of Gaussian Kernel in the Context of Image Convolution for farther discussion.

The $$3\sigma$$ and $$6\sigma$$ are rules of thumb, which are commonly adopted because they are useful for a lot of different situations.

As @Royi mentions in their answer, this is the result of a tradeoff.

Ultimately, you need to understand what the needs of your application are, and choose your approximation accordingly. It may be that $$r = 3\sigma$$ is more than you need (and thus wasteful of processing power), it may be that $$r = 3\sigma$$ is woefully small.