Posts: 593
Threads: 44
Joined: Apr 2022
Reputation:
43
07-26-2023, 09:45 PM
(This post was last modified: 07-26-2023, 09:45 PM by TerryRitchie.)
(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.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
(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 + ...
Posts: 263
Threads: 14
Joined: Apr 2022
Reputation:
23
(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:
Posts: 300
Threads: 57
Joined: Apr 2022
Reputation:
56
07-27-2023, 11:07 PM
(This post was last modified: 07-27-2023, 11:16 PM by Dav.)
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 | | BlurScreen | | | | 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 |
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
Just like when I take off my glasses! Success?
b = b + ...
Posts: 241
Threads: 10
Joined: Apr 2022
Reputation:
30
(07-28-2023, 01:38 AM)bplus Wrote: Just like when I take off my glasses! Success? 
Cool, you found the fastest implementation of the blurring algorithm, works perfect for me too here
Posts: 38
Threads: 3
Joined: Apr 2022
Reputation:
3
Second line put ...
Randomize Timer
... so to have changing pictures...
Why not yes ?
Posts: 300
Threads: 57
Joined: Apr 2022
Reputation:
56
(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)
| | | | | | | | | | | | | | | 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 | | | | 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) | | | | | | tmpback& = _NewImage(Abs(x2 - x1) + 1, Abs(y2 - y1) + 1, 32) | | _PutImage , currentscreen&, tmpback&, (x1, y1)-(x2, y2) | | _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 |
|