-
Is this possible??....
Ok, I have an had an idear. What I want to do is buy a web cam, now here is the kicker, do some web cams come with motion activatiation? (i.e.) When the camera senses motion it starts recording, when it stops senses motion it stops recording. Does anyone know if they do that?
If not, is it possible to write a vb program to do so, I guess the prog could take a picture every second and compare with the one before, if it is different then have the cam start recording, and record for a specified amount of time and/or the pictures start being the same. Anyone think this is feasible to do?
-
I'm not sure about 'activation' webcams, but I would guess they do exist somewhere.
But on the programming side, it is (I think) possible:
This is a sample of v slow (and untested) code:
Code:
'Picture1.Picture is the picture with the Cam image:
'ScaleMode = 3 - Pixels
Private Const SIMIL = 0.9 'Required Maximum difference to start recording (account for quality of webcam)
Private PicPix(1000, 1000) As Long
Private Sub Form_Load()
Dim i as Integer, j as Integer
For i = 0 to Picture1.ScaleHeight
For j = 0 to Picture1.ScaleWidth
PicPix(i, j) = GetPixel(i, j)
Next:
Next:
End Sub
Private Sub Timer1_Timer()
Static Counter As Long
Dim i as Integer, j as Integer
If Counter Mod 2 <> 0 Then 'Compare
For i = 0 to Picture1.ScaleHeight
For j = 0 to Picture1.ScaleWidth
If GetPixel(i, j) = PicPix(i, j) then 'it could be j, i (I don't remember)
SameCount = SameCount + 1
End If
Next:
Next:
If (Picture1.ScaleHeight * Picture1.ScaleWidth * SIMIL) > SameCount Then
StartRecording 'I don't know how this would be done
End If
Else: 'Take Picture
Dim i as Integer, j as Integer
For i = 0 to Picture1.ScaleHeight
For j = 0 to Picture1.ScaleWidth
PicPix(i, j) = GetPixel(i, j)
Next:
Next:
End Sub
Dunno how
a) you'd get the handle of the webcam picture or
b) how you'd start recording
But there will be long and treacherous paths to achieving your means.
Yeah, whatever.
PS: Code is probably full of bugs, I've just written it off the top of my head. Not literally, obviously.
-
Oh yeah, remember to put Counter = Counter + 1 if ytou were to be so crazy as to use
my code. ;)
(and declare GetPixel, but you'll know that already)
-
Yeah the code, with the web cam will definately be a bummer. I wonder if some cams come with dll's or controls. That would be quiet nice. And would make this not to bad.
-
this, to me, sounds like you would have to query some (if not all) of the pixels in the webcam's current image, taking into accounts some 'leeway' to account for daylight variations (shining through a window). this would take up most of a computer's CPU time. Perhaps you would be better off getting an Infra-red security sensor, and incorporating that into the assembly somewhere to trigger your events when somebody moves something.
nightmare project! :)
-
i think if ya had two still pict's, and with some percentage of error, you just could just compare the two files.
daylight wouldnt matter not by a window. ugg but still would be a processor hound.
-
anyone else know about this?