From: Francois Fleuret Date: Sat, 25 Aug 2012 05:38:56 +0000 (+0200) Subject: Cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0f008effb41b45dd5ae2d51ec98a59cce81c7c3;p=mtp.git Cosmetics. --- diff --git a/README.txt b/README.txt index e814024..793710b 100644 --- a/README.txt +++ b/README.txt @@ -10,15 +10,26 @@ paths to a constant K. * INSTALLATION -This source code should compile with any C++ compiler. Just run "make" -and execute the mtp executable. It should print the optimal detected -trajectories, and save into graph.dot the result graph and -trajectories in the dot syntax. You can produce a pdf from the latter -with +This source code should compile with any C++ compiler. Just execute + + make + ./mtp_example + +It will create a synthetic dummy example, save its description in +tracker.dat, and print the optimal detected trajectories. + +If you now execute + + ./mtp tracker.dat + +It will load the tracker.dat example, run the detection, save the +detected trajectories in result.trj, and the underlying graph with +occupied edges in graph.dot. You can produce a pdf from the latter +with the dot command from graphviz: dot < graph.dot -T pdf -o graph.pdf -* DESCRIPTION +* IMPLEMENTATION The two main classes are MTPGraph and Tracker. diff --git a/mtp.cc b/mtp.cc index f2db0c6..62ab56a 100644 --- a/mtp.cc +++ b/mtp.cc @@ -32,25 +32,27 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - Tracker tracker; + ifstream *in_tracker = new ifstream(argv[1]); - ifstream in_tracker(argv[1]); + if(in_tracker->good()) { - if(in_tracker.good()) { + Tracker *tracker = new Tracker(); - tracker.read(&in_tracker); - tracker.build_graph(); - tracker.track(); + tracker->read(in_tracker); + tracker->build_graph(); + tracker->track(); cout << "Read " << argv[1] << endl; ofstream out_traj("result.trj"); - tracker.write_trajectories(&out_traj); + tracker->write_trajectories(&out_traj); cout << "Wrote result.trj" << endl; ofstream out_dot("graph.dot"); - tracker.print_graph_dot(&out_dot); + tracker->print_graph_dot(&out_dot); cout << "Wrote graph.dot" << endl; + delete tracker; + } else { cerr << "Can not open " << argv[1] << endl; @@ -58,5 +60,7 @@ int main(int argc, char **argv) { } + delete in_tracker; + exit(EXIT_SUCCESS); } diff --git a/mtp_example.cc b/mtp_example.cc index 4d2ac63..52bc400 100644 --- a/mtp_example.cc +++ b/mtp_example.cc @@ -111,10 +111,12 @@ int main(int argc, char **argv) { tracker->detection_scores[t][lb] = sb; } - // Does the tracking per se + { // Write down the tracker setting + ofstream out_tracker("tracker.dat"); + tracker->write(&out_tracker); + } - ofstream out_tracker("tracker.dat"); - tracker->write(&out_tracker); + // Does the tracking per se tracker->track();