outline from gadient mask

  • 226 Replies
  • 78848 Views
*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #120 on: May 23, 2017, 02:21:51 pm »
 Another way of doing curved lines is curved ratios. That is curve length divided by the chord:  Or curve BX divided by chord BX:

https://en.wikipedia.org/wiki/File:Chord_in_mathematics.svg



https://en.wikipedia.org/wiki/Chord_(aeronautics)

https://en.wikipedia.org/wiki/Chord_(geometry)

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #121 on: May 26, 2017, 10:01:54 pm »

this is just the overlap alg
I used a sobel alg filter first, then the dijkstra alg and a combo of isoutline, is dark pixel.
1600X2000 pixels is kinda the maximum it can handle, it is a bit slow I have some around it ideas, to speed up.
suggestions ?

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #122 on: May 28, 2017, 08:48:36 pm »
Intro to Algorithms: Crash Course Computer Science #13: 


*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #123 on: May 28, 2017, 09:38:40 pm »
I'm pretty sure keghn is a chatbot, one of the advanced out there.
the prev vid was a waste of time and is not related to this thread, and I'm telling this the the keghn software coder.

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #124 on: May 29, 2017, 01:43:39 am »
  Sorry. But i like how Carrie explained the dijkstra algorithm. And compared it to the other algorithms.

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #125 on: May 30, 2017, 01:55:29 pm »
would a stronger computer result in the algorithm running faster ?

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #127 on: May 31, 2017, 07:03:06 pm »
 Does your program move the image into memory and then do everything to it.
 Or do you do one thing save it back to hard drive. Then select a different operation load it back into memory and
when finished save it back to hard drive and then repeat? Accessing the hard drive all the time will slow thing down.
 If you like doing that way may have to use a ram disc software.

 Load once, then do all you algorithms in memory and save into a matrixes in memory, A mat.

 Another speed up is to print all you,  trouble shooting , debug information data, to the screen last and
also saves to the hard drive as the last part. Printing out information during the building and testing the program is all right. But when it is finished they should be removed. Printing text to the screen can really slow down a program.



*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: outline from gadient mask
« Reply #128 on: June 01, 2017, 10:20:46 am »
As keghn said…

You need to profile and optimize your code. 

VB.NET is an interpreted language; it has no native compiler etc so it’s not the fastest language by a long mark.  You could use another faster language; even JAVA is generally faster than VB.NET but preferably something like C++.

https://adtmag.com/articles/2002/08/01/speed-up-your-vbnet-code.aspx

https://msdn.microsoft.com/en-us/library/aa289513(v=vs.71).aspx

There are loads of web sites offering information on code optimization for specific languages but there are some basic rules that apply to all languages.

Make sure you are declaring the best/ fastest variable types for each purpose.
Check you are passing the correct variable types to subs/ functions.
Some built in functions can be very easy to use but very slow.
Remove as much math/ code from the inside of loops as possible.
Use pre-calculated ‘look up’ tables/ arrays where ever possible to avoid complex math.
Check your loops are not over running.
Limit sub calls they are usually very slow, use in-line code where possible.
Avoid/ limit classes; these are again very easy to use but very slow.
Re-think your algorithms… is there a faster way?
Etc…

Avoid using multiple comparisons in an IF statement on the same line; most compilers will check every comparison even if the first one is not matched.

.If xPos > 0 And xPos < image.Width - 1 And Ypos > 0 And Ypos < image.Height - 1 Then

Nest these into separate IF’s… I know it makes your code longer but it also makes it faster.

Remove unnecessary calculations from within your loops... ie...

Code
        Public Shared Function mark_dark_pixel(ByVal x As Integer, ByVal y As Integer, ByVal bmp1 As Bitmap, ByVal marker As Byte)

            For i As Integer = 0 To marker

                yi=y+i  <<<<<<<<<

For j As Integer = 0 To marker
                    Try
                        bmp1.SetPixel(x + j, yi, Color.Green)
                    Catch ex As Exception

                    End Try
                Next
            Next
            Return bmp1

        End Function

Write small test programs where you can accurately time methods and functions against each other inside a set loop size to find the fastest coding schema.  Use an accurate timer to time loops and print the results so you can see which sections are slowing your code down… then optimize those sections.

Code optimization can often take longer than the actual code production and it’s a good habit to optimize as you go along once you are familiar with the bottlenecks and foibles of your chosen language.

I personally really enjoy code profiling.

 :)
« Last Edit: June 01, 2017, 12:19:10 pm by korrelan »
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #129 on: June 10, 2017, 07:06:26 pm »
Gauss's magic shoelace area formula and its calculus companion: 


*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #130 on: June 11, 2017, 10:41:00 pm »

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #131 on: June 28, 2017, 06:24:21 pm »


 if it analyzes 0.25 of the image at a time with the times 3 speed up algorithm it runs 12 times faster which is under a second for images 2500 over 1500 pixels with a medium computer that 2017 has to offer.

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #132 on: June 28, 2017, 06:37:10 pm »

sped up : times 1, times 10, times 5

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #133 on: June 29, 2017, 08:49:00 pm »

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #134 on: June 29, 2017, 08:52:42 pm »
please post classifier suggestions for image recognition.

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

241 Guests, 0 Users

Most Online Today: 532. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles