Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Box filter size in relation to Gaussian filter sigma

In order to evaluate the performance impact (both computational and quality-wise) of using a box filter / mean filter vs using a gaussian filter, I an wondering if there is a proper relationship between the size of the box filter and the sigma of a gaussian filter with "equivalent" smoothing.

To be more specific, I need to compare the difference between subsampling an image by a factor of two using a 2x2 box filter vs. using an eqivalent gaussian filter which would take into account more than 4 samples.

I have two ideas on how to approach this:

  • finding the equivalent sigma by minimizing the squared difference between the box function and the gaussian function
  • doing the same in fourier space (box filter would translate to a sinc filter)

Furthermore, I am not really sure how to incorporate the discretized space we are living here. Is the corresponding gaussian filter simply the one where the weights of the four nearest samples are closest to 1/4?

like image 830
Jack White Avatar asked Feb 08 '23 18:02

Jack White


1 Answers

The following paper by Peter Kovesi is a useful reference: http://www.peterkovesi.com/papers/FastGaussianSmoothing.pdf. I'll let you go through the mathematical derivations yourself, but essentially the relationship between the width of the average / box filter and the standard deviation of the Gaussian filter can be found by the following relationship:

enter image description here

This states that given a box / average filter of width w x w, the equivalent standard deviation to apply to achieve roughly the same effect when using a Gaussian blur can be found by the above mathematical relationship.

like image 136
rayryeng Avatar answered Feb 26 '23 08:02

rayryeng