Cosmetics.
[mtp.git] / tracker.cc
index 3a311cd..ad68c28 100644 (file)
@@ -68,7 +68,6 @@ void Tracker::set_detection_score(int time, int location, scalar_t score) {
 }
 
 void Tracker::build_graph() {
-
   // Delete existing graph
   delete[] _edge_lengths;
   delete _graph;
@@ -86,7 +85,7 @@ void Tracker::build_graph() {
 
   int nb_edges =
     _nb_locations * 2 +
-    _nb_time_steps * (nb_exits + nb_entrances) +
+    (_nb_time_steps - 2) * (nb_exits + nb_entrances) +
     (_nb_time_steps - 1) * nb_motions +
     _nb_locations * _nb_time_steps;
 
@@ -109,7 +108,6 @@ void Tracker::build_graph() {
   }
 
   // We put the other edges after
-
   for(int l = 0; l < _nb_locations; l++) {
     node_from[e] = source;
     node_to[e] = 1 + l + 0 * _nb_locations;
@@ -137,7 +135,7 @@ void Tracker::build_graph() {
     }
   }
 
-  for(int t = 0; t < _nb_time_steps; t++) {
+  for(int t = 1; t < _nb_time_steps-1; t++) {
     for(int l = 0; l < _nb_locations; l++) {
       if(_entrances[l]) {
         node_from[e] = source;
@@ -147,7 +145,7 @@ void Tracker::build_graph() {
       }
       if(_exits[l]) {
         node_from[e] =   1 + (2 * (t + 0) + 1) * _nb_locations + l;
-        node_from[e] = sink;
+        node_to[e] = sink;
         _edge_lengths[e] = 0.0;
         e++;
       }
@@ -176,6 +174,17 @@ void Tracker::track() {
 
   _graph->find_best_paths(_edge_lengths);
   _graph->retrieve_disjoint_paths();
+
+#ifdef VERBOSE
+  for(int p = 0; p < _graph->nb_paths; p++) {
+    Path *path = _graph->paths[p];
+    cout << "PATH " << p << " [length " << path->length << "] " << path->nodes[0];
+    for(int n = 1; n < path->length; n++) {
+      cout << " -> " << path->nodes[n];
+    }
+    cout << endl;
+  }
+#endif
 }
 
 int Tracker::nb_trajectories() {