samples: use findFile() in "cpp"
This commit is contained in:
committed by
Alexander Alekhin
parent
2fa9bd221d
commit
c4c31f5bba
@@ -8,17 +8,27 @@ using namespace cv;
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
CommandLineParser parser(argc, argv,
|
||||
"{ i | ../data/lena_tmpl.jpg |image name }"
|
||||
"{ t | ../data/tmpl.png |template name }"
|
||||
"{ m | ../data/mask.png |mask name }"
|
||||
"{ i | lena_tmpl.jpg |image name }"
|
||||
"{ t | tmpl.png |template name }"
|
||||
"{ m | mask.png |mask name }"
|
||||
"{ cm| 3 |comparison method }");
|
||||
|
||||
cout << "This program demonstrates the use of template matching with mask.\n\n";
|
||||
cout << "This program demonstrates the use of template matching with mask." << endl
|
||||
<< endl
|
||||
<< "Available methods: https://docs.opencv.org/3.4/df/dfb/group__imgproc__object.html#ga3a7850640f1fe1f58fe91a2d7583695d" << endl
|
||||
<< " TM_SQDIFF = " << (int)TM_SQDIFF << endl
|
||||
<< " TM_SQDIFF_NORMED = " << (int)TM_SQDIFF_NORMED << endl
|
||||
<< " TM_CCORR = " << (int)TM_CCORR << endl
|
||||
<< " TM_CCORR_NORMED = " << (int)TM_CCORR_NORMED << endl
|
||||
<< " TM_CCOEFF = " << (int)TM_CCOEFF << endl
|
||||
<< " TM_CCOEFF_NORMED = " << (int)TM_CCOEFF_NORMED << endl
|
||||
<< endl;
|
||||
|
||||
parser.printMessage();
|
||||
|
||||
string filename = parser.get<string>("i");
|
||||
string tmplname = parser.get<string>("t");
|
||||
string maskname = parser.get<string>("m");
|
||||
string filename = samples::findFile(parser.get<string>("i"));
|
||||
string tmplname = samples::findFile(parser.get<string>("t"));
|
||||
string maskname = samples::findFile(parser.get<string>("m"));
|
||||
Mat img = imread(filename);
|
||||
Mat tmpl = imread(tmplname);
|
||||
Mat mask = imread(maskname);
|
||||
|
||||
Reference in New Issue
Block a user