WatershedArts / Footfall

Application that allows you to monitor the traffic in and out of your building, using the RPi Camera and openFrameworks
Other
332 stars 131 forks source link

Time between lines #46

Closed davidw212 closed 8 years ago

davidw212 commented 8 years ago

How can the time it takes blobs\people between the green\red in\out latch lines be calculated? effectively trying to figure out speed the person is walkng\running.

cool project

DHaylock commented 8 years ago

Hi @davidw212

There are two options.

You can use ofxCv's getVelocity function

or

If you make two variables in the Blobs Class.

int starttime; int endtime;

Set them to both to 0 in the setup loop. Then record the unix time using [ofGetUnixTime()] into starttime when it hits the first line (http://openframeworks.cc/documentation/utils/ofUtils/#!show_ofGetUnixTime).

just before the blob hits the second line, record the unix time again into the endtime. minus the starttime from endtime. i.e

int difftime = endtime - starttime;

That should give you the desired time.

Best