1

We all know the separability property of a Gaussian Kernel. Are there any other Separable Blur Kernel which are common?

I'm looking for a kernel which decreases almost as fast as Gaussian Blur.

I can't use Gaussian Blur for various reasons. I would prefer something which doesn't require Trigonometric Functions (Else I would use some kind of "Windows" like Hann).

Thanks.

1
  • It's not clear that you are looking for - why doesn't a Gaussian work for you ? You do know that you can vary sigma in a Gaussian filter, to change the overall size of the kernel, right ?
    – Paul R
    Jan 14, 2011 at 12:06

4 Answers 4

4

From the comments to an earlier answer it sounds like you're working with the mistaken assumption that calculating the gaussian filter coefficients accounts for a significant part of the cost applying a gaussian filter. This is certainly not the case. The compute-intensive part is convolving the coefficients with the image. The cost of this is the same for any given NxN filter, regardless of how the coefficients are calculate.

Pseudo code for applying Gaussian (or any separable filter):

  • calculate 1D Gaussian (or other separable filter) coefficients
  • for each row
    • for each col
      • apply 1D coefficients in horizontal axis
  • for each row
    • for each col
      • apply 1D coefficients in vertical axis

(Note: in the above discussion I'm assuming a symmetrical (NxN) filter.)

2
  • I know that, believe me. I really want an alternative to Gaussian Blur. This is a must.
    – Royi
    Jan 14, 2011 at 14:25
  • 3
    @Drazick: but why ? You say it's for efficiency, yet I've just explained why it makes no difference if you switch to a different filter. Is there some other reason that you haven't mentioned ???
    – Paul R
    Jan 14, 2011 at 14:32
3

If you want the effect of a Gaussian blur without the cost, do a box blur multiple times. An infinite number of passes will replicate a Gaussian, but it only takes ~3 to be good enough to fool the eye.

If you implement the box blur by doing horizontal and vertical strips seperately, an extremely fast implementation is just to scan each strip of pixels and maintain a running total, adding the pixel radius/2 in front while subtracting the pixel radius/2 pixels behind and multiply by cached 1/radius to calculate the running average.

The great thing about this is that the radius of the blur has negligable effect on how long it takes to calculate.

1
  • That is a moving sum (or average, if normalized).
    – mlepage
    Jun 26, 2015 at 18:49
0

Box filters are separable and quite common. But I really don't know what kind of filters you're looking for - for example, should it be rotational symmetric? If not, any convolution of a row- and column-blur filter is a separable blue filter.

12
  • It should have effect as close as possible to the Gaussian Blur. Circular Symmetric is welcome. Thanks.
    – Royi
    Jan 14, 2011 at 12:21
  • 2
    "As close as possible to gaussian blur" - what's wrong with using gaussian blur then?
    – Niki
    Jan 14, 2011 at 12:24
  • I want something easier to calculate. Better performance.
    – Royi
    Jan 14, 2011 at 12:32
  • 3
    @Drazick: you only need to calculate the coefficients once. The cost of doing this is negligible. The compute-intensive part is applying those coefficients to the image. This will be the same (for a given kernel size) regardless of what type of filter you apply. Just use Gaussian and pre-compute the coefficients.
    – Paul R
    Jan 14, 2011 at 13:46
  • 2
    The only reason not to use Gaussian but "As close as possible to Gaussian blur" can be that this is some sort of homework that require to use something other then Gaussian.
    – Ross
    Jan 15, 2011 at 8:03
-2

One could use the known windows which are classic in 1D Signal Processing:
http://en.wikipedia.org/wiki/Window_function

A 2d Kernel could be created using Outer product.
Implementation should be as in any separable filter.

Not the answer you're looking for? Browse other questions tagged or ask your own question.