Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How to blur an image ?

Author
Message
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 18th Jan 2017 12:33
Hello.

Do someone have any clues on how I can create a blurred version of an image.
Gaussian blur with parameter to define depth of blur should be the top

I have looked over the net at mathematics about this ... And didn't manage to understand...

Thank you all
Regards,
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 20th Jan 2017 00:42
You can either use memblocks to transform your image to a bitmap and then use the blur bitmap command, or you can try fading sprites that are slightly offset from one another using the set sprite alpha command.

If this makes no sense I will post some code for you. I have nothing else going on.. LoL!
Send your parents to noisy sprite demo hell... enter the D-Zone
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 20th Jan 2017 10:06
Derek, Thank you for your answer.

I know how I must setup data to work easily with them (using memblocks)...
It was the algorithm that was the default...
Concerning sprites, I doubt it will give the needed results.

I have found this : http://blog.ivank.net/fastest-gaussian-blur.html
I will try to convert it to DarkBASIC Professional this week-end.

I'll post a view of what I need (the result) from what I create (the source) to show exactly why I posted this question

Regards,
Fred
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 20th Jan 2017 23:48
I understand, you seek an algorithm that works for you.... i prefer a lazy man's approach.

I did a blur-thing as described above with this heightmap generator code.
Fading and offsetting multiple images, that's my key... outside of shaders or paint programs, I'm not sure how to blur images. I ain't no math whiz.



Send your parents to noisy sprite demo hell... enter the D-Zone
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 21st Jan 2017 13:38
You can also blur images using HLSL Shaders and the Image Kit plugin: https://forum.thegamecreators.com/thread/158832
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Feb 2017 14:47
I posted a shader demo of Gaussian blur a while ago. How much blur will you need?


Powered by Free Banners
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 23rd Feb 2017 21:55 Edited at: 23rd Feb 2017 21:56
Freddix wrote: "I have found this : http://blog.ivank.net/fastest-gaussian-blur.html"

i don't know how far you got with this. i made my own attempt at converting the first algorythm into dbpro code. this is what i got, may it be helpful to your implementation:

note that this code, in it's current state, is unbearably slow. a 1024x1024 px image took me about 84 seconds with a radius of 2. i don't know if the other algorythms would be any faster, or if dbpro is just too slow for that.
if you try the code, it may look like the program froze, but that's just because it is so slow.
also, there may be bugs, because the code in the link uses the var statement to declare any variable, so i had to guess which are floats and which are ints



Derek Darkly wrote: "I ain't no math whiz."

me neither
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Feb 2017 20:15
A shader would be far far faster than doing the blur with the CPU. You might like to look at the following thread especially the later posts and the thread I linked to there.

https://forum.thegamecreators.com/thread/211931

Login to post a reply

Server time is: 2024-03-29 13:53:40
Your offset time is: 2024-03-29 13:53:40