Ask Your Question

Revision history [back]

CommandLineParser wont parse int and bool values

Hi all, I am trying to parse command line inputs using OpenCV CommandLineParser (version 2.4.8), on Microsoft Visual Studio 2012 Pro. There is no problem with string parsing, but it wont parse int and bool values. This is the code in my main.cpp :

const char* keys =
    "{    s|  string|  123asd |string parameter}"
    "{    d|  digit |  100    |digit parameter }"
    "{    c|noCamera|false    |without camera  }"
    "{    1|        |some text|help            }"
    "{    2|        |333      |another help    }"
    ;

CommandLineParser parser(argc, argv, keys);

string s = parser.get<string>("s");
int d = parser.get<int>("d");
bool c = parser.get<bool>("c");
string one = parser.get<string>("1");
int two = parser.get<int>("2");

And this is my argument values input: -s=sss -d=123 --noCamera lena.jpg 10000

Any idea about this case?

Thanks.