reverted samples with new command argument parser. will be continued after OpenCV release.

This commit is contained in:
itsyplen
2011-06-09 12:01:47 +00:00
parent 8f4f982e5c
commit 3876cf22e3
16 changed files with 601 additions and 559 deletions

View File

@@ -4,7 +4,6 @@
* Created on: Oct 17, 2010
* Author: ethan
*/
#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
@@ -12,7 +11,6 @@
#include <vector>
#include <iostream>
using namespace std;
using namespace cv;
using std::cout;
@@ -20,15 +18,13 @@ using std::cerr;
using std::endl;
using std::vector;
void help()
{
printf("\nThis program shows how to use BRIEF descriptor to match points in features2d\n"
"It takes in two images, finds keypoints and matches them displaying matches and final homography warped results\n"
"Usage: \n"
" ./brief_match_test [--first_file]=<first file name, left01.jpg as default> \n"
" [--second_file]=<second file name, left02.jpg as default> \n"
"Example: \n"
"./brief_match_test --first_file=left01.jpg --second_file=left02.jpg \n");
void help(char **av)
{
cerr << "usage: " << av[0] << " im1.jpg im2.jpg"
<< "\n"
<< "This program shows how to use BRIEF descriptor to match points in features2d\n"
<< "It takes in two images, finds keypoints and matches them displaying matches and final homography warped results\n"
<< endl;
}
//Copy (x,y) location of descriptor matches found from KeyPoint data structures into Point2f vectors
@@ -59,22 +55,16 @@ double match(const vector<KeyPoint>& /*kpts_train*/, const vector<KeyPoint>& /*k
int main(int ac, const char ** av)
int main(int ac, char ** av)
{
help();
CommandLineParser parser(ac, av);
string im1_name, im2_name;
im1_name = parser.get<string>("first_file", "left01.jpg");
im2_name = parser.get<string>("second_file", "left02.jpg");
if (im1_name.empty() || im2_name.empty())
if (ac != 3)
{
help();
printf("\n You have to indicate two files first_file and second_file \n");
return -1;
help(av);
return 1;
}
string im1_name, im2_name;
im1_name = av[1];
im2_name = av[2];
Mat im1 = imread(im1_name, CV_LOAD_IMAGE_GRAYSCALE);
Mat im2 = imread(im2_name, CV_LOAD_IMAGE_GRAYSCALE);