Mercurial Hosting > traffic-intelligence
changeset 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 | 8de5e8256224 |
children | a3532db00c28 |
files | c/Parameters.cpp c/feature-based-tracking.cpp tracking.cfg |
diffstat | 3 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
diff -r 8de5e8256224 -r 6f10a227486c c/Parameters.cpp --- 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();
diff -r 8de5e8256224 -r 6f10a227486c c/feature-based-tracking.cpp --- a/c/feature-based-tracking.cpp Tue Aug 23 19:04:41 2011 -0400 +++ b/c/feature-based-tracking.cpp Wed Aug 24 01:34:27 2011 -0400 @@ -133,7 +133,7 @@ int key = '?'; unsigned int savedFeatureId=0; - for (int frameNum = params.frame1; ((params.frame1+frameNum < params.nFrames) || (params.nFrames < 0)) && !::interruptionKey(key); frameNum++) { + for (int frameNum = params.frame1; ((frameNum-params.frame1 < params.nFrames) || (params.nFrames < 0)) && !::interruptionKey(key); frameNum++) { capture >> frame; cout << frameNum << " " << capture.get(CV_CAP_PROP_POS_FRAMES) << " " << prevPts.size() << endl; while (frame.empty())
diff -r 8de5e8256224 -r 6f10a227486c tracking.cfg --- a/tracking.cfg Tue Aug 23 19:04:41 2011 -0400 +++ b/tracking.cfg Wed Aug 24 01:34:27 2011 -0400 @@ -42,7 +42,7 @@ # maximum feature deviation deviation-bound = 0.6 # number of frames to smooth positions (half window) -nframes-smoothing = 5 +smoothing-halfwidth = 5 # number of frames to compute velocities #nframes-velocity = 5 # maximum number of iterations to stop feature tracking