Author Topic: Blurring  (Read 4665 times)

0 Members and 1 Guest are viewing this topic.

Offline psygate

  • Completly Insane.
  • Atari ST
  • ***
  • Posts: 173
  • Karma: 7
  • That boy needs therapy.
    • View Profile
Blurring
« on: November 03, 2006 »
Hi,

I havent written anything since two months or so (because I had some things to do) but I need your help once again!  ;D

Could you tell me how to do a blur? I mean, not this simple Middle-Color, in which you just add all points up and divide them by thier number, I mean something like gaussian, radial and movement blur!

Could someone help me?
He who controlles the minds commands the many.
He who commands the many, conqueres the minds.

Offline slinks

  • A little bit strange
  • DBF Aficionado
  • ******
  • Posts: 3963
  • Karma: 43
    • View Profile
Re: Blurring
« Reply #1 on: November 03, 2006 »
No idea, but you're in the wrong section mate.
I love semi-colons way too much ^^;
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Blurring
« Reply #2 on: November 03, 2006 »
Hi Psygate - I moved the topic to this coding forum.

All blurs by definition are just adding up neighbouring colour values (in space, or in time) and averaging them out.  The different kinds of blur you mention are made by how you define neighbouring.  What kind of effect would you like to achieve exactly?

Jim
Challenge Trophies Won:

Offline psygate

  • Completly Insane.
  • Atari ST
  • ***
  • Posts: 173
  • Karma: 7
  • That boy needs therapy.
    • View Profile
Re: Blurring
« Reply #3 on: November 04, 2006 »
I would be really interessted in radial blur. It's the only effect I could work out on my own... (radial blur fromt eh center and around, you know, there are towo options in photoshop how to blur with radial blur)
He who controlles the minds commands the many.
He who commands the many, conqueres the minds.

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: Blurring
« Reply #4 on: November 05, 2006 »
optimus wrote a nice explanation on how to do a radial blur, you can find it here: http://dbfinteractive.com/index.php?topic=219.0

//Johnny
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Blurring
« Reply #5 on: November 05, 2006 »
I wrote one over at the Yabasic forums, I think for Clyde, but I'm damned if I can find it.  I'd use the search there, but EzBoard is determined that I have never, in 5000+ posts, used the word 'rotation'.  I suspect they are wrong.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Blurring
« Reply #6 on: November 05, 2006 »
Hmmm, strange I can't remember asking about this or seeing any code ( thanks if you did ). Have looked through the entire Blitz Basic topic entries and tried searching also at the Yab / Homebrew forums, came up blankety blank.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline slinks

  • A little bit strange
  • DBF Aficionado
  • ******
  • Posts: 3963
  • Karma: 43
    • View Profile
Re: Blurring
« Reply #7 on: November 05, 2006 »
I wrote one over at the Yabasic forums, I think for Clyde, but I'm damned if I can find it.  I'd use the search there, but EzBoard is determined that I have never, in 5000+ posts, used the word 'rotation'.  I suspect they are wrong.

Jim


No, they might be right about that, I remember looking for a piece on rotation you wrote, can't remember what it was called, but it was a strange name. Most of the topics in that forum have bizarre names, and I had to search each topic MANUALLY for the bit I was looking for. Took ****ing ages!
I love semi-colons way too much ^^;
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: Blurring
« Reply #8 on: January 05, 2007 »
i thought up a pretty clever and fast fake gaussian blur when i was writing my texture generator, i can post real source if you need it, but i'll try to explain it first..

normally when you blur you average the center pixel and a certain amount of it's neigbours.. say for example that you use top/left/center/right/bottom pixels..

now instead of just going
Code: [Select]
final=(source[x,y-1]+
       source[x-1,y]+
       source[x ,y ]+
       source[x+1,y]+
       source[x,y+1])/5;
destination[x,y]=final;
you use a variable to define the radius of the blur, and use that variable to decide where to grab your pixels, just like above only you use source[x,y-radius] instead of source[x,y-1];

now that alone doesnt cut it, what you need to do is to blur in several passes, decreasing radius for each pass.. so, lets say we do a 10pass gaussian blur, what we do now is something like this:
Code: [Select]
for radius =10 to 1 do
 for x=0 to 255 do
 for y=0 to 255 do
  begin
   final=(source[x,y-radius]+
          source[x-radius,y]+
          source[x ,y ]+
          source[x+radius,y]+
          source[x,y+radius])/5;
   destination[x,y]=final;
  end

i hope that helped you in some way.. if you wanna see the result the gaussian blur produce, try downloading my texture generator in this thread: http://dbfinteractive.com/index.php?topic=1070.0 (syntex.rar, somewhere in the thread) and play around with the blur.. to save you from wasting time implementing something that you didnt like :)
Challenge Trophies Won: