This commit is contained in:
ValeryTyumen
2015-08-01 20:24:23 +05:00
committed by Maksim Shabunin
parent 5cdf0e3e89
commit 297808e6b9
57 changed files with 950 additions and 1052 deletions
+15 -7
View File
@@ -19,7 +19,7 @@ static void help()
"This program demonstrates a method for shape comparisson based on Shape Context\n"
"You should run the program providing a number between 1 and 20 for selecting an image in the folder ../data/shape_sample.\n"
"Call\n"
"./shape_example [number between 1 and 20]\n\n");
"./shape_example [number between 1 and 20, 1 default]\n\n");
}
static vector<Point> simpleContour( const Mat& currentQuery, int n=300 )
@@ -54,16 +54,24 @@ static vector<Point> simpleContour( const Mat& currentQuery, int n=300 )
int main(int argc, char** argv)
{
help();
string path = "../data/shape_sample/";
int indexQuery = 1;
if( argc < 2 )
cv::CommandLineParser parser(argc, argv, "{help h||}{@input|1|}");
if (parser.has("help"))
{
std::cout<<"Using first image as query."<<std::endl;
help();
return 0;
}
else
int indexQuery = parser.get<int>("@input");
if (!parser.check())
{
sscanf( argv[1], "%i", &indexQuery );
parser.printErrors();
help();
return 1;
}
if (indexQuery < 1 || indexQuery > 20)
{
help();
return 1;
}
cv::Ptr <cv::ShapeContextDistanceExtractor> mysc = cv::createShapeContextDistanceExtractor();