|
Keeping Track of time? Anonymous |
16 year
|
Hello again,
I'm not a very proficient programmer, in any language! huzzah!
I am interested in keeping track of the amount of time a certain moving blob of pixels is on screen for?
I already have the segmentation worked out alright with optical flow and the motion detection module....
How can then count how long this "object" is around for and keep track of this information
I would also like to know how many times it moves from one side of the screen to the other ?
|
|
|
Anonymous |
16 year
|
This will require a little VBScript ... you can add the following code that will time the presence of an object after the motion detection module runs. The robofile below uses just the motion detection module to do this test and should run as is on any webcam. You should be able to add any modules before that one in order to do different detection methods.
' variable created by motion module
movement = GetVariable("MOVEMENT_PERCENT")
' if the movement is larger than 5 percent assume something is moving
if movement > 5 then
' initialize the start time that the object was first detected
if GetVariable("START_TIME") = 0 then
SetVariable "START_TIME", Timer
end if
else
' assume that if no movement is detected that the object has gone
' note that we do not just use < 5 to allow for the object to slow down
' without triggering the object gone condition
if movement = 0 then
' object has disappeared
startTime = GetVariable("START_TIME")
' if the start time is not zero we detected an object
if startTime <> 0 then
SetVariable "LAST_OBJECT_TIME", (Timer-startTime)
SetVariable "START_TIME", 0
end if
end if
end if
program.robo
|
|
|
Anonymous |
16 year
|
thanks so much, I did it another, stranger way that makes no sense after seeing yours.
|
|