samples: use findFile() in "cpp"
This commit is contained in:
committed by
Alexander Alekhin
parent
2fa9bd221d
commit
c4c31f5bba
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user