forked from opencv/opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new version of CommandLineParser. add empty docs
- Loading branch information
Showing
26 changed files
with
851 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
Command Line Parser | ||
=================== | ||
|
||
.. highlight:: cpp | ||
|
||
CommandLineParser | ||
-------- | ||
.. ocv:class:: CommandLineParser | ||
The CommandLineParser class is designed for command line arguments parsing | ||
|
||
|
||
.. ocv:function:: CommandLineParser::CommandLineParser(int argc, const char * const argv[], const std::string keys) | ||
:param argc: | ||
:param argv: | ||
:param keys: | ||
|
||
.. ocv:function:: T CommandLineParser::get<T>(const std::string& name, bool space_delete = true) | ||
:param name: | ||
:param space_delete: | ||
|
||
.. ocv:function:: T CommandLineParser::get<T>(int index, bool space_delete = true) | ||
:param index: | ||
:param space_delete: | ||
|
||
.. ocv:function:: bool CommandLineParser::has(const std::string& name) | ||
:param name: | ||
|
||
.. ocv:function:: bool CommandLineParser::check() | ||
.. ocv:function:: void CommandLineParser::about(std::string message) | ||
:param message: | ||
|
||
.. ocv:function:: void CommandLineParser::printMessage() | ||
.. ocv:function:: void CommandLineParser::printErrors() | ||
.. ocv:function:: std::string CommandLineParser::getPathToApplication() | ||
The sample below demonstrates how to use CommandLineParser: | ||
|
||
:: | ||
|
||
CommandLineParser parser(argc, argv, keys); | ||
parser.about("Application name v1.0.0"); | ||
|
||
if (parser.has("help")) | ||
{ | ||
parser.printMessage(); | ||
return 0; | ||
} | ||
|
||
int N = parser.get<int>("N"); | ||
double fps = parser.get<double>parser("fps"); | ||
std::string path = parser.get<std::string>("path"); | ||
|
||
use_time_stamp = parserer.has("timestamp"); | ||
|
||
std::string img1 = parser.get<string>(1); | ||
std::string img2 = parser.get<string>(2); | ||
|
||
int repeat = parser.get<int>(3); | ||
|
||
if (!parser.check()) | ||
{ | ||
parser.printErrors(); | ||
return 0; | ||
} | ||
|
||
Syntax: | ||
|
||
:: | ||
|
||
const std::string keys = | ||
"{help h usage ? | | print this message }" | ||
"{@image1 | | image1 for compare }" | ||
"{@image2 | | image2 for compare }" | ||
"{@repeat |1 | number }" | ||
"{path |. | path to file }" | ||
"{fps | -1.0 | fps for output video }" | ||
"{N count |100 | count of objects }" | ||
"{ts timestamp | | use time stamp }" | ||
; | ||
|
||
Use: | ||
|
||
:: | ||
|
||
# ./app -N=200 1.png 2.jpg 19 -ts | ||
|
||
# ./app -fps=aaa | ||
ERRORS: | ||
Exception: can not convert: [aaa] to [double] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.