diff --git a/modules/tracking/samples/multitracker.cpp b/modules/tracking/samples/multitracker.cpp index 6a5840151..a4f8896ee 100644 --- a/modules/tracking/samples/multitracker.cpp +++ b/modules/tracking/samples/multitracker.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -66,7 +67,7 @@ int main( int argc, char** argv ){ } // timer - clock_t timer; + cvflann::StartStopTimer timer; // for showing the speed double fps; @@ -116,18 +117,23 @@ int main( int argc, char** argv ){ if(frame.rows==0 || frame.cols==0) break; - // update the tracking result - timer=clock(); + // start the timer + timer.start(); + + //update the tracking result trackers.update(frame); - timer=clock()-timer; - fps=(double)CLOCKS_PER_SEC/(double)timer; + + // calculate the processing speed + timer.stop(); + fps=1.0/timer.value; + timer.reset(); // draw the tracked object for(unsigned i=0;i