1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

tracking tutorial: add fps to stats

This commit is contained in:
Jiri Horner
2017-08-22 12:56:52 +02:00
parent a835517049
commit f6deaf5f2a
3 changed files with 17 additions and 5 deletions
@@ -25,15 +25,17 @@ void drawBoundingBox(Mat image, vector<Point2f> bb)
void drawStatistics(Mat image, const Stats& stats)
{
static const int font = FONT_HERSHEY_PLAIN;
stringstream str1, str2, str3;
stringstream str1, str2, str3, str4;
str1 << "Matches: " << stats.matches;
str2 << "Inliers: " << stats.inliers;
str3 << "Inlier ratio: " << setprecision(2) << stats.ratio;
str4 << "FPS: " << std::fixed << setprecision(2) << stats.fps;
putText(image, str1.str(), Point(0, image.rows - 90), font, 2, Scalar::all(255), 3);
putText(image, str2.str(), Point(0, image.rows - 60), font, 2, Scalar::all(255), 3);
putText(image, str3.str(), Point(0, image.rows - 30), font, 2, Scalar::all(255), 3);
putText(image, str1.str(), Point(0, image.rows - 120), font, 2, Scalar::all(255), 3);
putText(image, str2.str(), Point(0, image.rows - 90), font, 2, Scalar::all(255), 3);
putText(image, str3.str(), Point(0, image.rows - 60), font, 2, Scalar::all(255), 3);
putText(image, str4.str(), Point(0, image.rows - 30), font, 2, Scalar::all(255), 3);
}
void printStatistics(string name, Stats stats)
@@ -45,6 +47,7 @@ void printStatistics(string name, Stats stats)
cout << "Inliers " << stats.inliers << endl;
cout << "Inlier ratio " << setprecision(2) << stats.ratio << endl;
cout << "Keypoints " << stats.keypoints << endl;
cout << "FPS " << std::fixed << setprecision(2) << stats.fps << endl;
cout << endl;
}