Spider Web Drawing

Share your advanced PureBasic knowledge/code with the community.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Hi Keya,

I take it you still haven't downloaded PureBasic Interface to OpenCV ? I spent a couple days writing Spider Web Drawing, and a couple years on the former.
- version 2.4.12 has 18 more relevant examples (don't let an examples legacy tag fool you)

------------------------------------------------

Hi Andre,

Thank you for your stamp of approval, it means a lot.

------------------------------------------------

Hi dobro,

I have absolutely no doubt that your code is original, you have more then proven your skills as a programmer; my attempt at humor was a fail.

Thank you for the link, I can see how the video inspired you, same as the image in my first post inspired me.
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Re: Spider Web Drawing

Post by dobro »

JHPJHP wrote:my attempt at humor was a fail.
no no !! :lol:

I do not master the English language, and use
Google translator, so necessarily the nuances are erased :lol:
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Hi dobro,

Cheers.

---------------------------------

Based on comments from wilbert I've updated the code and binaries for better cross-platform compatibility.

Updated:
- replaced ico files with png files
- added a few CompilerIf statements
- ...

Compiler Options/Use Icon is still set to an ICO file, but I've included an ICNS file in the binaries folder for the Mac OS.
Last edited by JHPJHP on Fri May 06, 2016 2:29 am, edited 1 time in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Spider Web Drawing

Post by wilbert »

JHPJHP wrote:Based on comments from wilbert I've updated the code and binaries for better cross-platform compatibility.
It's working now on OSX without any modification :)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
idle
Always Here
Always Here
Posts: 5018
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Spider Web Drawing

Post by idle »

Great effect! I looked this morning before my cup of coffee and got quite frustrated repeatedly trying to wipe the cobwebs out of my eyes
so I could see what I was looking at. :lol:
Windows 11, Manjaro, Raspberry Pi OS
Image
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Hi wilbert,

Thanks for the heads up, I'm glad it's fixed; I've applied the same solution to LSB (Least Significant Bit) File Embedding.

-------------------------------------------

Hi idle,

Thank you. If coffee isn't working for you I suggest something a little stronger. :)
Last edited by JHPJHP on Fri May 06, 2016 2:33 am, edited 2 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Updated:
- improved the grayscale algorithm
- fixed an incorrect Constant
- applied some general code-cleanup

-------------------------------------------

Demonstrated in the application Barbouille (Pure_autoPaint) written by dobro, drawing with different shapes produces varying effects.

I'm not going to apply any additional effects to this project, but if you're so inclined...

Modify:

Code: Select all

LineXY(nX1, nY1, nX2, nY2, RGB(nR1, nG1, nB1))
With one of the following shapes (or draw your own):

Code: Select all

Ellipse(nX1, nY1, nX2 - nX1, nY2 - nY1, RGB(nR1, nG1, nB1))
Box(nX1, nY1, nX2 - nX1, nY2 - nY1, RGB(nR1, nG1, nB1))
At a minimum adjust the following values to optimize the result:
- there are various others parameters that can enhance the effect

Code: Select all

nDistance.f = 100
If nDistance > 25 : nDistance - 0.1 : EndIf

NB*: As a side note, this effect including 100+ other effects have been available in PureBasic Interface to OpenCV for awhile.
Last edited by JHPJHP on Thu May 05, 2016 6:48 am, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Updated:
- added 4 color spaces
-- Convert to YUV / YCrCb
-- Convert to XYZ
-- Convert to HSV / HSB
-- Convert to HLS

Switched from using Point / Plot to direct pixel manipulation.
- matched closely the standard I became accustomed to while working with OpenCV
- should offer improved speed (not needed here, but required in future projects)

The added color spaces were not intended as a decorative effect...

My intention is to convert a few more examples from PureBasic Interface to OpenCV, but some of the requirements call for an alternate color space from the standard RGB. This project seemed the perfect place to host / test the Procedures, as I was in the process of switching to direct pixel manipulation anyway.

NB*: Update also includes various other improvements not worth documenting.
Last edited by JHPJHP on Fri May 06, 2016 2:34 am, edited 2 times in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Updated:
- added 4 color spaces
-- Convert to YIQ
-- Convert to Hunter LAB
-- Convert to CIE-LAB
-- Convert to CIE-LUV
JHPJHP wrote:The added color spaces were not intended as a decorative effect...

My intention is to convert a few more examples from PureBasic Interface to OpenCV, but some of the requirements call for an alternate color space from the standard RGB. This project seemed the perfect place to host / test the Procedures, as I was in the process of switching to direct pixel manipulation anyway.
NB*: Update also includes some minor bug fixes and improvements.
Last edited by JHPJHP on Fri May 06, 2016 2:35 am, edited 1 time in total.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Spider Web Drawing

Post by walbus »

Very impressive !
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Spider Web Drawing

Post by wilbert »

JHPJHP wrote:Switched from using Point / Plot to direct pixel manipulation.
If you want to keep it cross platform, you also need to examine and respect DrawingBufferPixelFormat() .
It's very inconvenient the formats on Windows, OSX and Linux are different.
Windows (x64)
Raspberry Pi OS (Arm64)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Hi walbus,

Thank you for the complement, it's very much appreciated.

-------------------------------------------------------

Hi wilbert,

I'm not sure about Linux, but I believe the issues with OSX are fixed, please let me know.

-------------------------------------------------------

Working with OSX motivated me to take a second look at the color space algorithms. Most of the associated Procedures have been updated because of this, returning more accurate results.
- I used the example cv_cvtcolor.pb from PureBasic Interface to OpenCV as a guide for comparison
Last edited by JHPJHP on Fri May 06, 2016 2:35 am, edited 1 time in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Spider Web Drawing

Post by wilbert »

JHPJHP wrote:I'm not sure about Linux, but I believe the issues with OSX are fixed, please let me know.
Yes, it's working again :)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
idle
Always Here
Always Here
Posts: 5018
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Spider Web Drawing

Post by idle »

it's working on Linux
Windows 11, Manjaro, Raspberry Pi OS
Image
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Spider Web Drawing

Post by JHPJHP »

Hi wilbert,

Thank you for confirming it worked in OSX. I have PureBasic installed in an OSX VM, but I had concerns that the RGB order may still have been a problem.

---------------------------------------------

Hi idle,

Thank you for confirming it worked in Linux, I've now installed PureBasic in a Linux OS VM.

If you have a moment I've noticed a few problems.
- elementary OS 0.3.2 Freya (64-bit)
- Built on Ubuntu 14.04
- PureBasic 5.42 LTS (Linux - x64)

The program opens with a window inside another window. The first (outside) window is the correct size, and the second (inside) window is smaller with scroll-bars, hosting all the Gadgets. Both windows have a title bar with the small closing-X, and the first window is transparent.
- have you seen this before, and if so do you know a way to correct it

I've updated the RunProgram (default image viewer) with the application shotwell.
- is this a standard Linux image viewer, and if not what is the default image viewer

Thank you.

---------------------------------------------

NB*: I'm pleasantly surprised that all 10 color spaces remained consistent across all three IDE's / OS'.
Last edited by JHPJHP on Mon May 09, 2016 12:31 pm, edited 2 times in total.
Locked