开发者

Separable 2D Blur Kernel [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

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 someth开发者_JAVA技巧ing which doesn't require Trigonometric Functions (Else I would use some kind of "Windows" like Hann).

Thanks.


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.)


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