From 36451319c10103590763ae59063eee8f9049325a Mon Sep 17 00:00:00 2001 From: Ivan Korolev Date: Thu, 31 Jan 2013 12:08:43 +0400 Subject: [PATCH] fixed cmd line parsing in the samples --- samples/cpp/brief_match_test.cpp | 4 ++-- samples/cpp/camshiftdemo.cpp | 2 +- samples/cpp/chamfer.cpp | 4 ++-- samples/cpp/connected_components.cpp | 2 +- samples/cpp/demhist.cpp | 2 +- samples/cpp/dft.cpp | 2 +- samples/cpp/distrans.cpp | 2 +- samples/cpp/edge.cpp | 2 +- samples/cpp/videostab.cpp | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/samples/cpp/brief_match_test.cpp b/samples/cpp/brief_match_test.cpp index 55ed2a501..dea48d38e 100644 --- a/samples/cpp/brief_match_test.cpp +++ b/samples/cpp/brief_match_test.cpp @@ -62,8 +62,8 @@ int main(int argc, const char ** argv) help(); CommandLineParser parser(argc, argv, keys); - string im1_name = parser.get(1); - string im2_name = parser.get(2); + string im1_name = parser.get(0); + string im2_name = parser.get(1); Mat im1 = imread(im1_name, CV_LOAD_IMAGE_GRAYSCALE); Mat im2 = imread(im2_name, CV_LOAD_IMAGE_GRAYSCALE); diff --git a/samples/cpp/camshiftdemo.cpp b/samples/cpp/camshiftdemo.cpp index f9f393f9e..36316e636 100644 --- a/samples/cpp/camshiftdemo.cpp +++ b/samples/cpp/camshiftdemo.cpp @@ -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(1); + int camNum = parser.get(0); cap.open(camNum); diff --git a/samples/cpp/chamfer.cpp b/samples/cpp/chamfer.cpp index 906c9542a..8a51b0bae 100644 --- a/samples/cpp/chamfer.cpp +++ b/samples/cpp/chamfer.cpp @@ -29,8 +29,8 @@ int main( int argc, const char** argv ) help(); CommandLineParser parser(argc, argv, keys); - string image = parser.get(1); - string templ = parser.get(2); + string image = parser.get(0); + string templ = parser.get(1); Mat img = imread(image.c_str(), 0); Mat tpl = imread(templ.c_str(), 0); diff --git a/samples/cpp/connected_components.cpp b/samples/cpp/connected_components.cpp index 617752b42..d20991ecd 100644 --- a/samples/cpp/connected_components.cpp +++ b/samples/cpp/connected_components.cpp @@ -48,7 +48,7 @@ int main( int argc, const char** argv ) { help(); CommandLineParser parser(argc, argv, keys); - string inputImage = parser.get("@image"); + string inputImage = parser.get(0); img = imread(inputImage.c_str(), 0); if(img.empty()) diff --git a/samples/cpp/demhist.cpp b/samples/cpp/demhist.cpp index d982ecb33..8b9189f32 100644 --- a/samples/cpp/demhist.cpp +++ b/samples/cpp/demhist.cpp @@ -70,7 +70,7 @@ int main( int argc, const char** argv ) help(); CommandLineParser parser(argc, argv, keys); - string inputImage = parser.get(1); + string inputImage = parser.get(0); // Load the source image. HighGUI use. image = imread( inputImage, 0 ); diff --git a/samples/cpp/dft.cpp b/samples/cpp/dft.cpp index 62dba20d3..d538c103e 100644 --- a/samples/cpp/dft.cpp +++ b/samples/cpp/dft.cpp @@ -24,7 +24,7 @@ int main(int argc, const char ** argv) { help(); CommandLineParser parser(argc, argv, keys); - string filename = parser.get(1); + string filename = parser.get(0); Mat img = imread(filename.c_str(), CV_LOAD_IMAGE_GRAYSCALE); if( img.empty() ) diff --git a/samples/cpp/distrans.cpp b/samples/cpp/distrans.cpp index 5e805775c..b26c0d178 100644 --- a/samples/cpp/distrans.cpp +++ b/samples/cpp/distrans.cpp @@ -111,7 +111,7 @@ int main( int argc, const char** argv ) { help(); CommandLineParser parser(argc, argv, keys); - string filename = parser.get(1); + string filename = parser.get(0); gray = imread(filename.c_str(), 0); if(gray.empty()) { diff --git a/samples/cpp/edge.cpp b/samples/cpp/edge.cpp index 8deda898b..c6a8db3b6 100644 --- a/samples/cpp/edge.cpp +++ b/samples/cpp/edge.cpp @@ -39,7 +39,7 @@ int main( int argc, const char** argv ) help(); CommandLineParser parser(argc, argv, keys); - string filename = parser.get(1); + string filename = parser.get(0); image = imread(filename, 1); if(image.empty()) diff --git a/samples/cpp/videostab.cpp b/samples/cpp/videostab.cpp index 7eb3185a4..ee967be0e 100644 --- a/samples/cpp/videostab.cpp +++ b/samples/cpp/videostab.cpp @@ -356,7 +356,7 @@ int main(int argc, const char **argv) // check if source video is specified - string inputPath = arg("1"); + string inputPath = arg(0); if (inputPath.empty()) throw runtime_error("specify video file path");