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
+6 -6
View File
@@ -14,7 +14,7 @@ static void help()
<< "with surrounding image areas.\n"
"Using OpenCV version %s\n" << CV_VERSION << "\n"
"Usage:\n"
"./inpaint [image_name -- Default ../data/fruits.jpg]\n" << endl;
"./inpaint [image_name -- Default fruits.jpg]\n" << endl;
cout << "Hot keys: \n"
"\tESC - quit the program\n"
@@ -47,24 +47,24 @@ static void onMouse( int event, int x, int y, int flags, void* )
int main( int argc, char** argv )
{
cv::CommandLineParser parser(argc, argv, "{@image|../data/fruits.jpg|}");
cv::CommandLineParser parser(argc, argv, "{@image|fruits.jpg|}");
help();
string filename = parser.get<string>("@image");
Mat img0 = imread(filename, -1);
string filename = samples::findFile(parser.get<string>("@image"));
Mat img0 = imread(filename, IMREAD_COLOR);
if(img0.empty())
{
cout << "Couldn't open the image " << filename << ". Usage: inpaint <image_name>\n" << endl;
return 0;
}
namedWindow( "image", 1 );
namedWindow("image", WINDOW_AUTOSIZE);
img = img0.clone();
inpaintMask = Mat::zeros(img.size(), CV_8U);
imshow("image", img);
setMouseCallback( "image", onMouse, 0 );
setMouseCallback( "image", onMouse, NULL);
for(;;)
{