X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=mtp.cc;h=61dcc21692df4a0e69b9e315e8abc66998697683;hb=86c860c0f43a9130e4121072620961fc892ed83f;hp=60e15db7f6724646a391fc0d9bc531e2395cba02;hpb=68d9c4f175f774d851a32f6069ad04b31924bfac;p=mtp.git diff --git a/mtp.cc b/mtp.cc index 60e15db..61dcc21 100644 --- a/mtp.cc +++ b/mtp.cc @@ -1,7 +1,7 @@ /* - * mtp is the ``Multi Tracked Path'', an implementation of the - * k-shortest path algorithm for multi-target tracking. + * mtp is the ``Multi Tracked Paths'', an implementation of the + * k-shortest paths algorithm for multi-target tracking. * * Copyright (c) 2012 Idiap Research Institute, http://www.idiap.ch/ * Written by Francois Fleuret @@ -22,16 +22,22 @@ * */ -// Multi-Tracked Path - #include #include +#include using namespace std; -#include "tracker.h" +#include "mtp_tracker.h" + +scalar_t diff_in_second(struct timeval *start, struct timeval *end) { + return + scalar_t(end->tv_sec - start->tv_sec) + + scalar_t(end->tv_usec - start->tv_usec)/1000000; +} int main(int argc, char **argv) { + timeval start_time, end_time; if(argc < 2) { cerr << argv[0] << " " << endl; @@ -42,13 +48,22 @@ int main(int argc, char **argv) { if(in_tracker->good()) { - Tracker *tracker = new Tracker(); + MTPTracker *tracker = new MTPTracker(); + cout << "Reading " << argv[1] << "." << endl; tracker->read(in_tracker); - cout << "Read " << argv[1] << endl; + cout << "Building the graph ... "; cout.flush(); + gettimeofday(&start_time, 0); tracker->build_graph(); + gettimeofday(&end_time, 0); + cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl; + + cout << "Tracking ... "; cout.flush(); + gettimeofday(&start_time, 0); tracker->track(); + gettimeofday(&end_time, 0); + cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl; ofstream out_traj("result.trj"); tracker->write_trajectories(&out_traj);