outline from gadient mask

  • 226 Replies
  • 75590 Views
*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #105 on: May 05, 2017, 01:21:02 am »
see Reply #91 that's the pupil code I talk about , I need it to go through the entire picture to get all the objects and fast.
https://www.youtube.com/watch?v=ChrTqW1F3fU&feature=youtu.be

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: outline from gadient mask
« Reply #106 on: May 05, 2017, 01:43:15 am »
Earlier on in this thread I mentioned that you would have problems using outlines to recognise objects.
 
Can you see the sailing ship, Unicorn… and every other object known to man?



This is the problem with recognising objects by their outline… it’s a top down… bottom up problem… if you have no idea what you are looking for… how can you find it?

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6858
  • Mostly Harmless
Re: outline from gadient mask
« Reply #107 on: May 05, 2017, 01:59:26 am »
Is that where the use of reference images come in ?

I'm thinking humans learn things that they see. But what I have seen so far seems to be 2D images being used. It's going to need something like an internal 3D model and texture to recognise things at different orientations me thinks.

Is there even the computer power to do that yet ?

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #108 on: May 05, 2017, 02:46:15 am »
I don't have a problem using outlines I have a problem using the method in reply 91 to get outlines.

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: outline from gadient mask
« Reply #109 on: May 05, 2017, 10:31:23 am »
Post #91 has half the code missing. Ie isoutline()?

