Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the third argument in CommandLineParser parser() function?

I am following a basic tutorial on image morphology from this website here. Currently running OpenCV version 3.1.0 on Microsoft Visual Studio 2017. I was able to input my own image by adding the image path to the debugging command arguments. However, this line confused me:

cv::CommandLineParser parser(argc, argv, "{help h||}{ @image | ../data/baboon.jpg | }");

I sort of understand where argc and argv came from, but what is the third input? The image they were trying to display in the sample code was a baboon, so the last part is the image path, but what are the first two parts? And why the brackets? After that line was this statement:

std::string filename = parser.get<std::string>("@image");

The filename variable was then used to open a file using the imread function, but what does that line actually do? Any help is appreciated, thanks in advance, B

click to hide/show revision 2
None

updated 2018-11-14 03:36:17 -0600

berak gravatar image

What is the third argument in CommandLineParser parser() function?

I am following a basic tutorial on image morphology from this website here. Currently running OpenCV version 3.1.0 on Microsoft Visual Studio 2017. I was able to input my own image by adding the image path to the debugging command arguments. However, this line confused me:

cv::CommandLineParser parser(argc, argv, "{help h||}{ @image | ../data/baboon.jpg | }");

}");

I sort of understand where argc and argv came from, but what is the third input? The image they were trying to display in the sample code was a baboon, so the last part is the image path, but what are the first two parts? And why the brackets? After that line was this statement:

std::string filename = parser.get<std::string>("@image");

parser.get<std::string>("@image");

The filename variable was then used to open a file using the imread function, but what does that line actually do? Any help is appreciated, thanks in advance, B