Is there an algorithm to generate the Kawase Blur Kernels to approximate the actual Gaussian Blur (of a specific kernel size, and if possible, a sigma)?
-
$\begingroup$ Sounds interesting! Do you have a link to a description of what a kawase blur kernel is? $\endgroup$– Marcus MüllerNov 20, 2019 at 23:16
-
1$\begingroup$ To the extent this is helpful- you can generate the equivalent of a FIR filter with Gaussian coefficients simply by cascading a series of two tap unity gain FIR filters-- similar to convolving binomial distributions (and the law of large averages), it converges quickly, such as 6+ stages, to a reasonable Gaussian response. See dsp.stackexchange.com/questions/31483/… $\endgroup$– Dan BoschenNov 21, 2019 at 4:41
-
$\begingroup$ @MarcusMüller I might not be using the correct terminology. I am talking about the distances of the four corners we average in each pass. $\endgroup$– Shukant PalNov 22, 2019 at 0:33
1 Answer
Looking at Intel - An Investigation of Fast Real Time GPU Based Image Blur Algorithms By Filip Strugar it looks like the Kawase kernel is just a way of implementing a linear kernel quickly, but in a way that constrains the kernel somewhat.
This means that you could make such an algorithm. Either choose a set of spreads and adjust their weights (if that is possible) for a best fit, or search a number of possible spreads (with the best weights) and find the ones that fit best.
Given the ad-hoc nature of the kernel I suspect you'll end up with a table of best fits for each set of spreads, and then you (or anyone using the table) would want to make a judgement call about effect vs. clock ticks.
The kernel is designed with some specific hardware in mind, so you'll need to check to see if you can adjust the weights at all, or if you can only adjust the spacing and the repetition at each spacing. At any rate, because the spacing is discrete, its a fairly highly nonlinear optimization problem. It may be best to just do a brute-force search at each size of Gaussian you want to emulate. Just try out a bunch of different spacing combinations, and see which ones give you the closest match to a Gaussian of a certain size for the number of iterations.
-
$\begingroup$ Could you elaborate how I would find the best distances & then further adjust their weights? $\endgroup$ Nov 22, 2019 at 0:34
-
1$\begingroup$ Everything I know about that kernel comes from reading that one page I cite. So -- not much. But see my edits. $\endgroup$ Nov 22, 2019 at 0:37