summaryrefslogtreecommitdiffhomepage
path: root/tracker-wii
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-wii')
-rw-r--r--tracker-wii/wii_camera.cpp16
-rw-r--r--tracker-wii/wii_camera.h8
-rw-r--r--tracker-wii/wii_point_extractor.cpp17
-rw-r--r--tracker-wii/wii_point_extractor.h9
4 files changed, 24 insertions, 26 deletions
diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp
index 97a32b9f..cc019992 100644
--- a/tracker-wii/wii_camera.cpp
+++ b/tracker-wii/wii_camera.cpp
@@ -65,7 +65,7 @@ WIICamera::result WIICamera::get_frame(pt_frame& frame_)
cv::Mat& frame = frame_.as<WIIFrame>()->mat;
struct wii_info& wii = frame_.as<WIIFrame>()->wii;
- const wii_camera_status new_frame = _get_frame(frame);
+ const wii_camera_status new_frame = get_frame(frame);
//create a fake blank frame
frame = cv::Mat(cam_info.res_x, cam_info.res_y, CV_8UC3, cv::Scalar(0, 0, 0));
wii.status = new_frame;
@@ -73,8 +73,8 @@ WIICamera::result WIICamera::get_frame(pt_frame& frame_)
switch (new_frame)
{
case wii_cam_data_change:
- _get_status(wii);
- _get_points(wii);
+ get_status(wii);
+ get_points(wii);
break;
case wii_cam_data_no_change:
return result(false, cam_info);
@@ -111,7 +111,7 @@ void WIICamera::stop()
}
-wii_camera_status WIICamera::_pair()
+wii_camera_status WIICamera::pair()
{
wii_camera_status ret = wii_cam_wait_for_sync;
HBLUETOOTH_RADIO_FIND hbt;
@@ -199,13 +199,13 @@ wii_camera_status WIICamera::_pair()
return ret;
}
-wii_camera_status WIICamera::_get_frame(cv::Mat& frame)
+wii_camera_status WIICamera::get_frame(cv::Mat& frame)
{
wii_camera_status ret = wii_cam_wait_for_connect;
if (!m_pDev->IsConnected()) {
qDebug() << "wii wait";
- ret = _pair();
+ ret = pair();
switch(ret){
case wii_cam_wait_for_sync:
m_pDev->Disconnect();
@@ -236,7 +236,7 @@ goodbye:
return ret;
}
-bool WIICamera::_get_points(struct wii_info& wii)
+bool WIICamera::get_points(struct wii_info& wii)
{
bool dot_sizes = (m_pDev->IR.Mode == wiimote_state::ir::EXTENDED);
bool ret = false;
@@ -267,7 +267,7 @@ bool WIICamera::_get_points(struct wii_info& wii)
return ret;
}
-void WIICamera::_get_status(struct wii_info& wii)
+void WIICamera::get_status(struct wii_info& wii)
{
//draw battery status
wii.BatteryPercent = m_pDev->BatteryPercent;
diff --git a/tracker-wii/wii_camera.h b/tracker-wii/wii_camera.h
index 7bc74559..e1788be5 100644
--- a/tracker-wii/wii_camera.h
+++ b/tracker-wii/wii_camera.h
@@ -51,10 +51,10 @@ private:
bool onExit = false;
pt_frame internalframe;
- wii_camera_status _pair();
- wii_camera_status _get_frame(cv::Mat& Frame);
- bool _get_points(struct wii_info&);
- void _get_status(struct wii_info&);
+ wii_camera_status pair();
+ wii_camera_status get_frame(cv::Mat& Frame);
+ bool get_points(struct wii_info& wii);
+ void get_status(struct wii_info& wii);
double dt_mean = 0;
diff --git a/tracker-wii/wii_point_extractor.cpp b/tracker-wii/wii_point_extractor.cpp
index 69dfda53..553abdab 100644
--- a/tracker-wii/wii_point_extractor.cpp
+++ b/tracker-wii/wii_point_extractor.cpp
@@ -31,7 +31,7 @@ WIIPointExtractor::WIIPointExtractor(const QString& module_name) : s(module_name
}
//define a temp draw function
-void WIIPointExtractor::_draw_point(cv::Mat& preview_frame, const vec2& p, const cv::Scalar& color, int thickness)
+void WIIPointExtractor::draw_point(cv::Mat& preview_frame, const vec2& p, const cv::Scalar& color, int thickness)
{
static constexpr int len = 9;
@@ -50,7 +50,7 @@ void WIIPointExtractor::_draw_point(cv::Mat& preview_frame, const vec2& p, const
thickness);
};
-bool WIIPointExtractor::_draw_points(cv::Mat& preview_frame, const struct wii_info &wii, std::vector<vec2>& points)
+bool WIIPointExtractor::draw_points(cv::Mat& preview_frame, const struct wii_info& wii, std::vector<vec2>& points)
{
const float W = 1024.0f;
const float H = 768.0f;
@@ -72,7 +72,7 @@ bool WIIPointExtractor::_draw_points(cv::Mat& preview_frame, const struct wii_in
std::tie(dt[0], dt[1]) = to_screen_pos(RX, RY, W, H);
points.push_back(dt);
- _draw_point(preview_frame, dt, cv::Scalar(0, 255, 0), clamp(dot.isize, 1, 32));
+ draw_point(preview_frame, dt, cv::Scalar(0, 255, 0), clamp(dot.isize, 1, 32));
}
}
const bool success = points.size() >= PointModel::N_POINTS;
@@ -105,11 +105,10 @@ void WIIPointExtractor::extract_points(const pt_frame& frame_, pt_preview& previ
const struct wii_info& wii = frame_.as_const<WIIFrame>()->wii;
cv::Mat& preview_frame = *preview_frame_.as<WIIPreview>();
- switch (wii.status) {
- case wii_cam_data_change:
- _draw_bg(preview_frame, wii);
- _draw_points(preview_frame, wii, points);
- break;
- }
+ if (wii.status == wii_cam_data_change)
+ {
+ draw_bg(preview_frame, wii);
+ draw_points(preview_frame, wii, points);
+ }
}
diff --git a/tracker-wii/wii_point_extractor.h b/tracker-wii/wii_point_extractor.h
index dc3c5e44..4208f1b2 100644
--- a/tracker-wii/wii_point_extractor.h
+++ b/tracker-wii/wii_point_extractor.h
@@ -25,13 +25,12 @@ public:
// dt: time since last call in seconds
void extract_points(const pt_frame& frame, pt_preview& preview_frame, std::vector<vec2>& points) override;
WIIPointExtractor(const QString& module_name);
-private:
- static constexpr int max_blobs = 16;
+private:
pt_settings s;
- void _draw_point(cv::Mat& preview_frame, const vec2& p, const cv::Scalar& color, int thickness = 1);
- bool _draw_points(cv::Mat& preview_frame, const struct wii_info &wii, std::vector<vec2>& points);
- void _draw_bg(cv::Mat& preview_frame, const struct wii_info &wii);
+ static void draw_point(cv::Mat& preview_frame, const vec2& p, const cv::Scalar& color, int thickness = 1);
+ static bool draw_points(cv::Mat& preview_frame, const struct wii_info& wii, std::vector<vec2>& points);
+ static void draw_bg(cv::Mat& preview_frame, const struct wii_info& wii);
};
} // ns impl