4
#include <opencv2/core.hpp>
11
void drawBoundingBox(Mat image, vector<Point2f> bb);
12
void drawStatistics(Mat image, const Stats& stats);
13
void printStatistics(string name, Stats stats);
14
vector<Point2f> Points(vector<KeyPoint> keypoints);
16
void drawBoundingBox(Mat image, vector<Point2f> bb)
18
for(unsigned i = 0; i < bb.size() - 1; i++) {
19
line(image, bb[i], bb[i + 1], Scalar(0, 0, 255), 2);
21
line(image, bb[bb.size() - 1], bb[0], Scalar(0, 0, 255), 2);
24
void drawStatistics(Mat image, const Stats& stats)
26
static const int font = FONT_HERSHEY_PLAIN;
27
stringstream str1, str2, str3;
29
str1 << "Matches: " << stats.matches;
30
str2 << "Inliers: " << stats.inliers;
31
str3 << "Inlier ratio: " << setprecision(2) << stats.ratio;
33
putText(image, str1.str(), Point(0, image.rows - 90), font, 2, Scalar::all(255), 3);
34
putText(image, str2.str(), Point(0, image.rows - 60), font, 2, Scalar::all(255), 3);
35
putText(image, str3.str(), Point(0, image.rows - 30), font, 2, Scalar::all(255), 3);
38
void printStatistics(string name, Stats stats)
41
cout << "----------" << endl;
43
cout << "Matches " << stats.matches << endl;
44
cout << "Inliers " << stats.inliers << endl;
45
cout << "Inlier ratio " << setprecision(2) << stats.ratio << endl;
46
cout << "Keypoints " << stats.keypoints << endl;
50
vector<Point2f> Points(vector<KeyPoint> keypoints)
53
for(unsigned i = 0; i < keypoints.size(); i++) {
54
res.push_back(keypoints[i].pt);