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, 2023 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.