yeah with the mouse it works but if you want all the images it glitches like crazy.
Imports System.Math
Imports WindowsApp1.rinegan
Public Class Form1
Dim eye1 As New Aeye()
Dim checked As New List(Of Point)
Dim b1 As Boolean = False
Dim b2 As Boolean = False
Dim b3 As Boolean = False
Dim b4 As Boolean = False
Dim b5 As Boolean = False
Dim b6 As Boolean = False
Dim b7 As Boolean = False
Dim b8 As Boolean = False
Dim x As Integer
Dim y As Integer
Dim rList As New List(Of Rectangle)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim bmp As New Bitmap("c:\testimage\x11.bmp")
'Dim matrix(bmp.Width, bmp.Height) As Boolean
'For i As Integer = 0 To bmp.Height - 1
' For j As Integer = 0 To bmp.Width - 1
' matrix(j, i) = Aeye.is_pixel_dark_at(j, i, bmp, 40)
' bmp = Aeye.mark_dark_pixel(j, i, bmp, 1)
' Next
'Next
Dim x As Integer
Dim y As Integer
x = TextBox1.Text
y = TextBox2.Text
Dim minx, miny, maxx, maxy As Integer
minx = bmp.Width
miny = bmp.Height
maxx = 0
maxy = 0
Dim rec As New Rectangle()
If Aeye.isOutLine(x, y, bmp, 20) Then
corn(x, y, bmp)
' rectangle marker for the pixels of the shape detected by sub corn
For Each item As Point In checked
Aeye.maxer(item.X, maxx)
Aeye.maxer(item.Y, maxy)
Aeye.miner(item.X, minx)
Aeye.miner(item.Y, miny)
Next
If maxx - minx > 10 And maxy - miny > 10 Then
bmp = Aeye.graphicContour(bmp, minx, maxx, miny, maxy)
TextBox3.Text &= minx.ToString & " " & miny.ToString & " " & maxx.ToString() & " " & maxy.ToString & Environment.NewLine
End If
End If
'For Each item As Point In checked
' bmp = Aeye.mark_dark_pixel(item.X, item.Y, bmp, 1)
'Next
Dim bmp2 As New Bitmap(bmp)
PictureBox3.Image = Aeye.mark_dark_pixelRED(x, y, bmp2, 5)
checked.Clear()
PictureBox2.Image = bmp.Clone()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim bmp As New Bitmap("c:\testimage\x1.bmp")
PictureBox1.Image = bmp.Clone()
End Sub
Sub corn(x As Integer, y As Integer, bmp As Bitmap)
If Not checked.Contains(New Point(x, y)) Then
checked.Add(New Point(x, y))
b1 = Aeye.isOutLine(x - 1, y - 1, bmp, 20)
b2 = Aeye.isOutLine(x - 1, y, bmp, 20)
b3 = Aeye.isOutLine(x - 1, y + 1, bmp, 20)
b4 = Aeye.isOutLine(x, y - 1, bmp, 20)
b5 = Aeye.isOutLine(x + 1, y - 1, bmp, 20)
b6 = Aeye.isOutLine(x + 1, y, bmp, 20)
b7 = Aeye.isOutLine(x + 1, y + 1, bmp, 20)
b8 = Aeye.isOutLine(x, y + 1, bmp, 20)
If Not (b1 And b2 And b3 And b4 And b5 And b6 And b7 And b8) Then
If b1 Then
corn(x - 1, y - 1, bmp)
End If
If b2 Then
corn(x - 1, y, bmp)
End If
If b3 Then
corn(x - 1, y + 1, bmp)
End If
If b4 Then
corn(x, y - 1, bmp)
End If
If b5 Then
corn(x + 1, y - 1, bmp)
End If
If b6 Then
corn(x + 1, y, bmp)
End If
If b7 Then
corn(x + 1, y + 1, bmp)
End If
If b8 Then
corn(x - 1, y + 1, bmp)
End If
End If
End If
End Sub
Function listOfPointsToRectangle(ByVal lst As List(Of Point), ByVal bmp As Bitmap) As Rectangle
Dim minx, miny, maxx, maxy As Integer
minx = bmp.Width
miny = bmp.Height
maxx = 0
maxy = 0
For Each item As Point In lst
Aeye.maxer(item.X, maxx)
Aeye.maxer(item.Y, maxy)
Aeye.miner(item.X, minx)
Aeye.miner(item.Y, miny)
Next
Dim rec As New Rectangle(0, 0, 1000, 1000)
If maxx - minx > 10 And maxy - miny > 10 Then
rec = New Rectangle(minx, miny, maxx - minx, maxy - miny)
End If
End Function
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim bmp As New Bitmap("c:\testimage\x32.bmp")
'x = 100
'y = 112
'xu()
'x = 115
'y = 100
'xu()
x = 2
y = 2
xu()
x = 0
Dim c As Integer = 2
For i As Integer = 3 To bmp.Height - 2
While c < bmp.Width - 5
c += 1
c += jumper(c, i)
x = c
y = i
Try
If Aeye.is_pixel_dark_at(x, y, bmp, 50) Then
xu()
End If
Catch ex As Exception
End Try
'xu()
End While
c = 2
Next
End Sub
Sub xu()
Dim bmp As New Bitmap("c:\testimage\x32.bmp")
Dim minx, miny, maxx, maxy As Integer
minx = bmp.Width
miny = bmp.Height
maxx = 0
maxy = 0
Dim rec As New Rectangle()
If Aeye.isOutLine(x, y, bmp, 20) Then
corn(x, y, bmp)
' rectangle marker for the pixels of the shape detected by sub corn
For Each item As Point In checked
Aeye.maxer(item.X, maxx)
Aeye.maxer(item.Y, maxy)
Aeye.miner(item.X, minx)
Aeye.miner(item.Y, miny)
Next
Dim rTemp As New Rectangle(minx, miny, maxx - minx, maxy - miny)
If maxx - minx > 10 And maxy - miny > 10 And Not rList.Contains(rTemp) Then
'bmp = Aeye.graphicContour(bmp, minx, maxx, miny, maxy)
rList.Add(rTemp)
TextBox3.Text &= minx.ToString & " " & miny.ToString & " " & maxx.ToString() & " " & maxy.ToString & Environment.NewLine
End If
End If
Dim bmp2 As New Bitmap(bmp)
PictureBox3.Image = Aeye.mark_dark_pixelRED(x, y, bmp2, 5)
checked.Clear()
PictureBox2.Image = bmp.Clone()
End Sub
Function jumper(ByVal x As Integer, ByVal y As Integer) As Integer
Dim ret As Integer = 0
For Each item As Rectangle In rList
If (x >= item.X And x <= item.Width + item.X) And (y >= item.Y And y <= item.Height + item.Y) Then
ret = item.Width + item.X + 1
End If
Next
Return ret
End Function
End Class