On an unrelated note… OMG what have Microsoft done to VB? Moving it over to a .NET object orientated language has not only made it extremely slow… but very hard to interoperate/ read lol.

 :)
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #110 on: May 05, 2017, 01:45:58 pm »
your need the eye class ?
Code
Imports System.Math
Namespace rinegan
    Public Class Aeye
        Public outlinePixel As Integer = 30
        Dim Imageslist As New List(Of ImageList)
        Dim ImageListCounter As Integer = 0
        Dim minX, minY, maxX, maxY As Integer
        Dim checkedMatrix(2000, 2000) As Boolean
        Dim imageMatrix(2000, 2000) As Boolean
        Dim HX(1000) As Integer
        Dim LX(1000) As Integer
        Dim HY(1000) As Integer
        Dim LY(1000) As Integer
        Dim Icounter As Integer
        Public Shared Function is_pixel_dark_at(ByVal xPos As Integer, ByVal Ypos As Integer, ByVal image As Bitmap, ByVal DarkPixel As Integer) As Boolean
            Dim color As Color
            Dim r, g, b As Integer
            color = image.GetPixel(xPos, Ypos)
            r = color.R
            g = color.G
            b = color.B
            If (r < DarkPixel) And (g < DarkPixel) And (b < DarkPixel) Then
                Return True
            Else
                Return False
            End If
        End Function
        Public Shared Function isOutLine(ByVal xPos As Integer, ByVal Ypos As Integer, ByVal image As Bitmap, ByVal bias As Integer) As Boolean

            Dim result As Boolean = False
            Dim change As Byte = 0
            If xPos > 0 And xPos < image.Width - 1 And Ypos > 0 And Ypos < image.Height - 1 Then
                Dim color4, color5, color8 As Color
                'color1 = image.GetPixel(xPos - 1, Ypos - 1)
                'color2 = image.GetPixel(xPos, Ypos - 1)
                'color3 = image.GetPixel(xPos + 1, Ypos - 1)
                'color7 = image.GetPixel(xPos - 1, Ypos + 1)
                color8 = image.GetPixel(xPos, Ypos + 1)
                'color9 = image.GetPixel(xPos + 1, Ypos + 1)
                color4 = image.GetPixel(xPos - 1, Ypos)
                'color6 = image.GetPixel(xPos + 1, Ypos)
                color5 = image.GetPixel(xPos, Ypos)

                If (CType(color5.R, Integer) > CType(color4.R, Integer) - bias) And (CType(color5.R, Integer) < CType(color4.R, Integer) + bias) Then
                    change += 1

                End If
                If (CType(color5.G, Integer) > CType(color4.G, Integer) - bias) And (CType(color5.G, Integer) < CType(color4.G, Integer) + bias) Then
                    change += 1

                End If
                If (CType(color5.B, Integer) > CType(color4.B, Integer) - bias) And (CType(color5.B, Integer) < CType(color4.B, Integer) + bias) Then
                    change += 1

                End If
                If (CType(color5.R, Integer) > CType(color8.R, Integer) - bias) And (CType(color5.R, Integer) < CType(color8.R, Integer) + bias) Then
                    change += 1

                End If
                If (CType(color5.G, Integer) > CType(color8.G, Integer) - bias) And (CType(color5.G, Integer) < CType(color8.G, Integer) + bias) Then
                    change += 1

                End If
                If (CType(color5.B, Integer) > CType(color8.B, Integer) - bias) And (CType(color5.B, Integer) < CType(color8.B, Integer) + bias) Then
                    change += 1

                End If
            End If


            If change = 6 Then
                result = True
            End If
            Return result
        End Function
        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
                For j As Integer = 0 To marker
                    Try
                        bmp1.SetPixel(x + j, y + i, Color.Green)
                    Catch ex As Exception

                    End Try
                Next
            Next
            Return bmp1

        End Function
        Public Shared Function getPixelColor(ByVal r As Integer, ByVal g As Integer, ByVal b As Integer) As Char
            ' r= red, g = green, b = blue
            Dim colorchar As Char
            If r > 245 And g > 245 And b > 245 Then
                colorchar = "w" ' white
            ElseIf r < 20 And g < 20 And b < 20 Then
                colorchar = "k" ' black (kuro in japanese)
            ElseIf r > g And g > b And g < 100 Then
                colorchar = "r" ' red
            ElseIf r > g And g > b And g > 200 Then
                colorchar = "y" ' yellow
            ElseIf r > g And g > b And 100 < g < 200 Then
                colorchar = "o" 'orange
            ElseIf (g > r And r > b) Or (g > b And b > r) Then
                colorchar = "g" 'green
            ElseIf b > g And g > r Then
                colorchar = "b" 'blue
            ElseIf (b > r And r > g) Or (r > b And g < 20) Then
                colorchar = "v" ' violet
            Else
                colorchar = "u" ' yet undefined
            End If
            Return colorchar
        End Function
        Public Shared Function mark_dark_pixelRED(ByVal x As Integer, ByVal y As Integer, ByVal bmp1 As Bitmap, ByVal marker As Byte)
            For i As Integer = 0 To marker
                For j As Integer = 0 To marker
                    Try
                        bmp1.SetPixel(x + j, y + i, Color.Red)
                    Catch ex As Exception

                    End Try
                Next
            Next
            Return bmp1

        End Function
        Public Shared Function mark_dark_pixelBlue(ByVal x As Integer, ByVal y As Integer, ByVal bmp1 As Bitmap, ByVal marker As Byte)
            For i As Integer = 0 To marker
                For j As Integer = 0 To marker
                    Try
                        bmp1.SetPixel(x + j, y + i, Color.Blue)
                    Catch ex As Exception

                    End Try
                Next
            Next
            Return bmp1

        End Function
        'Public Function contourImage(ByVal bmp As Bitmap) As Bitmap

        '    For index = 0 To bmp.Height - 1
        '        For j = 0 To bmp.Width - 1
        '            checkedMatrix(j, index) = False
        '            imageMatrix(j, index) = is_pixel_dark_at(j, index, bmp, 30)
        '            'If imageMatrix(j, index) Then
        '            '    MsgBox(j, index)
        '            'End If
        '        Next

        '    Next
        '    minX = bmp.Width
        '    minY = bmp.Height
        '    maxX = 0
        '    maxY = 0
        '    Dim jindex As Integer = 0
        '    Icounter = 0
        '    For i = 0 To bmp.Height - 1 Step 5

        '        While jindex < bmp.Width - 1
        '            If Not checkedMatrix(jindex, i) Then
        '                If Not imageMatrix(jindex, i) Then
        '                    checkedMatrix(jindex, i) = True
        '                Else
        '                    tracer(bmp, bmp.Width, bmp.Height, jindex, i)
        '                    HX(Icounter) = maxX
        '                    LX(Icounter) = minX
        '                    HY(Icounter) = maxY
        '                    LY(Icounter) = minY
        '                    Icounter += 1
        '                    minX = bmp.Width
        '                    minY = bmp.Height
        '                    maxX = 0
        '                    maxY = 0
        '                    jindex = jumpImage(jindex, i)
        '                End If
        '            End If



        '            jindex += 1
        '        End While
        '        jindex = 0
        '    Next

        '    For index = 0 To Icounter
        '        bmp = graphicContour(bmp, LX(index), HX(index), LY(index), HY(index))
        '    Next

        '    Return bmp

        'End Function
        Public Function jumpImage(ByVal x, y) As Integer
            If Icounter > 999 Then
                Icounter = 999
            End If
            Dim n As Integer = 0
            For index = 0 To Icounter
                If (LX(index) <= x And HX(index) >= x) And (LY(index) <= y And HY(index) >= y) Then
                    n = HX(index)
                End If
            Next
            Return n
        End Function
        Public Shared Function graphicContour(ByVal bmp As Bitmap, ByVal xmin As Integer, ByVal xmax As Integer, ByVal ymin As Integer, ByVal ymax As Integer) As Bitmap
            For i = xmin To xmax
                bmp = mark_dark_pixel(i, ymin, bmp, 1)
                bmp = mark_dark_pixel(i, ymax, bmp, 1)
            Next
            For i = ymin To ymax
                bmp = mark_dark_pixel(xmin, i, bmp, 1)
                bmp = mark_dark_pixel(xmax, i, bmp, 1)
            Next
            Return bmp
        End Function
        Public Shared Function graphicContourRed(ByVal bmp As Bitmap, ByVal xmin As Integer, ByVal xmax As Integer, ByVal ymin As Integer, ByVal ymax As Integer) As Bitmap
            For i = xmin To xmax
                bmp = mark_dark_pixelRED(i, ymin, bmp, 1)
                bmp = mark_dark_pixelRED(i, ymax, bmp, 1)
            Next
            For i = ymin To ymax
                bmp = mark_dark_pixelRED(xmin, i, bmp, 1)
                bmp = mark_dark_pixelRED(xmax, i, bmp, 1)
            Next
            Return bmp
        End Function
        Public Shared Function graphicContourBlue(ByVal bmp As Bitmap, ByVal xmin As Integer, ByVal xmax As Integer, ByVal ymin As Integer, ByVal ymax As Integer) As Bitmap
            For i = xmin To xmax
                bmp = mark_dark_pixelBlue(i, ymin, bmp, 1)
                bmp = mark_dark_pixelBlue(i, ymax, bmp, 1)
            Next
            For i = ymin To ymax
                bmp = mark_dark_pixelBlue(xmin, i, bmp, 1)
                bmp = mark_dark_pixelBlue(xmax, i, bmp, 1)
            Next
            Return bmp
        End Function
        'Private Sub tracer(ByVal bmp1 As Bitmap, ByVal w1 As Integer, ByVal h1 As Integer, ByVal x As Integer, ByVal y As Integer)
        '    If (x > 0 And x < w1) And (y > 0 And y < h1) Then
        '        If Not checkedMatrix(x, y) Then
        '            checkedMatrix(x, y) = True
        '            If imageMatrix(x, y) Then 'not black pixel
        '                maxer(x, maxX)
        '                maxer(y, maxY)
        '                miner(x, minX)
        '                miner(y, minY)
        '                tracer(bmp1, w1, h1, x - 1, y - 1)
        '                tracer(bmp1, w1, h1, x, y - 1)
        '                tracer(bmp1, w1, h1, x + 1, y - 1)
        '                tracer(bmp1, w1, h1, x - 1, y)
        '                tracer(bmp1, w1, h1, x + 1, y)
        '                tracer(bmp1, w1, h1, x - 1, y + 1)
        '                tracer(bmp1, w1, h1, x, y + 1)
        '                'tracer(bmp1, w1, h1, x + 1, y + 1)
        '            End If
        '        End If
        '    End If
        'End Sub
        Public Shared Sub maxer(ByVal a As Integer, ByRef b As Integer)
            If a > b Then
                b = a
            End If
        End Sub
        Public Shared Sub miner(ByVal a As Integer, ByRef b As Integer)
            If a < b Then
                b = a
            End If
        End Sub

    End Class
    Public Class ImageList
        Public minX As Integer
        Public minY As Integer
        Public maxX As Integer
        Public maxY As Integer
    End Class
