diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-12 23:42:43 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | 3e36ce6985399c74676d46beef73a282eacf4109 (patch) | |
tree | f3604bb22670bd0496bf756f9aaa66449e6888d5 /tracker-easy | |
parent | 7e357fcb6c143a61c4f87ffda502f8be021674f0 (diff) |
Easy Tracker: Renaming coordinates utility class.
Diffstat (limited to 'tracker-easy')
-rw-r--r-- | tracker-easy/frame.cpp | 4 | ||||
-rw-r--r-- | tracker-easy/frame.hpp | 2 | ||||
-rw-r--r-- | tracker-easy/point_extractor.cpp | 2 | ||||
-rw-r--r-- | tracker-easy/tracker-easy-api.cpp | 4 | ||||
-rw-r--r-- | tracker-easy/tracker-easy-api.h | 9 |
5 files changed, 11 insertions, 10 deletions
diff --git a/tracker-easy/frame.cpp b/tracker-easy/frame.cpp index b066e13b..9243c6a1 100644 --- a/tracker-easy/frame.cpp +++ b/tracker-easy/frame.cpp @@ -50,9 +50,9 @@ QImage Preview::get_bitmap() QImage::Format_ARGB32); } -void Preview::draw_head_center(pt_pixel_pos_mixin::f x, pt_pixel_pos_mixin::f y) +void Preview::draw_head_center(Coordinates::f x, Coordinates::f y) { - auto [px_, py_] = pt_pixel_pos_mixin::to_pixel_pos(x, y, frame_copy.cols, frame_copy.rows); + auto [px_, py_] = Coordinates::to_pixel_pos(x, y, frame_copy.cols, frame_copy.rows); int px = iround(px_), py = iround(py_); diff --git a/tracker-easy/frame.hpp b/tracker-easy/frame.hpp index 807f74d2..01e99977 100644 --- a/tracker-easy/frame.hpp +++ b/tracker-easy/frame.hpp @@ -13,7 +13,7 @@ struct Preview Preview& operator=(const cv::Mat& frame); QImage get_bitmap(); - void draw_head_center(pt_pixel_pos_mixin::f x, pt_pixel_pos_mixin::f y); + void draw_head_center(Coordinates::f x, Coordinates::f y); operator cv::Mat&() { return frame_copy; } operator cv::Mat const&() const { return frame_copy; } diff --git a/tracker-easy/point_extractor.cpp b/tracker-easy/point_extractor.cpp index 54803d52..ecd72f70 100644 --- a/tracker-easy/point_extractor.cpp +++ b/tracker-easy/point_extractor.cpp @@ -372,7 +372,7 @@ end: // note: H/W is equal to fx/fy vec2 p; - std::tie(p[0], p[1]) = to_screen_pos(b.pos[0], b.pos[1], W, H); + std::tie(p[0], p[1]) = Coordinates::to_screen_pos(b.pos[0], b.pos[1], W, H); points.push_back(p); imagePoints.push_back(vec2(b.pos[0], b.pos[1])); } diff --git a/tracker-easy/tracker-easy-api.cpp b/tracker-easy/tracker-easy-api.cpp index 32663a6a..aaeb0631 100644 --- a/tracker-easy/tracker-easy-api.cpp +++ b/tracker-easy/tracker-easy-api.cpp @@ -22,12 +22,12 @@ f pt_point_extractor::threshold_radius_value(int w, int h, int threshold) return radius; } -std::tuple<f, f> pt_pixel_pos_mixin::to_pixel_pos(f x, f y, int w, int h) +std::tuple<f, f> Coordinates::to_pixel_pos(f x, f y, int w, int h) { return std::make_tuple(w*(x+f{.5}), f{.5}*(h - 2*y*w)); } -std::tuple<f, f> pt_pixel_pos_mixin::to_screen_pos(f px, f py, int w, int h) +std::tuple<f, f> Coordinates::to_screen_pos(f px, f py, int w, int h) { px *= w/(w-f{1}); py *= h/(h-f{1}); return std::make_tuple((px - w/f{2})/w, -(py - h/f{2})/w); diff --git a/tracker-easy/tracker-easy-api.h b/tracker-easy/tracker-easy-api.h index b42e4c73..40e472d4 100644 --- a/tracker-easy/tracker-easy-api.h +++ b/tracker-easy/tracker-easy-api.h @@ -22,8 +22,10 @@ const int KPointCount = 3; - -struct pt_pixel_pos_mixin +/// +/// Utility class providing coordinates conversion functionalities +/// +struct Coordinates final { using f = numeric_types::f; @@ -32,8 +34,7 @@ struct pt_pixel_pos_mixin }; - -struct pt_point_extractor : pt_pixel_pos_mixin +struct pt_point_extractor { using vec2 = numeric_types::vec2; using f = numeric_types::f; |