Ask Your Question
1

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

asked 2018-11-13 20:05:14 -0600

byoon gravatar image

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

berak gravatar image

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-11-13 21:24:29 -0600

Tetragramm gravatar image

This class has pretty good documentation HERE. I actually learned something looking it up just now.

In short, the brackets are because there can be more than one key, and they were lazy and didn't fill in all the things they should have, like parameter descriptions.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-11-13 20:05:14 -0600

Seen: 318 times

Last updated: Nov 14 '18