Sharpen 2D ?

Blitz3D Forums/Blitz3D Programming/Sharpen 2D ?

jfk EO-11110(Posted 2005) [#1]
Can someone point me to some sourcecode containing a sharpen 2D algorithm? Preferably Blitz3D. Thanks!


big10p(Posted 2005) [#2]
There's an algo here in some script/language but looks pretty easy to convert to blitz. No idea if it actually works, though. :)


jfk EO-11110(Posted 2005) [#3]
Thanks a lot, looks dead easy. I'll post it in the archives if it works.


jfk EO-11110(Posted 2005) [#4]
It really works, not bad at all.
http://www.blitzbasic.com/codearcs/codearcs.php?code=1540
Maybe it would be better to convert RGB to HSB for the sharpen process, because the way it works now, it slighty alters the color tone. This effect is not that obvious, so for a normal sharpen operation, it doesn't matter that much.

Maybe I'll fix this later.
EDIT: Well just added a HSL version, but due to the convertion RGB>HSL>RGB it's real slow.


big10p(Posted 2005) [#5]
Nice one. I must admit I'm a little surprised it works well as the original algo looks so simplistic. :)


jfk EO-11110(Posted 2005) [#6]
Yes, the original code does only this:

lum3#=lum1#+(amount#*(lum2#-lum1#))
where lum1 is the luminance of a pixel and lum2 the luminance of the next pixel at the upper left side (x-1,y-1).
And even this original thing is almost as good as my tweaked version.