From 513b8c10f328e5868082f09063c7e51669c952c7 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 26 Aug 2012 13:42:06 +0200 Subject: [PATCH] The methods MTPTracker::write_trajectories now writes first the number of trajectories. --- README.txt | 32 ++++++++++++++++++++------------ mtp_tracker.cc | 5 +++-- mtp_tracker.h | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/README.txt b/README.txt index 708fea6..3d93234 100644 --- a/README.txt +++ b/README.txt @@ -74,27 +74,35 @@ The edges from the source or to the sink, or between these pairs, are of length zero, and the edge between the two nodes of such a pair has a length equal to the opposite of the detection score. -The file mtp.cc gives a very simple usage example of the MTPTracker -class. +The file mtp_example.cc gives a very simple usage example of the +MTPTracker class by setting the tracker parameters dynamically, and +running the tracking. -The tracker data file one can read with MTPTracker::read has the -following format (with L the number of locations and T the number of -time steps): +The tracker data file for MTPTracker::read has the following format, +where L is the number of locations and T is the number of time steps: ---------------------------- snip snip ------------------------------- -L T +int:L int:T -allowed_motion_from_1_to_1 ... allowed_motion_from_1_to_L +bool:allowed_motion_from_1_to_1 ... bool:allowed_motion_from_1_to_L ... -allowed_motion_from_L_to_1 ... allowed_motion_from_L_to_L +bool:allowed_motion_from_L_to_1 ... bool:allowed_motion_from_L_to_L -is_an_entrance_1 ... is_an_entrance_L +bool:is_an_entrance_1 ... bool:is_an_entrance_L -is_an_exit_1 ... is_an_exit_L +bool:is_an_exit_1 ... bool:is_an_exit_L -detection_score_1_1 ... detection_score_1_L +float:detection_score_1_1 ... float:detection_score_1_L ... -detection_score_T_1 ... detection_score_T_L +float:detection_score_T_1 ... float:detection_score_T_L +---------------------------- snip snip ------------------------------- + +The method MTPTracker::write_trajectories writes first the number of +trajectories, followed by one line per trajectory with the following +structure + +---------------------------- snip snip ------------------------------- +int:traj_number int:entrance_time int:duration float:score int:location_1 ... int:location_duration ---------------------------- snip snip ------------------------------- -- diff --git a/mtp_tracker.cc b/mtp_tracker.cc index af97ca5..825b4d1 100644 --- a/mtp_tracker.cc +++ b/mtp_tracker.cc @@ -132,6 +132,7 @@ void MTPTracker::read(istream *is) { } void MTPTracker::write_trajectories(ostream *os) { + (*os) << nb_trajectories() << endl; for(int t = 0; t < nb_trajectories(); t++) { (*os) << t << " " << trajectory_entrance_time(t) @@ -168,11 +169,11 @@ MTPTracker::~MTPTracker() { } int MTPTracker::early_pair_node(int t, int l) { - return 1 + (2 * (t + 0) + 0) * _nb_locations + l; + return 1 + (2 * t + 0) * _nb_locations + l; } int MTPTracker::late_pair_node(int t, int l) { - return 1 + (2 * (t + 0) + 1) * _nb_locations + l; + return 1 + (2 * t + 1) * _nb_locations + l; } void MTPTracker::build_graph() { diff --git a/mtp_tracker.h b/mtp_tracker.h index 08de498..9574332 100644 --- a/mtp_tracker.h +++ b/mtp_tracker.h @@ -50,7 +50,7 @@ public: int **allowed_motion; int *entrances, *exits; - // The detection scores at each node + // The detection scores at each location and time scalar_t **detection_scores; MTPTracker(); -- 2.39.5