summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/tracker-wii/wii_frame.hpp
diff options
context:
space:
mode:
authorWei Shuai <cpuwolf@gmail.com>2018-01-15 17:08:48 +0800
committerWei Shuai <cpuwolf@gmail.com>2018-01-20 07:21:34 +0800
commit911e9deb712bafb5f622e215e286744696e90617 (patch)
tree9b6d365566a8a9934bb7b5dce7b924aa0bc8bbf4 /tracker-pt/tracker-wii/wii_frame.hpp
parentc49530ad99720fa638191db667610542bec3c696 (diff)
add Wiimote supporting in point tracker
1. extrack point from wii frame 2. wii_camera outputs wii raw data, wii_extractor create preview 3. wiimote fov is about 42 degree 4. wii:change block functions to non-block function "contains WiiYourself! wiimote code by gl.tter http://gl.tter.org"
Diffstat (limited to 'tracker-pt/tracker-wii/wii_frame.hpp')
-rw-r--r--tracker-pt/tracker-wii/wii_frame.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/tracker-pt/tracker-wii/wii_frame.hpp b/tracker-pt/tracker-wii/wii_frame.hpp
new file mode 100644
index 00000000..4e3f0c95
--- /dev/null
+++ b/tracker-pt/tracker-wii/wii_frame.hpp
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2015-2016 Stanislaw Halik <sthalik@misaki.pl>
+* Copyright (c) 2017-2018 Wei Shuai <cpuwolf@gmail.com>
+*/
+#pragma once
+
+#include "pt-api.hpp"
+
+#include <opencv2/core.hpp>
+#include <QImage>
+
+
+
+namespace pt_module {
+
+enum wii_camera_status : unsigned { wii_cam_wait_for_connect, wii_cam_data_no_change, wii_cam_data_change };
+
+struct wii_info_points {
+ unsigned ux;
+ unsigned uy;
+ int isize;
+ bool bvis;
+};
+
+struct wii_info {
+ struct wii_info_points Points[4];
+ bool bBatteryDrained;
+ unsigned char BatteryPercent;
+ float Pitch;
+ float Roll;
+ wii_camera_status status;
+};
+
+struct WIIFrame final : pt_frame
+{
+ cv::Mat mat;
+ struct wii_info wii;
+
+ operator const cv::Mat&() const& { return mat; }
+ operator cv::Mat&() & { return mat; }
+};
+
+struct WIIPreview final : pt_preview
+{
+ WIIPreview(int w, int h);
+
+ WIIPreview& operator=(const pt_frame& frame) override;
+ QImage get_bitmap() override;
+ void draw_head_center(double x, double y) override;
+
+ operator cv::Mat&() { return frame_copy; }
+ operator cv::Mat const&() const { return frame_copy; }
+
+private:
+ static void ensure_size(cv::Mat& frame, int w, int h, int type);
+
+ bool fresh = true;
+ cv::Mat frame_copy, frame_color, frame_resize, frame_out;
+};
+
+} // ns pt_module