|
-
Jul 2nd, 2005, 10:44 PM
#1
Re: Comparing Images using Icam
How about
If not BitmapA.GetPixel(x, y) = BitmapB.GetPixel(x, y) then
instead? equals is in the list of operators for type color in the help files..
Bill
-
Jul 3rd, 2005, 01:45 AM
#2
Thread Starter
Junior Member
Re: Comparing Images using Icam
 Originally Posted by conipto
How about
If not BitmapA.GetPixel(x, y) = BitmapB.GetPixel(x, y) then
instead? equals is in the list of operators for type color in the help files..
Bill
it doesn't work too..it gives out the same error...
here is the code from the class
Private Sub cmdViewStill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdViewStill.Click
If myCam.iRunning Then
Dim a As FrmImage
a = New FrmImage
a.picImage.Image = myCam.copyFrame(Me.picOutput, New RectangleF(0, 0, _
Me.picOutput.Width, Me.picOutput.Height))
SomethingMoved()
Else
MessageBox.Show("Camera Is Not Running!")
End If
End Sub
Public Function SomethingMoved(ByVal BitmapA As Bitmap, ByVal BitmapB As Bitmap) As Boolean
Dim x As Integer = 0
Dim y As Integer = 0
Dim ChangedPixelCount As Integer = 0
'assume both images are the same size
For y = 2 To BitmapA.Height Step 5
For x = 2 To BitmapA.Width Step 5
If BitmapA.GetPixel(x, y) = BitmapB.GetPixel(x, y) Then
ChangedPixelCount += 1
End If
Next x
Next y
If ChangedPixelCount >= 5 Then
'yes, motion detected
Return True
Else
'nope.
Return False
End If
End Function
now how do i save 2 image and compare pixels? the operators "=" and "<>" doesn't work at all...or is there a way to convert bitmap to integer so that i can use the operators?
Last edited by nightkids31; Jul 3rd, 2005 at 02:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|