Mercurial > hg > nsaunier > traffic-intelligence
comparison c/Parameters.cpp @ 348:c64a4f889b97
added safety analysis options to feature tracking (with default values for backward compatibility)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 26 Jun 2013 18:40:31 -0400 |
| parents | f21ef87f98f1 |
| children | e3f910c26fae |
comparison
equal
deleted
inserted
replaced
| 347:7b865f4174aa | 348:c64a4f889b97 |
|---|---|
| 16 // configuration filename | 16 // configuration filename |
| 17 onlyCmdLine.add_options() | 17 onlyCmdLine.add_options() |
| 18 ("help,h", "displays this help message") | 18 ("help,h", "displays this help message") |
| 19 ("tf", "tracks features") | 19 ("tf", "tracks features") |
| 20 ("gf", "groups features") | 20 ("gf", "groups features") |
| 21 ("config-file", po::value<string>(&configurationFilename)->default_value("tracking.cfg"), "configuration file") | 21 ("config-file", po::value<string>(&configurationFilename), "configuration file") |
| 22 ; | 22 ; |
| 23 | 23 |
| 24 po::positional_options_description p; | 24 po::positional_options_description p; |
| 25 p.add("config-file", 1); | 25 p.add("config-file", 1); |
| 26 | 26 |
| 54 ("mm-connection-distance", po::value<float>(&mmConnectionDistance), "connection distance in feature grouping") | 54 ("mm-connection-distance", po::value<float>(&mmConnectionDistance), "connection distance in feature grouping") |
| 55 ("mm-segmentation-distance", po::value<float>(&mmSegmentationDistance), "segmentation distance in feature grouping") | 55 ("mm-segmentation-distance", po::value<float>(&mmSegmentationDistance), "segmentation distance in feature grouping") |
| 56 ("max-distance", po::value<float>(&maxDistance), "maximum distance between features for grouping") | 56 ("max-distance", po::value<float>(&maxDistance), "maximum distance between features for grouping") |
| 57 ("min-velocity-cosine", po::value<float>(&minVelocityCosine), "minimum cosine of the angle between the velocity vectors for grouping") | 57 ("min-velocity-cosine", po::value<float>(&minVelocityCosine), "minimum cosine of the angle between the velocity vectors for grouping") |
| 58 ("min-nfeatures-group", po::value<float>(&minNFeaturesPerGroup), "minimum average number of features per frame to create a vehicle hypothesis") | 58 ("min-nfeatures-group", po::value<float>(&minNFeaturesPerGroup), "minimum average number of features per frame to create a vehicle hypothesis") |
| 59 ; | |
| 60 // ("max-uturn-cosine", po::value<float>(&maxUTurnCosine), "maximum cosine value to detect U-turn") | 59 // ("max-uturn-cosine", po::value<float>(&maxUTurnCosine), "maximum cosine value to detect U-turn") |
| 61 // ("nframes-avoid-uturn", po::value<int>(&nFramesAvoidUTurn), "number of frames over which a feature should not make a U-turn") | 60 // ("nframes-avoid-uturn", po::value<int>(&nFramesAvoidUTurn), "number of frames over which a feature should not make a U-turn") |
| 62 | 61 // Safety Analysis |
| 63 | 62 ("max-predicted-speed", po::value<float>(&maxPredictedSpeed)->default_value(50.), "maximum speed when predicting future motion (km/h)") |
| 63 ("prediction-time-horizon", po::value<float>(&predictionTimeHorizon)->default_value(5.), "time horizon for collision prediction (s)") | |
| 64 ("collision-distance", po::value<float>(&collisionDistance)->default_value(1.8), "collision distance threshold (m)") | |
| 65 ("crossing-zones", po::value<bool>(&crossingZones)->default_value(false), "option to compute crossing zones and predicted PET") | |
| 66 ; | |
| 67 | |
| 64 po::options_description cmdLine; | 68 po::options_description cmdLine; |
| 65 cmdLine.add(onlyCmdLine).add(cmdLineAndFile); | 69 cmdLine.add(onlyCmdLine).add(cmdLineAndFile); |
| 66 try { | 70 try { |
| 67 po::variables_map vm; | 71 po::variables_map vm; |
| 68 store(po::command_line_parser(argc, argv). | 72 store(po::command_line_parser(argc, argv). |
| 69 options(cmdLine).positional(p).allow_unregistered().run(), vm); | 73 options(cmdLine).positional(p).allow_unregistered().run(), vm); |
| 70 notify(vm); | 74 notify(vm); |
| 71 | 75 |
| 76 if (vm.count("config-file") == 0) { | |
| 77 cout << "Missing configuration file" << endl; | |
| 78 cout << cmdLine << endl; | |
| 79 exit(0); | |
| 80 } | |
| 81 | |
| 72 cout << "Using configuration file " << configurationFilename << endl; | 82 cout << "Using configuration file " << configurationFilename << endl; |
| 73 | 83 |
| 74 ifstream configurationFile(configurationFilename.c_str()); | 84 ifstream configurationFile(configurationFilename.c_str()); |
| 75 store(po::parse_config_file(configurationFile, cmdLineAndFile), vm); | 85 store(po::parse_config_file(configurationFile, cmdLineAndFile, true), vm); |
| 76 notify(vm); | 86 notify(vm); |
| 77 | 87 |
| 78 parameterDescription = getParameterDescription(cmdLineAndFile, vm); | 88 parameterDescription = getParameterDescription(cmdLineAndFile, vm); |
| 79 | 89 |
| 80 trackFeatures = vm.count("tf")>0; | 90 trackFeatures = vm.count("tf")>0; |
