Author Topic: [IMAGE PROCESSING] 18 Magic Digits  (Read 37248 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #20 on: July 31, 2011 »
Thanks both your comments are very kind :)

Shockwave ^ Codigos
Challenge Trophies Won:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #21 on: August 01, 2011 »
 :clap: Marvelous! So... demo :P
Challenge Trophies Won:

Offline SERGIO_ManOwaR_

  • C= 64
  • **
  • Posts: 48
  • Karma: 9
    • View Profile
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #22 on: August 02, 2011 »
Its a cool demo, looks great. I only have a dissapoint wich is based in the limitated effects that reduces to a window filtering real-time. I guess that all those animated graphics may create some spectation and after all i was really specting to find more effects. Thats the worst i have to say, anything else is great. I have no problem to watch it speedy, no slow-downs in my computer so it moves perfectly smooth and everything is cool. Remember me old paradox demos in playstation games, even the music. Nice to see. Good work

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #23 on: August 03, 2011 »
Its a cool demo, looks great. I only have a dissapoint wich is based in the limitated effects that reduces to a window filtering real-time.

I decided on the Sobel filter which needs to do over 20 calculations per pixel so I had some choices to make about it. 

I could have applied the filter to a static image and not cared about the resolution but this is running over some real time effects so I had to either do it within something more powerful than Freebasic, like shader language (which I don't know), or sacrifice the framerate to have a higher resolution, or reach a compromise which I did.

I decided that it would be nice to have a window where you could see the sobel filter affecting a real time image so you could see it acting on something live and moving.

If you consider that my code is actually doing the following loop on the sobel part of the screen, maybe you can appreciate better why the window is small.

Code: [Select]
    DIM AS DOUBLE INOUT
    INOUT = 120
    PP2=@RENDER_BUFFER((xres*70))   
            FOR Y = 70 TO YRES-70   
                PP3=@SCREEN_BUFFER(X+((Y-1)*XRES))
                FOR X = 0 TO XRES-1
                    IF ( Y < 1 ) OR (Y >= YRES-1) OR (X < INOUT) OR (X >XRES-INOUT) THEN                       
                        *PP2 =  * PP3
                    ELSE                       
                        SUMX = 0
                        SUMY = 0
                        PP=@SCREEN_BUFFER(X+((Y-1)*XRES))
                        FOR I= -1 TO 1                                                       
                            PP-=1
                            FOR J=-1 TO 1                                                               
                                CURP = *PP+J
                                    SUMX += CURP * GX(J+1,I+1)
                                    SUMY += CURP * GY(J+1,I+1)
                                PP+=1
                            NEXT
                            PP+=XRES
                        NEXT                       
                        SUM = ABS((SUMX)+ABS(SUMY)) * SOBELSENSE
                        *PP2 = PALETE (SUM)
                    END IF                                       
                    PP2+=1         
                    PP3+=1
                NEXT
            NEXT

Your point of having a limited number of effects is a fair one though, I used up all the time I could by trying to add a variety of effects so you could see the soblel working on them instead of perhaps having one effect and more filters.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #24 on: August 03, 2011 »
Code: [Select]
FOR I= -1 TO 1                                                       
  PP-=1
  FOR J=-1 TO 1                                                               
    CURP = *PP+J
    SUMX += CURP * GX(J+1,I+1)
    SUMY += CURP * GY(J+1,I+1)
    PP+=1
  NEXT
  PP+=XRES
NEXT
Since the 3x3 sobel matrix is symmetric you can separate it into 2 passes, each using a 3x1 matrix:
Code: [Select]
            ( 1 )   (-1 0 1 )
 (1,0,-1) * ( 2 ) = (-2 0 2 )
            ( 1 )   (-1 0 1 )
This way you just need six adds instead of 9 multiply-add.
« Last Edit: August 05, 2011 by hellfire »
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #25 on: August 04, 2011 »
That's a nice optimisation, thanks Hellfire it didn't occur to me to do it that way :)

K+
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Moroboshisan

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 454
  • Karma: 18
  • C=64
    • View Profile
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #26 on: August 04, 2011 »
 :o

lovely effect, nice feeling... love it every time i give it a run!

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #27 on: August 06, 2011 »
I might have said this before, but I'll say it again - 5 effects running simultaneously, this smoothly - words cannot describe how excellently brilliant this is.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: [IMAGE PROCESSING] 18 Magic Digits
« Reply #28 on: August 06, 2011 »
Thanks guys, you're very kind :)
Shockwave ^ Codigos
Challenge Trophies Won: