X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=mtp_example.cc;fp=mtp.cc;h=13cd4f106d0e1d4a4ccca22dbdd2d8232d0ebb8d;hb=9665f6b8d842f02facda1590200742482d4362fa;hp=7f55e0a8a060cafb96d0e961dbeb1ec7dd5e5fc0;hpb=4d9b58034ce82094c233b61da247e11a584ec0bd;p=mtp.git diff --git a/mtp.cc b/mtp_example.cc similarity index 91% rename from mtp.cc rename to mtp_example.cc index 7f55e0a..13cd4f1 100644 --- a/mtp.cc +++ b/mtp_example.cc @@ -40,7 +40,9 @@ int main(int argc, char **argv) { int nb_time_steps = 8; int motion_amplitude = 1; - Tracker *tracker = new Tracker(nb_time_steps, nb_locations); + Tracker *tracker = new Tracker(); + + tracker->allocate(nb_time_steps, nb_locations); // We define the spatial structures by stating what are the possible // motions of targets, and what are the entrances and the @@ -111,6 +113,19 @@ int main(int argc, char **argv) { // Does the tracking per se + { + ofstream out_tracker("/tmp/tracker.dat"); + tracker->write(&out_tracker); + + ifstream in_tracker("/tmp/tracker.dat"); + Tracker tracker2; + tracker2.read(&in_tracker); + tracker2.build_graph(); + tracker2.track(); + ofstream out_traj("/tmp/result.trj"); + tracker2.write_trajectories(&out_traj); + } + tracker->track(); // Prints the detected trajectories