skm
skm

Reputation: 5659

Effect of variance (sigma) at Gaussian smoothing

I know about Gaussian, variance, and image blurring, and I think that I understood the concept of variance at Gaussian blur, but still I am not 100% sure.

I just want to know the role of sigma or variance in Gaussian smoothing. I mean, what happens by increasing the value of sigma for the same window size, and why does it happen?

It would be really helpful if somebody provide some nice literature about it. (I already tried few but couldn't find what i am looking for)

Major confusion:

Higher frequency -> details (e.g. noise),

Lower Frequency -> kind of overview of the image.

By increasing the sigma, we are allowing some higher frequencies, so we should get more detailed with increasing frequency. But the case is opposite! When we increase the sigma, the image becomes more blurry.

Upvotes: 19

Views: 49801

Answers (3)

Wang
Wang

Reputation: 8183

Usually we name the filter with the spatial response function. So the Gaussian filter means the spatial response is a Gaussian function.

However, the frequency response of GF is still Gaussian function with the relationship of sigma_f = 1/(2*pi*sigma_spatial)

Thus, the smaller the sigma_f the narrower the passband (the lower the cutoff frequency).

The sigma value in OpenCV is the spatial sigma used to generate the Gaussian kernel. Thus it has the inverted relationship with the passband.

The higher the sigma_spatial the lower the cutoff frequency.

We can also directly view this in spatial operation perspective. We can treat the spatial filter as weighted average. The GF give the centre pixel more weight than the edge. The higher the sigma_spatial the wider the Gaussian, then the higher the weights on the edge. Thus the higher the sigma_spatial more detail get lost during the average.

People usually attempt to choose sigma for digital GF. However, for optimal effect, the sigma and the kernel size are not freely choosable. They actually depend on each other.

For quality, we do not want the kernel size to be too small. We would like the filter value at the kernel edge to be very close to 0, otherwise, there is much part of the bell shape is not in use.

For efficiency, we do not want the kernel size to be too big. If the kernel size is too big for chosen sigma, then most part of the kernel has filter parameters close to 0.

If we review the Gaussian function, we knew that if we choose a kernel size of 6*sigma, and the parameter at the centre is 1.0; then the value at the edge will be around 0.01

So in practice, usually, we do not specify the sigma at all. We normally just specify the kernel size and automatically get sigma = size/6

Upvotes: 1

DanGoodrick
DanGoodrick

Reputation: 3198

Put simply, increasing the sigma terms will cast a broader net over the neighboring pixels and decrease the impact of the pixels nearest the pixel of interest, e.g. it makes a blurrier image.

enter image description here

Upvotes: 8

Hadi
Hadi

Reputation: 5598

I think it should be done in the following steps, first from the signal processing point of view:

  1. Gaussian Filter is a low pass filter. Low pass filters as their names imply pass low frequencies - keeping low frequencies. So when we look at the image in the frequency domain the highest frequencies happen in the edges(places that there is a high change in intensity and each intensity value corresponds to a specific visible frequency).
  2. The role of sigma in the Gaussian filter is to control the variation around its mean value. So as the Sigma becomes larger the more variance allowed around mean and as the Sigma becomes smaller the less variance allowed around mean.
  3. Filtering in the spatial domain is done through convolution. it simply means that we apply a kernel on every pixel in the image. The law exists for kernels. Their sum has to be zero.

Now putting all together! When we apply a Gaussian filter to an image, we are doing a low pass filtering. But as you know this happen in the discrete domain(image pixels). So we have to quantize our Gaussian filter in order to make a Gaussian kernel. In the quantization step, as the Gaussian filter(GF) has a small sigma it has the steepest pick. So the more weights will be focused in the center and the less around it.

In the sense of natural image statistics! The scientists in this field of studies showed that our vision system is a kind of Gaussian filter in the responses to the images. see for example take a look at a broad scene! don't pay attention to a specific point! so you see a broad scene with lots things in it. but the details are not clear! Now see a specific point in that seen. you see more details that previously you didn't. This is the Sigma appear here. when you increase the sigma you are looking to the broad scene without paying attention to the details exits. and when you decrease the value you will get more details.

I think Wikipedia can help more than me, Low Pass Filters, Guassian Blur

Upvotes: 28

Related Questions