tag:blogger.com,1999:blog-5246987755651065286.post1823764035139361760..comments2024-02-22T16:15:42.388-08:00Comments on cbloom rants: 03-31-11 - Some image filter notescbloomhttp://www.blogger.com/profile/10714564834899413045noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5246987755651065286.post-69746333693793076082011-04-01T17:08:50.897-07:002011-04-01T17:08:50.897-07:00"I still think that wrapping properly is pref..."I still think that wrapping properly is preferable if you have that information."<br /><br />Yeah, video game textures are sort of a special case. Note : addendum added to original post on this subject.<br /><br />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). <br /><br />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.cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-1083728961206944872011-04-01T16:47:39.794-07:002011-04-01T16:47:39.794-07:00> what you really should be doing is applying t...> what you really should be doing is applying the filter only where its domain overlaps the image domain.<br /><br />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. <br /><br />I still think that wrapping properly is preferable if you have that information.castanohttps://www.blogger.com/profile/08088335278984724562noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-65151166501516501372011-04-01T14:35:15.345-07:002011-04-01T14:35:15.345-07:00"But then I realized - these are not really p...<i>"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."</i><br />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.<br /><br />The 1D kernel coefficients are given by <br /><br />K[sigma](n) = exp(-sigma) * I_n(sigma)<br /><br />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].<br /><br />There's a nice introduction on <a href="http://en.wikipedia.org/wiki/Scale-space_implementation" rel="nofollow">Wikipedia</a>, and the <a href="http://www.nada.kth.se/~tony/abstracts/Lin90-PAMI.html" rel="nofollow">original paper by Lindeberg</a> is available online.ryghttps://www.blogger.com/profile/03031635656201499907noreply@blogger.com