Mercurial Hosting > traffic-intelligence
diff c/Parameters.cpp @ 141:6f10a227486c
modifications to get nframes option working on the command line
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 24 Aug 2011 01:34:27 -0400 |
parents | 445e773c9be3 |
children | 76610dcf3b8d |
line wrap: on
line diff
--- a/c/Parameters.cpp Tue Aug 23 19:04:41 2011 -0400 +++ b/c/Parameters.cpp Wed Aug 24 01:34:27 2011 -0400 @@ -15,6 +15,7 @@ // configuration filename onlyCmdLine.add_options() + ("help,h", "displays this help message") ("config-file", po::value<string>(&configurationFilename)->default_value("tracking.cfg"), "configuration file") ; @@ -23,7 +24,6 @@ // common to cnnfiguration and command line cmdLineAndFile.add_options() - ("help,h", "displays this help message") ("video-filename", po::value<string>(&videoFilename), "filename of the video to process") ("database-filename", po::value<string>(&databaseFilename), "filename of the database where results are saved") ("homography-filename", po::value<string>(&homographyFilename), "filename of the homography matrix") @@ -45,7 +45,7 @@ ("min-feature-displacement", po::value<float>(&minFeatureDisplacement), "minimum displacement to keep features") ("acceleration-bound", po::value<float>(&accelerationBound), "maximum feature acceleration") ("deviation-bound", po::value<float>(&deviationBound), "maximum feature deviation") - ("nframes-smoothing", po::value<int>(&nFramesSmoothing), "number of frames to smooth positions (half window)") + ("smoothing-halfwidth", po::value<int>(&nFramesSmoothing), "number of frames to smooth positions (half window)") ("max-number-iterations", po::value<int>(&maxNumberTrackingIterations), "maximum number of iterations to stop feature tracking") ("min-tracking-error", po::value<float>(&minTrackingError), "minimum error to reach to stop feature tracking") ("min-feature-time", po::value<unsigned int>(&minFeatureTime), "minimum length of a feature (number of frames) to consider a feature for grouping") @@ -67,6 +67,14 @@ options(cmdLine).positional(p).allow_unregistered().run(), vm); notify(vm); + cout << "Using configuration file " << configurationFilename << endl; + + ifstream configurationFile(configurationFilename.c_str()); + store(po::parse_config_file(configurationFile, cmdLineAndFile), vm); + notify(vm); + + parameterDescription = getParameterDescription(cmdLineAndFile, vm); + if (vm.count("help")) { cout << cmdLine << endl; // cout << "Positional options:"; @@ -75,13 +83,6 @@ // cout << endl; exit(0); } - cout << "Using configuration file " << configurationFilename << endl; - - ifstream configurationFile(configurationFilename.c_str()); - store(po::parse_config_file(configurationFile, cmdLineAndFile), vm); - notify(vm); - - parameterDescription = getParameterDescription(cmdLine, vm); } catch(exception& e) { cout << e.what() << endl; } @@ -103,7 +104,7 @@ else if (value.type() == typeid(string)) stream << boost::any_cast<string>(value) << separator; else - cerr << "the type of the option variable " << i << " is not int, float or string." << endl; + cerr << "the type of the option " << optionsVec[i]->long_name() << " (" << i << ") is not int, float or string." << endl; } return stream.str();