I have the following code, my img1 is big image, and img2 is small image
I think the error is fromCode:If img1.GetPixel(BigX, BigY) <> img2.GetPixel(SmallX, SmallY) ThenAny adviceCode:Public Function ImageCompare(ByVal img1 As Bitmap, ByVal img2 As Bitmap) Dim coordinates() As Integer = {-1, -1} For BigX = 1 To img1.Size.Width - img2.Size.Width + 1 For BigY = 1 To img1.Size.Height - img2.Size.Height + 1 For SmallX = 1 To img2.Size.Width For SmallY = 1 To img2.Size.Height If img1.GetPixel(BigX, BigY) <> img2.GetPixel(SmallX, SmallY) Then GoTo Exit_of_this_location End If Next Next coordinates(0) = BigX + Math.Ceiling(img2.Size.Width / 2) coordinates(1) = BigY + Math.Ceiling(img2.Size.Height / 2) Exit_of_this_location: Next Next Return coordinates End Function




Reply With Quote