End Namespace


*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #111 on: May 11, 2017, 07:38:00 pm »

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #112 on: May 12, 2017, 02:08:55 pm »
 




    Cool




*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #113 on: May 18, 2017, 07:48:55 pm »

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #114 on: May 18, 2017, 08:14:58 pm »

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #115 on: May 18, 2017, 09:09:46 pm »

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #116 on: May 20, 2017, 11:45:05 am »

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #117 on: May 20, 2017, 01:38:02 pm »

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: outline from gadient mask
« Reply #118 on: May 21, 2017, 06:33:58 pm »
 Very nice.
 I have been thinking about descriptors lately for that right angle triangle you are using for testing.
 I thinking a self comparative ration  descriptor table would be used: 

http://www.mathwarehouse.com/geometry/triangles/right-triangles/images/picture-30-60-90-special-right-triangle.png

 This is so you can identify same triangle up close or far away.

Fragment of  curves can haver ratio. These two chain codes are 25 percent of a circumference of a circle. But one is twice as big:

 30 degrees to the next pixel, 30 degrees, 30 degrees, = 90 and this is the small circle fragment.
15 degrees, 15 degrees, 15 degrees, 15 degrees, 15 degrees, 15 degrees = 90 degrees and is 25 percent ratio.
Both curve have are equal ratios. So when you zoom in out in a video you can identify thing of different sizes.

 A face will be made up of a combination of straight lines and curves: 

