diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-20 21:04:56 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | 582db45e356d5e7eb90606107c54db2e25cec644 (patch) | |
tree | 5e8200d9072dc90e5d503031722440c8d59a5c92 /tracker-wii | |
parent | 1b1e0f4ef7ae31e2721e6a32a84548e66f4244ef (diff) |
tracker/{pt,wii}: fix leading underscore identifiers
Diffstat (limited to 'tracker-wii')
-rw-r--r-- | tracker-wii/wii_camera.cpp | 16 | ||||
-rw-r--r-- | tracker-wii/wii_camera.h | 8 | ||||
-rw-r--r-- | tracker-wii/wii_point_extractor.cpp | 29 | ||||
-rw-r--r-- | tracker-wii/wii_point_extractor.h | 12 |
4 files changed, 31 insertions, 34 deletions
diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp index 38cbf26a..c8276796 100644 --- a/tracker-wii/wii_camera.cpp +++ b/tracker-wii/wii_camera.cpp @@ -67,7 +67,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; @@ -75,8 +75,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 { false, cam_info }; @@ -112,7 +112,7 @@ void WIICamera::stop() cam_desired = pt_camera_info(); } -wii_camera_status WIICamera::_pair() +wii_camera_status WIICamera::pair() { #if defined __MINGW32__ // missing prototypes and implib entries @@ -204,14 +204,14 @@ wii_camera_status WIICamera::_pair() #endif } -wii_camera_status WIICamera::_get_frame(cv::Mat& frame) +wii_camera_status WIICamera::get_frame_(cv::Mat& frame) { (void)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(); @@ -244,7 +244,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; @@ -275,7 +275,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 f4ee5c00..fb864548 100644 --- a/tracker-wii/wii_camera.h +++ b/tracker-wii/wii_camera.h @@ -52,14 +52,14 @@ 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&); double dt_mean = 0; Timer t; + 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); pt_camera_info cam_info; pt_camera_info cam_desired; diff --git a/tracker-wii/wii_point_extractor.cpp b/tracker-wii/wii_point_extractor.cpp index 1be6049b..27f53cb1 100644 --- a/tracker-wii/wii_point_extractor.cpp +++ b/tracker-wii/wii_point_extractor.cpp @@ -40,7 +40,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 thinkness) +void WIIPointExtractor::draw_point(cv::Mat& preview_frame, const vec2& p, const cv::Scalar& color, int thickness) { static constexpr int len = 9; @@ -51,18 +51,18 @@ void WIIPointExtractor::_draw_point(cv::Mat& preview_frame, const vec2& p, const cv::Point(p2.x - len, p2.y), cv::Point(p2.x + len, p2.y), color, - thinkness); + thickness); cv::line(preview_frame, cv::Point(p2.x, p2.y - len), cv::Point(p2.x, p2.y + len), color, - thinkness); + 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; + constexpr int W = 1024; + constexpr int H = 768; points.reserve(4); points.clear(); @@ -81,7 +81,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), dot.isize); + draw_point(preview_frame, dt, cv::Scalar(0, 255, 0), dot.isize); } } const bool success = points.size() >= PointModel::N_POINTS; @@ -89,7 +89,7 @@ bool WIIPointExtractor::_draw_points(cv::Mat& preview_frame, const struct wii_in return success; } -void WIIPointExtractor::_draw_bg(cv::Mat& preview_frame, const struct wii_info &wii) +void WIIPointExtractor::draw_bg(cv::Mat& preview_frame, const struct wii_info& wii) { //draw battery status cv::line(preview_frame, @@ -114,11 +114,12 @@ 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; - } + switch (wii.status) + { + case wii_cam_data_change: + draw_bg(preview_frame, wii); + draw_points(preview_frame, wii, points); + break; + } } diff --git a/tracker-wii/wii_point_extractor.h b/tracker-wii/wii_point_extractor.h index be0e5f45..a72ba861 100644 --- a/tracker-wii/wii_point_extractor.h +++ b/tracker-wii/wii_point_extractor.h @@ -21,18 +21,14 @@ using namespace types; class WIIPointExtractor final : public pt_point_extractor { public: - // extracts points from frame and draws some processing info into frame, if draw_output is set - // 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 thinkness = 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); + 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); }; } // ns impl - |