Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Everybody's heard about the blurred
#11
(07-26-2023, 09:18 PM)RhoSigma Wrote:
(07-26-2023, 01:57 PM)bplus Wrote: Can you get an algo that goes the other way? I see enough blur already.

Yep, the ApplyFilter&() function of my imageprocess.bm library has also some "sharpen" filters as well as line/edge detect filters and some artistic ones.
I played with most of the filters. They could easily be the basis for a graphics manipulation program. I tested some of them against the filters offered in an old classic graphics program I still use called PhotoImpact X3. Rho's filters are just as good, if not better, than the effects offered in that software. I'm sure Photoshop's are better but that software is just too big and ungainly for simple graphics needs.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#12
(07-26-2023, 09:18 PM)RhoSigma Wrote:
(07-26-2023, 01:57 PM)bplus Wrote: Can you get an algo that goes the other way? I see enough blur already.

Yep, the ApplyFilter&() function of my imageprocess.bm library has also some "sharpen" filters as well as line/edge detect filters and some artistic ones.

Thanks I am intrigued!
b = b + ...
Reply
#13
(07-26-2023, 01:57 PM)bplus Wrote: Can you get an algo that goes the other way? I see enough blur already.
LOL, when I was testing the code, it was late in the evening and I had to go get my reading specs to tell the difference between the two.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply
#14
Rhos filters a awesome!   I'd like to add them to my QuadDraw program, next time I update it.

After tinkering with my slow blur code, failing to make it faster, I experimented with layers of _PUTIMAGE images with transparency instead, bypassing the slow POINT/PSET every pixel.  Surprised it worked.  Not a Gaussian blur, but it looks kind of decent, and is almost instant.

- Dav

Code: (Select All)

SCREEN _NEWIMAGE(800, 600, 32)

FOR t = 1 TO 1000
    size = RND * 255
    x = RND * _WIDTH: y = RND * _HEIGHT
    LINE (x, y)-(x + size, y + size), _RGB(RND * 255, RND * 255, RND * 255), BF
NEXT
FOR t = 1 TO 50000
    PSET (RND * _WIDTH, RND * _HEIGHT), _RGB(RND * 255, RND * 255, RND * 255)
NEXT

PRINT "press a key to blur...";
SLEEP

BlurScreen 'a little blur...
BlurScreen '...a little more.

SUB BlurScreen
    odisp% = _AUTODISPLAY: _DISPLAY
    tmpback& = _COPYIMAGE(_DISPLAY)
    _SETALPHA 50, , tmpback&
    _PUTIMAGE (-1, 0), tmpback&: _PUTIMAGE (1, 0), tmpback&
    _PUTIMAGE (0, -1), tmpback&: _PUTIMAGE (0, 1), tmpback&
    _PUTIMAGE (-1, -1), tmpback&: _PUTIMAGE (1, -1), tmpback&
    _PUTIMAGE (-1, 1), tmpback&: _PUTIMAGE (1, 1), tmpback&
    _PUTIMAGE (0, 0), tmpback&
    _FREEIMAGE tmpback&
    IF odisp% = -1 THEN _AUTODISPLAY
END SUB

Find my programs here in Dav's QB64 Corner
Reply
#15
Just like when I take off my glasses! Success? Smile
b = b + ...
Reply
#16
(07-28-2023, 01:38 AM)bplus Wrote: Just like when I take off my glasses! Success? Smile

Cool, you found the fastest implementation of the blurring algorithm, works perfect for me too here Big Grin
Reply
#17
Second line put ...
Randomize Timer
... so to have changing pictures...
Why not yes ?
Reply
#18
(07-28-2023, 12:44 PM)euklides Wrote: Second line put ...
Randomize Timer
... so to have changing pictures...

I didn't because I could test _PUTIMAGE placements easier with the screen looking the same each time.  But here it is in, and I made this a blur defined area routine now. 

Sometimes this program will hang up on me when closing the window by the mouse (X), I will have to use task kill to close it.

- Dav

Code: (Select All)

'==============
'BLURSCREEN.BAS
'==============
'Blurs area of screen
'Coded by Dav, JULY/2023

Randomize Timer
Screen _NewImage(800, 600, 32)

For t = 1 To 1000
    size = Rnd * 255
    x = Rnd * _Width: y = Rnd * _Height
    Line (x, y)-(x + size, y + size), _RGB(Rnd * 255, Rnd * 255, Rnd * 255), BF
Next
For t = 1 To 50000
    PSet (Rnd * _Width, Rnd * _Height), _RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next

Do
    BlurScreen 100, 100, _Width - 100, _Height - 100
    'put a line around it, just for show
    Line (100, 100)-(_Width - 100, _Height - 100), _RGBA(0, 0, 0, 2), B
    _Limit 30
Loop Until InKey$ <> ""


Sub BlurScreen (x1, y1, x2, y2)

    odisp% = _AutoDisplay: _Display
    currentscreen& = _CopyImage(_Display)

    'get defined area of screen to image, make it semi-transparent
    tmpback& = _NewImage(Abs(x2 - x1) + 1, Abs(y2 - y1) + 1, 32) 'make image
    _PutImage , currentscreen&, tmpback&, (x1, y1)-(x2, y2) 'copy area to image
    _SetAlpha 50, , tmpback&

    _PutImage (x1 - 1, y1), tmpback&: _PutImage (x1 + 1, y1), tmpback&
    _PutImage (x1, y1 - 1), tmpback&: _PutImage (x1, y1 + 1), tmpback&
    _PutImage (x1 - 1, y1 - 1), tmpback&: _PutImage (x1 + 1, y1 - 1), tmpback&
    _PutImage (x1 - 1, y1 + 1), tmpback&: _PutImage (x1 + 1, y1 + 1), tmpback&
    _PutImage (x1, y1), tmpback&
    _Display

    _FreeImage tmpback& 
    _FreeImage currentscreen&

    If odisp% = -1 Then _AutoDisplay
End Sub

Find my programs here in Dav's QB64 Corner
Reply




Users browsing this thread: 1 Guest(s)