samples: use findFile() in "cpp"

This commit is contained in:
Alexander Alekhin
2018-10-31 15:48:56 +03:00
committed by Alexander Alekhin
parent 2fa9bd221d
commit c4c31f5bba
52 changed files with 359 additions and 286 deletions
+5 -9
View File
@@ -28,26 +28,22 @@ using namespace cv;
int main(int argc, char* argv[])
{
cv::CommandLineParser parser(argc, argv, "{help h||show help message}{@image|../data/lena.jpg|input image}");
cv::CommandLineParser parser(argc, argv, "{help h||show help message}{@image|lena.jpg|input image}");
if (parser.has("help"))
{
parser.printMessage();
exit(0);
}
if (parser.get<string>("@image").empty())
{
parser.printMessage();
exit(0);
return 0;
}
string filename = samples::findFile(parser.get<string>("@image"));
Mat I = imread(parser.get<string>("@image"));
Mat I = imread(filename);
int num,type;
if(I.empty())
{
cout << "Image not found" << endl;
exit(0);
return 1;
}
cout << endl;