本文整理汇总了C++中OptionParser::getDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionParser::getDescription方法的具体用法?C++ OptionParser::getDescription怎么用?C++ OptionParser::getDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionParser
的用法示例。
在下文中一共展示了OptionParser::getDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*!
* Main function.
*/
int main(int argc, char** argv) {
OptionParser parser;
parser.parse(argc, argv, CONFIG_FILE);
po::variables_map cfg = parser.getOptions();
string sInfile = "", sOutfile = "";
// Processing flags
bool bSourceIsFile = true;
bool bDestIsFile = true;
bool bUseGPU = false;
bool bThreaded = false;
unsigned int iModelFrames = DEFAULT_MODEL_TRAINING_COUNT;
double dLearningRate = DEFAULT_LEARNING_RATE;
detectionAlgorithm algo = ALGO_MOVING;
// Source video information
unsigned int iInputWidth, iInputHeight, iInputFps;
/* OPTION READ-IN BEGIN */
if(cfg.count("help")) {
cerr << parser.getDescription() << endl;
return EXIT_SUCCESS;
}
if(cfg.count("source")) {
if(cfg["source"].as<string>() == "CAM")
bSourceIsFile = false;
else if(cfg["source"].as<string>() == "DISK")
bSourceIsFile = true;
else {
cerr << ERROR("unrecognized video source") << endl;
return EXIT_FAILURE;
}
}
if(cfg.count("infile"))
sInfile.assign(cfg["infile"].as<string>());
if(cfg.count("destination")) {
if(cfg["destination"].as<string>() == "SCREEN") {
bDestIsFile = false;
sOutfile = "SCREEN";
} else if(cfg["destination"].as<string>() == "DISK")
bDestIsFile = true;
else {
cerr << ERROR("unrecognized output destination") << endl;
return EXIT_FAILURE;
}
}
if(bDestIsFile && cfg.count("outfile"))
sOutfile.assign(cfg["outfile"].as<string>());
if(cfg.count("modelframes")) {
iModelFrames = cfg["modelframes"].as<unsigned>();
if(iModelFrames == 0 || iModelFrames > 1000) {
cerr << ERROR("bad model frame count") << endl;
return EXIT_FAILURE;
}
}
if(cfg.count("learnrate")) {
dLearningRate = cfg["learnrate"].as<double>();
if(dLearningRate <= 0.0 || dLearningRate >= 1.0) {
cerr << ERROR("bad model learning rate") << endl;
return EXIT_FAILURE;
}
}
if(cfg.count("detection")) {
algo = (detectionAlgorithm)cfg["detection"].as<int>();
if(algo < ALGO_MOVING || algo > ALGO_CANDIDATESNEW) {
cerr << parser.getDescription() << endl;
return EXIT_FAILURE;
}
}
if(cfg.count("gpu"))
bUseGPU = true;
if(cfg.count("threaded"))
bThreaded = true;
/* OPTION READ-IN END */
/* FRONT END SETUP BEGIN */
VideoCapture cap;
// Try to open the video stream
if(bSourceIsFile) {
cap.open(sInfile);
} else {
cap.open(DEFAULT_CAMERA);
}
if(!cap.isOpened()) {
cerr << ERROR("could not open video source");
return EXIT_FAILURE;
//.........这里部分代码省略.........