https://www.google.com/imgres?imgurl=http%3A%2F%2Fwww.the.me%2Fwp-content%2Fuploads%2F2014%2F08%2Fstory_lena_lenna_2.jpg&imgrefurl=https%3A%2F%2Fthe.me%2Fthe-story-of-lena%2F&docid=-tlZabWNRupR1M&tbnid=WKb0ThKcPJeD4M%3A&vet=10ahUKEwj3gfjgwIHUAhUT32MKHe8vA_MQMwg0KA8wDw..i&w=590&h=295&bih=631&biw=1216&q=image%20of%20edge%20detection%20of%20a%20woman&ved=0ahUKEwj3gfjgwIHUAhUT32MKHe8vA_MQMwg0KA8wDw&iact=mrc&uact=8#h=295&imgdii=pTf4RqToac6RVM:&vet=10ahUKEwj3gfjgwIHUAhUT32MKHe8vA_MQMwg0KA8wDw..i&w=590

*

yotamarker

  • Trusty Member
  • **********
  • Millennium Man
  • *
  • 1003
  • battle programmer
    • battle programming
Re: outline from gadient mask
« Reply #119 on: May 21, 2017, 07:42:32 pm »
to recog shapes I was thinking :
get a list of corner types, at any rate I don't think the size would cause much of a difference, as long as I sample
a consistent amount of pixels.

 


Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
Today at 05:46:48 am
AI controlled F-16, for real!
by frankinstien (AI News )
May 04, 2024, 01:04:11 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
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm

Users Online

289 Guests, 0 Users

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

Articles