Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"03-31-11 - Some image filter notes"

3 Comments -

1 – 3 of 3
Blogger ryg said...

"But then I realized - these are not really proper Gaussians. These are discrete samples of Gaussians. If you like, it's a Gaussian convolved with a comb filter."
This is if you use a sampled Gaussian as your filter. There's an alternative approach - the basic idea is that convolution with a Gaussian is the solution to a simple continuous uniform linear diffusion equation (at a time proportional to the desired variance). You can then consider that same diffusion problem on a discrete space (i.e. grid) and use the solutions as your discrete Gaussian approximation.

The 1D kernel coefficients are given by

K[sigma](n) = exp(-sigma) * I_n(sigma)

where I_n is the modified Bessel function of order n. For 2D you just do the usual separable filtering thing; the resulting kernel doesn't have perfect rotational symmetry, but it does have the convolution theorem: K[sigma1] * K[sigma2] = K[sigma1+sigma2].

There's a nice introduction on Wikipedia, and the original paper by Lindeberg is available online.

April 1, 2011 at 2:35 PM

Blogger castano said...

> what you really should be doing is applying the filter only where its domain overlaps the image domain.

Interesting... and if you are using a polyphase filter (case 2 below) you are probably precomputing the kernel weights for each column, so you can normalize the edge case in advance and it comes out for free.

I still think that wrapping properly is preferable if you have that information.

April 1, 2011 at 4:47 PM

Blogger cbloom said...

"I still think that wrapping properly is preferable if you have that information."

Yeah, video game textures are sort of a special case. Note : addendum added to original post on this subject.

Also, for the small filters shown here, the issue of off-edge sampling is not very important (assuming your image is large - 3 pixels of edge being slightly not perfect on a 1920 wide image is invisible).

In some cases however (SCIELAB for example) I've used some huge Gaussians, like 100 pixels wide, and then the off-edge contribution to the filter can be very significant.

April 1, 2011 at 5:08 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.