Pseudo-Gaussian blur problem

Pseudo-Gaussian blur problem

Post by Mike D Sut » Wed, 25 Jul 2007 00:03:15


> I'm old enough to know better, but I cannot get my head round this and it's

Looks like you're only working in one channel which is why your resulting image is coming out red as opposed to
greyscale - Remember that in high/true colour, pixels are stored as Red, Green, Blue [, Alpha] so you have either 3 or 4
channels to operate on per pixel.
Have a look at the "Edge detection / Edge snap / Filter kernel" demo on my site, which provides code for running a
simple 3*3 filter kernel over an image. It should be a fairly trivial task to add this to support your 9*9 Gaussian
kernel rather than rolling your own from scratch. Also remember that a Gaussian Kernel is separable and commutative so
two passes of 1*9 and 9*1 will yield the same result as one 9*9 kernel, but with a lot less processing.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: XXXX@XXXXX.COM
WWW: http://www.yqcomputer.com/
 
 
 

Pseudo-Gaussian blur problem

Post by TWFyayBSYW » Wed, 25 Jul 2007 05:04:02

> > I have a 720 x 576 32-bit DIB. I draw some white text on the DIB and then


The colours in my test code don't really matter as at the end I set
everything to black and then apply the Gauss values to the alpha channel
only. But thanks anyway.


Fab. That works a treat. I've simplified everything (3x3 rather than 9x9)
and split it into two passes (vertical then horizontal), but it's still
fairly slow: each pass takes ~1.4 secs on an ageing P4. Would you expect that
sort of speeds

 
 
 

Pseudo-Gaussian blur problem

Post by Mike D Sut » Wed, 25 Jul 2007 05:29:22

> Fab. That works a treat. I've simplified everything (3x3 rather than 9x9)

Depends on the size of the image, for the test ~18*18 pixel image you posted I certainly wouldn't expect it to be that
slow, however the code is written for simplicity and readability as an example as opposed to being optimised for speed.
Using the existing code as a base, it should be possible to implement a fixed point/lookup table version of the
algorithm which would be far superior in speed if performance is paramount.
Make sure you compile with all the advanced optimisations checked too unless your code specifically requires them to be
disabled, this should eek a bit more performance out of it.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: XXXX@XXXXX.COM
WWW: http://www.yqcomputer.com/