I am making a program that will identify similar images and if images are similar it will put them in a new picture box. Then it will identify the coordinates of one pixel that is differen tand give it's coordinates. I broke my program down into a few different parts and all of them work but when i put them together it doess not work. here is an example of code that works by itself, but not with in the whole program
VB Code:
Private Sub Command1_Click()
Dim x As Long, y As Long
Dim c As Long, d As Long
Dim p1 As Long, p2 As Long
Dim R1 As Long, B1 As Long, G1 As Long
Dim R2 As Long, B2 As Long, G2 As Long
Dim t As Long, r As Integer
Dim per As Long, msg As String
t = 20
Picture1.ScaleMode = 3
Picture2.ScaleMode = 3
If Picture1.ScaleHeight = 160 And Picture1.ScaleWidth = 160 Then
Picture2.Picture = Image1
Do Until y > Picture1.ScaleHeight Or y > Picture2.ScaleHeight
p1 = Picture1.Point(x, y)
p2 = Picture2.Point(x, y)
RGB_get p1, R1, B1, G1
RGB_get p2, R2, B2, G2
Diff r, R1, R2, B1, B2, G1, G2, t
If r = 0 Then
d = d + 1
Else
End If
c = c + 1
x = x + 15
If x > Picture1.ScaleWidth Or x > Picture2.ScaleWidth Then x = 0: y = y + 15
Loop
per = 100 - ((d / c) * 100)
If per > 75 Then
Picture3.Picture = Image1
Else
Picture3.Picture = Image2
End If
End If
If Picture1.ScaleHeight = 160 And Picture1.ScaleWidth = 200 Then
Picture2.Picture = Image8
Do Until y > Picture1.ScaleHeight Or y > Picture2.ScaleHeight
p1 = Picture1.Point(x, y)
p2 = Picture2.Point(x, y)
RGB_get p1, R1, B1, G1
RGB_get p2, R2, B2, G2
Diff r, R1, R2, B1, B2, G1, G2, t
If r = 0 Then
d = d + 1
Else
End If
c = c + 1
x = x + 15
If x > Picture1.ScaleWidth Or x > Picture2.ScaleWidth Then x = 0: y = y + 15
Loop
per = 100 - ((d / c) * 100)
If per > 75 Then
Picture3.Picture = Image8
Else
Picture3.Picture = Image7
End If
End If
End Sub
i attached the source of the program. i know the pictures look weird, but i'm making the program for my little 7 year old brother to help him in some online game he plays. thanks for any help