4
votes

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?

1
This paper by Peter Kovesi may be useful. It shows how to approximate blurring with a Gaussian using a series of box filters. There are also some mathematical relationships derived that relate between the size of a box filter with the corresponding sigma for the Gaussian: peterkovesi.com/papers/FastGaussianSmoothing.pdfrayryeng
Thank you, this is exactly what I was looking for. If you take the time to formulate an answer I will gladly accept it. Basically equation (1) from the paper was all I needed.Jack White
I certainly will formulate one. Thanks!rayryeng

1 Answers

7
votes

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.