summaryrefslogtreecommitdiffhomepage
path: root/tracker-trackhat/extractor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-05-11 20:42:25 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-05-11 20:45:05 +0200
commit2b19c6c532c37c2eeb2547cf92f719197957ab72 (patch)
tree26fb69b756d8ae49fb87a18956eca26dd2c55005 /tracker-trackhat/extractor.cpp
parentbe42a20f03e3ccb1eaa390c072ac72cbe2d9f13b (diff)
tracker/trackhat: new tracker
Sponsored by: TrackHat
Diffstat (limited to 'tracker-trackhat/extractor.cpp')
-rw-r--r--tracker-trackhat/extractor.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tracker-trackhat/extractor.cpp b/tracker-trackhat/extractor.cpp
new file mode 100644
index 00000000..58b9fd05
--- /dev/null
+++ b/tracker-trackhat/extractor.cpp
@@ -0,0 +1,21 @@
+#include "trackhat.hpp"
+#include <algorithm>
+#include <iterator>
+
+void trackhat_extractor::extract_points(const pt_frame& data,
+ pt_preview&, bool,
+ std::vector<vec2>& points)
+{
+ points.clear();
+ points.reserve(trackhat_camera::point_count);
+ const auto& copy = data.as_const<trackhat_frame>()->points;
+
+ for (const auto& pt : copy)
+ {
+ if (!pt.ok)
+ continue;
+ constexpr int sz = trackhat_camera::sensor_size;
+ auto [ x, y ] = to_screen_pos(pt.x, pt.y, sz, sz);
+ points.push_back({x, y});
+ }
+}