3 * mtp is the ``Multi Tracked Paths'', an implementation of the
4 * k-shortest paths algorithm for multi-target tracking.
6 * Copyright (c) 2012 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of mtp.
11 * mtp is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as
13 * published by the Free Software Foundation.
15 * mtp is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 * License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with selector. If not, see <http://www.gnu.org/licenses/>.
31 #include "mtp_tracker.h"
33 //////////////////////////////////////////////////////////////////////
35 int main(int argc, char **argv) {
36 int nb_locations = 100;
37 int nb_time_steps = 1000;
39 MTPTracker *tracker = new MTPTracker();
41 tracker->allocate(nb_time_steps, nb_locations);
43 for(int l = 0; l < nb_locations; l++) {
44 for(int m = 0; m < nb_locations; m++) {
45 tracker->allowed_motions[l][m] = (drand48() < 0.1);
49 for(int t = 0; t < nb_time_steps; t++) {
50 for(int l = 0; l < nb_locations; l++) {
51 tracker->entrances[t][l] = drand48() < 0.01;
52 tracker->exits[t][l] = drand48() < 0.01;
56 tracker->build_graph();
58 for(int t = 0; t < nb_time_steps; t++) {
59 for(int l = 0; l < nb_locations; l++) {
60 tracker->detection_scores[t][l] = scalar_t(drand48()) - 0.95f;
64 // Performs the tracking per se
68 // Prints the detected trajectories
70 for(int t = 0; t < tracker->nb_trajectories(); t++) {
73 << " starting at " << tracker->trajectory_entrance_time(t)
74 << ", duration " << tracker->trajectory_duration(t)
75 << ", score " << tracker->trajectory_score(t)
76 << ", through nodes ";
77 for(int u = 0; u < tracker->trajectory_duration(t); u++) {
78 cout << " " << tracker->trajectory_location(t, u);