# HG changeset patch # User Nicolas Saunier # Date 1314164067 14400 # Node ID 6f10a227486c33d3f2f3d8b41328fac27cfcd603 # Parent 8de5e8256224359ad2245c1b75cfe4f27ad3774e modifications to get nframes option working on the command line 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(&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(&videoFilename), "filename of the video to process") ("database-filename", po::value(&databaseFilename), "filename of the database where results are saved") ("homography-filename", po::value(&homographyFilename), "filename of the homography matrix") @@ -45,7 +45,7 @@ ("min-feature-displacement", po::value(&minFeatureDisplacement), "minimum displacement to keep features") ("acceleration-bound", po::value(&accelerationBound), "maximum feature acceleration") ("deviation-bound", po::value(&deviationBound), "maximum feature deviation") - ("nframes-smoothing", po::value(&nFramesSmoothing), "number of frames to smooth positions (half window)") + ("smoothing-halfwidth", po::value(&nFramesSmoothing), "number of frames to smooth positions (half window)") ("max-number-iterations", po::value(&maxNumberTrackingIterations), "maximum number of iterations to stop feature tracking") ("min-tracking-error", po::value(&minTrackingError), "minimum error to reach to stop feature tracking") ("min-feature-time", po::value(&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(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