summaryrefslogtreecommitdiffhomepage
path: root/tracker-trackhat/extractor.cpp
diff options
context:
space:
mode:
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});
+ }
+}