Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ctime returns a string not a double, so your measurement is bs.

then, time() returns time in seconds, imho, you need a much finer grained measurement here

also, (90/1489755120)= 6.041261e-8 (so, next to nothing) and this would be pixels per second, not very useful..

do the following:

measure out, how much distance in the real world is covered between your 2 lines in the image

then:

// measure at 1st line crossed
int64 t0 = cv::getTickCount();

// measure at 2nd line crossed
int64 t1 = cv::getTickCount();
double seconds = (t1 - t0) / cv::getTickCount();

double speed = real_distance / speed; // in meters per second.