#include <fstream>
#include <sys/time.h>
#include <getopt.h>
+#include <limits.h>
#include <string.h>
using namespace std;
int verbose;
void usage(ostream *os) {
- (*os) << "mtp [-h|--help] [-v|--verbose] [-t|--trajectory-filename <trajectory filename>] [-g|--graph-filename <graph filename>] [<tracking parameter file>]" << endl;
+ (*os) << "mtp [-h|--help] [--help-formats] [-v|--verbose] [-t|--trajectory-filename <trajectory filename>] [-g|--graph-filename <graph filename>] [<tracking parameter file>]" << endl;
(*os) << endl;
(*os) << "The mtp command processes a file containing the description of a topology" << endl;
(*os) << "and detection scores, and prints the optimal set of trajectories." << endl;
- (*os) << "If no filename is provided, it will read the parameters from the stdin." << endl;
- (*os) << "If no trajectory filename is provided, it will write the result to" << endl;
- (*os) << "stdout." << endl;
+ (*os) << endl;
+ (*os) << "If no filename is provided, it reads the parameters from the standard" << endl;
+ (*os) << "input. If no trajectory filename is provided, it writes the result to" << endl;
+ (*os) << "the standard output." << endl;
(*os) << endl;
(*os) << "Written by Francois Fleuret. (C) Idiap Research Institute, 2012." << endl;
}
+void print_help_formats() {
+ cout << "The tracking parameters the command takes as input have the following" << endl;
+ cout << "format, where L is the number of locations and T is the number of time" << endl;
+ cout << "steps:" << endl;
+ cout << endl;
+ cout << "---------------------------- snip snip -------------------------------" << endl;
+ cout << " int:L int:T" << endl;
+ cout << endl;
+ cout << " bool:allowed_motion_from_1_to_1 ... bool:allowed_motion_from_1_to_L" << endl;
+ cout << " ..." << endl;
+ cout << " bool:allowed_motion_from_L_to_1 ... bool:allowed_motion_from_L_to_L" << endl;
+ cout << endl;
+ cout << " bool:entrance_1_1 ... bool:entrance_1_L" << endl;
+ cout << " ..." << endl;
+ cout << " bool:entrance_T_1 ... bool:entrance_T_L" << endl;
+ cout << endl;
+ cout << " bool:exit_1_1 ... bool:exit_1_L" << endl;
+ cout << " ..." << endl;
+ cout << " bool:exit_T_1 ... bool:exit_T_L" << endl;
+ cout << endl;
+ cout << " float:detection_score_1_1 ... float:detection_score_1_L" << endl;
+ cout << " ..." << endl;
+ cout << " float:detection_score_T_1 ... float:detection_score_T_L" << endl;
+ cout << "---------------------------- snip snip -------------------------------" << endl;
+ cout << endl;
+ cout << "As results, the command writes first the number of trajectories," << endl;
+ cout << "followed by one line per trajectory with the following structure:" << endl;
+ cout << endl;
+ cout << "---------------------------- snip snip -------------------------------" << endl;
+ cout << " int:traj_number int:entrance_time int:duration float:score int:location_1 ... int:location_duration" << endl;
+ cout << "---------------------------- snip snip -------------------------------" << endl;
+}
+
scalar_t diff_in_second(struct timeval *start, struct timeval *end) {
return
scalar_t(end->tv_sec - start->tv_sec) +
delete tracker;
}
+enum
+{
+ OPT_HELP_FORMATS = CHAR_MAX + 1
+};
+
static struct option long_options[] = {
{ "trajectory-file", 1, 0, 't' },
{ "graph-file", 1, 0, 'g' },
{ "help", no_argument, 0, 'h' },
{ "verbose", no_argument, 0, 'v' },
+ { "help-formats", no_argument, 0, OPT_HELP_FORMATS },
{ 0, 0, 0, 0 }
};
show_help = 1;
break;
+ case OPT_HELP_FORMATS:
+ print_help_formats();
+ exit(EXIT_SUCCESS);
+ break;
+
case 'v':
verbose = 1;
break;