updates documentation and samples
This commit is contained in:
@@ -1,29 +1,20 @@
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
#include <cctype>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
static void help()
|
||||
{
|
||||
cout << "\nThis program demonstrates template match with mask.\n"
|
||||
"Usage:\n"
|
||||
"./mask_tmpl -i=<image_name> -t=<template_name> -m=<mask_name>, Default is ../data/lena_tmpl.jpg\n"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
cv::CommandLineParser parser(argc, argv,
|
||||
"{ i | ../data/lena_tmpl.jpg | }"
|
||||
"{ t | ../data/tmpl.png | }"
|
||||
"{ m | ../data/mask.png | }");
|
||||
CommandLineParser parser(argc, argv,
|
||||
"{ i | ../data/lena_tmpl.jpg |image name }"
|
||||
"{ t | ../data/tmpl.png |template name }"
|
||||
"{ m | ../data/mask.png |mask name }"
|
||||
"{ cm| 3 |comparison method }");
|
||||
|
||||
cout << "This program demonstrates the use of template matching with mask.\n\n";
|
||||
parser.printMessage();
|
||||
|
||||
string filename = parser.get<string>("i");
|
||||
string tmplname = parser.get<string>("t");
|
||||
@@ -35,27 +26,23 @@ int main( int argc, const char** argv )
|
||||
|
||||
if(img.empty())
|
||||
{
|
||||
help();
|
||||
cout << "can not open " << filename << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(tmpl.empty())
|
||||
{
|
||||
help();
|
||||
cout << "can not open " << tmplname << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(mask.empty())
|
||||
{
|
||||
help();
|
||||
cout << "can not open " << maskname << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//int method = CV_TM_SQDIFF;
|
||||
int method = CV_TM_CCORR_NORMED;
|
||||
int method = parser.get<int>("cm"); // default 3 (CV_TM_CCORR_NORMED)
|
||||
matchTemplate(img, tmpl, res, method, mask);
|
||||
|
||||
double minVal, maxVal;
|
||||
|
||||
Reference in New Issue
Block a user