add new version of CommandLineParser. add empty docs
This commit is contained in:
@@ -18,8 +18,8 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{c |camera |true | use camera or not}"
|
||||
"{fn|file_name|tree.avi | movie file }"
|
||||
"{c camera | | use camera or not}"
|
||||
"{fn file_name|tree.avi | movie file }"
|
||||
};
|
||||
|
||||
//this is a sample for foreground detection functions
|
||||
@@ -28,7 +28,7 @@ int main(int argc, const char** argv)
|
||||
help();
|
||||
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
bool useCamera = parser.get<bool>("camera");
|
||||
bool useCamera = parser.has("camera");
|
||||
string file = parser.get<string>("file_name");
|
||||
VideoCapture cap;
|
||||
bool update_bg_model = true;
|
||||
@@ -37,7 +37,8 @@ int main(int argc, const char** argv)
|
||||
cap.open(0);
|
||||
else
|
||||
cap.open(file.c_str());
|
||||
parser.printParams();
|
||||
|
||||
parser.printMessage();
|
||||
|
||||
if( !cap.isOpened() )
|
||||
{
|
||||
|
@@ -53,8 +53,8 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |box.png |the first image}"
|
||||
"{2| |box_in_scene.png|the second image}"
|
||||
"{@first_image | box.png | the first image}"
|
||||
"{@second_image | box_in_scene.png | the second image}"
|
||||
};
|
||||
|
||||
int main(int argc, const char ** argv)
|
||||
@@ -62,8 +62,8 @@ int main(int argc, const char ** argv)
|
||||
|
||||
help();
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string im1_name = parser.get<string>("1");
|
||||
string im2_name = parser.get<string>("2");
|
||||
string im1_name = parser.get<string>(1);
|
||||
string im2_name = parser.get<string>(2);
|
||||
|
||||
Mat im1 = imread(im1_name, CV_LOAD_IMAGE_GRAYSCALE);
|
||||
Mat im2 = imread(im2_name, CV_LOAD_IMAGE_GRAYSCALE);
|
||||
@@ -72,7 +72,7 @@ int main(int argc, const char ** argv)
|
||||
{
|
||||
cout << "could not open one of the images..." << endl;
|
||||
cout << "the cmd parameters have next current value: " << endl;
|
||||
parser.printParams();
|
||||
parser.printMessage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -64,7 +64,7 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| | 0 | camera number}"
|
||||
"{@camera_number| 0 | camera number}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
@@ -77,7 +77,7 @@ int main( int argc, const char** argv )
|
||||
float hranges[] = {0,180};
|
||||
const float* phranges = hranges;
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
int camNum = parser.get<int>("1");
|
||||
int camNum = parser.get<int>(1);
|
||||
|
||||
cap.open(camNum);
|
||||
|
||||
@@ -86,7 +86,7 @@ int main( int argc, const char** argv )
|
||||
help();
|
||||
cout << "***Could not initialize capturing...***\n";
|
||||
cout << "Current parameter's value: \n";
|
||||
parser.printParams();
|
||||
parser.printMessage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,8 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |logo_in_clutter.png|image edge map }"
|
||||
"{2| |logo.png |template edge map}"
|
||||
"{@logo1 |logo_in_clutter.png |image edge map }"
|
||||
"{@logo2 |logo.png |template edge map}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
@@ -29,8 +29,8 @@ int main( int argc, const char** argv )
|
||||
help();
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
|
||||
string image = parser.get<string>("1");
|
||||
string templ = parser.get<string>("2");
|
||||
string image = parser.get<string>(1);
|
||||
string templ = parser.get<string>(2);
|
||||
Mat img = imread(image.c_str(), 0);
|
||||
Mat tpl = imread(templ.c_str(), 0);
|
||||
|
||||
|
@@ -45,14 +45,14 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |stuff.jpg|image for converting to a grayscale}"
|
||||
"{@image |stuff.jpg|image for converting to a grayscale}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string inputImage = parser.get<string>("1");
|
||||
string inputImage = parser.get<string>(1);
|
||||
img = imread(inputImage.c_str(), 0);
|
||||
|
||||
if(img.empty())
|
||||
|
@@ -62,7 +62,7 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |baboon.jpg|input image file}"
|
||||
"{@image|baboon.jpg|input image file}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
@@ -70,7 +70,7 @@ int main( int argc, const char** argv )
|
||||
help();
|
||||
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string inputImage = parser.get<string>("1");
|
||||
string inputImage = parser.get<string>(1);
|
||||
|
||||
// Load the source image. HighGUI use.
|
||||
image = imread( inputImage, 0 );
|
||||
|
@@ -17,14 +17,14 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |lena.jpg|input image file}"
|
||||
"{@image|lena.jpg|input image file}"
|
||||
};
|
||||
|
||||
int main(int argc, const char ** argv)
|
||||
{
|
||||
help();
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string filename = parser.get<string>("1");
|
||||
string filename = parser.get<string>(1);
|
||||
|
||||
Mat img = imread(filename.c_str(), CV_LOAD_IMAGE_GRAYSCALE);
|
||||
if( img.empty() )
|
||||
|
@@ -104,14 +104,14 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |stuff.jpg|input image file}"
|
||||
"{@image |stuff.jpg|input image file}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string filename = parser.get<string>("1");
|
||||
string filename = parser.get<string>(1);
|
||||
gray = imread(filename.c_str(), 0);
|
||||
if(gray.empty())
|
||||
{
|
||||
|
@@ -31,7 +31,7 @@ static void help()
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{1| |fruits.jpg|input image name}"
|
||||
"{@image |fruits.jpg|input image name}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
@@ -39,7 +39,7 @@ int main( int argc, const char** argv )
|
||||
help();
|
||||
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string filename = parser.get<string>("1");
|
||||
string filename = parser.get<string>(1);
|
||||
|
||||
image = imread(filename, 1);
|
||||
if(image.empty())
|
||||
|
@@ -3,19 +3,23 @@
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{ b |build |false | print complete build info }"
|
||||
"{ h |help |false | print this help }"
|
||||
"{ b build | | print complete build info }"
|
||||
"{ h help | | print this help }"
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
cv::CommandLineParser parser(argc, argv, keys);
|
||||
|
||||
if (parser.get<bool>("help"))
|
||||
if (parser.has("help"))
|
||||
{
|
||||
parser.printParams();
|
||||
parser.printMessage();
|
||||
}
|
||||
else if (parser.get<bool>("build"))
|
||||
else if (!parser.check())
|
||||
{
|
||||
parser.printErrors();
|
||||
}
|
||||
else if (parser.has("build"))
|
||||
{
|
||||
std::cout << cv::getBuildInformation() << std::endl;
|
||||
}
|
||||
@@ -25,4 +29,4 @@ int main(int argc, const char* argv[])
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -64,20 +64,19 @@ static void openGlDrawCallback(void* userdata)
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
const char* keys =
|
||||
"{ l | left | | left image file name }"
|
||||
"{ r | right | | right image file name }"
|
||||
"{ i | intrinsic | | intrinsic camera parameters file name }"
|
||||
"{ e | extrinsic | | extrinsic camera parameters file name }"
|
||||
"{ d | ndisp | 256 | number of disparities }"
|
||||
"{ s | scale | 1.0 | scale factor for point cloud }"
|
||||
"{ h | help | false | print help message }";
|
||||
"{ l left | | left image file name }"
|
||||
"{ r right | | right image file name }"
|
||||
"{ i intrinsic | | intrinsic camera parameters file name }"
|
||||
"{ e extrinsic | | extrinsic camera parameters file name }"
|
||||
"{ d ndisp | 256 | number of disparities }"
|
||||
"{ s scale | 1.0 | scale factor for point cloud }"
|
||||
"{ h help | | print help message }";
|
||||
|
||||
CommandLineParser cmd(argc, argv, keys);
|
||||
|
||||
if (cmd.get<bool>("help"))
|
||||
if (cmd.has("help"))
|
||||
{
|
||||
cout << "Avaible options:" << endl;
|
||||
cmd.printParams();
|
||||
cmd.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -88,11 +87,18 @@ int main(int argc, const char* argv[])
|
||||
int ndisp = cmd.get<int>("ndisp");
|
||||
double scale = cmd.get<double>("scale");
|
||||
|
||||
if (!cmd.check())
|
||||
{
|
||||
cmd.printErrors();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (left.empty() || right.empty())
|
||||
{
|
||||
cout << "Missed input images" << endl;
|
||||
cout << "Avaible options:" << endl;
|
||||
cmd.printParams();
|
||||
cmd.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,7 +106,7 @@ int main(int argc, const char* argv[])
|
||||
{
|
||||
cout << "Boss camera parameters must be specified" << endl;
|
||||
cout << "Avaible options:" << endl;
|
||||
cmd.printParams();
|
||||
cmd.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -281,56 +281,56 @@ int main(int argc, const char **argv)
|
||||
try
|
||||
{
|
||||
const char *keys =
|
||||
"{ 1 | | | | }"
|
||||
"{ m | model | affine | }"
|
||||
"{ lp | lin-prog-motion-est | no | }"
|
||||
"{ | subset | auto | }"
|
||||
"{ | thresh | auto | }"
|
||||
"{ | outlier-ratio | 0.5 | }"
|
||||
"{ | min-inlier-ratio | 0.1 | }"
|
||||
"{ | nkps | 1000 | }"
|
||||
"{ | extra-kps | 0 | }"
|
||||
"{ | local-outlier-rejection | no | }"
|
||||
"{ sm | save-motions | no | }"
|
||||
"{ lm | load-motions | no | }"
|
||||
"{ r | radius | 15 | }"
|
||||
"{ | stdev | auto | }"
|
||||
"{ lps | lin-prog-stab | no | }"
|
||||
"{ | lps-trim-ratio | auto | }"
|
||||
"{ | lps-w1 | 1 | }"
|
||||
"{ | lps-w2 | 10 | }"
|
||||
"{ | lps-w3 | 100 | }"
|
||||
"{ | lps-w4 | 100 | }"
|
||||
"{ | deblur | no | }"
|
||||
"{ | deblur-sens | 0.1 | }"
|
||||
"{ et | est-trim | yes | }"
|
||||
"{ t | trim-ratio | 0.1 | }"
|
||||
"{ ic | incl-constr | no | }"
|
||||
"{ bm | border-mode | replicate | }"
|
||||
"{ | mosaic | no | }"
|
||||
"{ ms | mosaic-stdev | 10.0 | }"
|
||||
"{ mi | motion-inpaint | no | }"
|
||||
"{ | mi-dist-thresh | 5.0 | }"
|
||||
"{ ci | color-inpaint | no | }"
|
||||
"{ | ci-radius | 2 | }"
|
||||
"{ ws | wobble-suppress | no | }"
|
||||
"{ | ws-period | 30 | }"
|
||||
"{ | ws-model | homography | }"
|
||||
"{ | ws-subset | auto | }"
|
||||
"{ | ws-thresh | auto | }"
|
||||
"{ | ws-outlier-ratio | 0.5 | }"
|
||||
"{ | ws-min-inlier-ratio | 0.1 | }"
|
||||
"{ | ws-nkps | 1000 | }"
|
||||
"{ | ws-extra-kps | 0 | }"
|
||||
"{ | ws-local-outlier-rejection | no | }"
|
||||
"{ | ws-lp | no | }"
|
||||
"{ sm2 | save-motions2 | no | }"
|
||||
"{ lm2 | load-motions2 | no | }"
|
||||
"{ gpu | | no }"
|
||||
"{ o | output | stabilized.avi | }"
|
||||
"{ | fps | auto | }"
|
||||
"{ q | quiet | false | }"
|
||||
"{ h | help | false | }";
|
||||
"{ @1 | | }"
|
||||
"{ m model | affine | }"
|
||||
"{ lp lin-prog-motion-est | no | }"
|
||||
"{ subset | auto | }"
|
||||
"{ thresh | auto | }"
|
||||
"{ outlier-ratio | 0.5 | }"
|
||||
"{ min-inlier-ratio | 0.1 | }"
|
||||
"{ nkps | 1000 | }"
|
||||
"{ extra-kps | 0 | }"
|
||||
"{ local-outlier-rejection | no | }"
|
||||
"{ sm save-motions | no | }"
|
||||
"{ lm load-motions | no | }"
|
||||
"{ r radius | 15 | }"
|
||||
"{ stdev | auto | }"
|
||||
"{ lps lin-prog-stab | no | }"
|
||||
"{ lps-trim-ratio | auto | }"
|
||||
"{ lps-w1 | 1 | }"
|
||||
"{ lps-w2 | 10 | }"
|
||||
"{ lps-w3 | 100 | }"
|
||||
"{ lps-w4 | 100 | }"
|
||||
"{ deblur | no | }"
|
||||
"{ deblur-sens | 0.1 | }"
|
||||
"{ et est-trim | yes | }"
|
||||
"{ t trim-ratio | 0.1 | }"
|
||||
"{ ic incl-constr | no | }"
|
||||
"{ bm border-mode | replicate | }"
|
||||
"{ mosaic | no | }"
|
||||
"{ ms mosaic-stdev | 10.0 | }"
|
||||
"{ mi motion-inpaint | no | }"
|
||||
"{ mi-dist-thresh | 5.0 | }"
|
||||
"{ ci color-inpaint | no | }"
|
||||
"{ ci-radius | 2 | }"
|
||||
"{ ws wobble-suppress | no | }"
|
||||
"{ ws-period | 30 | }"
|
||||
"{ ws-model | homography | }"
|
||||
"{ ws-subset | auto | }"
|
||||
"{ ws-thresh | auto | }"
|
||||
"{ ws-outlier-ratio | 0.5 | }"
|
||||
"{ ws-min-inlier-ratio | 0.1 | }"
|
||||
"{ ws-nkps | 1000 | }"
|
||||
"{ ws-extra-kps | 0 | }"
|
||||
"{ ws-local-outlier-rejection | no | }"
|
||||
"{ ws-lp | no | }"
|
||||
"{ sm2 save-motions2 | no | }"
|
||||
"{ lm2 load-motions2 | no | }"
|
||||
"{ gpu | no | }"
|
||||
"{ o output | stabilized.avi | }"
|
||||
"{ fps | auto | }"
|
||||
"{ q quiet | | }"
|
||||
"{ h help | | }";
|
||||
CommandLineParser cmd(argc, argv, keys);
|
||||
|
||||
// parse command arguments
|
||||
|
Reference in New Issue
Block a user