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
+3 -3
View File
@@ -91,7 +91,7 @@ static void help()
{
printf("\nProgram to demonstrate the use of the distance transform function between edge images.\n"
"Usage:\n"
"./distrans [image_name -- default image is ../data/stuff.jpg]\n"
"./distrans [image_name -- default image is stuff.jpg]\n"
"\nHot keys: \n"
"\tESC - quit the program\n"
"\tC - use C/Inf metric\n"
@@ -107,7 +107,7 @@ static void help()
const char* keys =
{
"{help h||}{@image |../data/stuff.jpg|input image file}"
"{help h||}{@image |stuff.jpg|input image file}"
};
int main( int argc, const char** argv )
@@ -117,7 +117,7 @@ int main( int argc, const char** argv )
if (parser.has("help"))
return 0;
string filename = parser.get<string>(0);
gray = imread(filename, 0);
gray = imread(samples::findFile(filename), 0);
if(gray.empty())
{
printf("Cannot read image file: %s\n", filename.c_str());