I have the following code, I want to do pixel by pixel comparison between the big and small image
My questions are
1. How I can write to the coordinate? coordinates{0, 0} = BigX + Math.Ceiling(img2.Size.Width / 2) does not seem right
2. How I can change the size of the coordinate from one point to XX points? XX will be input to the function as a new ByVal
Code:Private 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, 0} = BigX + Math.Ceiling(img2.Size.Width / 2) coordinates[{0},{1}] = BigY + Math.Ceiling(img2.Size.Height / 2) Exit_of_this_location: Next Next Return coordinates End Function




Reply With Quote
