some improvements on tutorials
This commit is contained in:
@@ -63,7 +63,7 @@ int main(void)
|
||||
|
||||
Mat res;
|
||||
drawMatches(img1, inliers1, img2, inliers2, good_matches, res);
|
||||
imwrite("res.png", res);
|
||||
imwrite("akaze_result.png", res);
|
||||
|
||||
double inlier_ratio = inliers1.size() * 1.0 / matched1.size();
|
||||
cout << "A-KAZE Matching Results" << endl;
|
||||
@@ -75,5 +75,8 @@ int main(void)
|
||||
cout << "# Inliers Ratio: \t" << inlier_ratio << endl;
|
||||
cout << endl;
|
||||
|
||||
imshow("result", res);
|
||||
waitKey();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -120,27 +120,27 @@ Mat Tracker::process(const Mat frame, Stats& stats)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc < 2) {
|
||||
cerr << "Usage: " << endl
|
||||
<< "akaze_track input_path" << endl
|
||||
<< " (input_path can be a camera id, like 0,1,2 or a video filename)" << endl;
|
||||
return 1;
|
||||
}
|
||||
cerr << "Usage: " << endl
|
||||
<< "akaze_track input_path" << endl
|
||||
<< " (input_path can be a camera id, like 0,1,2 or a video filename)" << endl;
|
||||
|
||||
std::string video_name = argv[1];
|
||||
std::stringstream ssFormat;
|
||||
ssFormat << atoi(argv[1]);
|
||||
CommandLineParser parser(argc, argv, "{@input_path |0|input path can be a camera id, like 0,1,2 or a video filename}");
|
||||
string input_path = parser.get<string>(0);
|
||||
string video_name = input_path;
|
||||
|
||||
VideoCapture video_in;
|
||||
if (video_name.compare(ssFormat.str())==0) { //test str==str(num)
|
||||
video_in.open(atoi(argv[1]));
|
||||
|
||||
if ( ( isdigit(input_path[0]) && input_path.size() == 1 ) )
|
||||
{
|
||||
int camera_no = input_path[0] - '0';
|
||||
video_in.open( camera_no );
|
||||
}
|
||||
else {
|
||||
video_in.open(video_name);
|
||||
}
|
||||
|
||||
if(!video_in.isOpened()) {
|
||||
cerr << "Couldn't open " << argv[1] << endl;
|
||||
cerr << "Couldn't open " << video_name << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user