From 56a78f48547081a1b20977596d842dadb710210e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 27 Oct 2014 07:49:08 +0100 Subject: pt: remove manual camera rotation declaration We do it in core. And if we don't, we have to! Issue: #63 --- ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 116 ------------------------- ftnoir_tracker_pt/camera.cpp | 26 ------ ftnoir_tracker_pt/camera.h | 14 +-- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 18 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 1 - ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 7 -- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 6 -- 7 files changed, 6 insertions(+), 182 deletions(-) diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index 73b1f767..91cda5dd 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -276,119 +276,6 @@ - - - - Camera orientation - - - - - - Roll - - - camroll_combo - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Rotation of the camera image - - - - - - - Pitch - - - campitch_spin - - - - - - - Qt::DefaultContextMenu - - - The angle the camera is facing upwards - - - deg - - - -180 - - - 180 - - - - - - - positive = upwards - - - - - - - Yaw - - - camyaw_spin - - - - - - - Qt::DefaultContextMenu - - - The angle the camera is facing leftwards - - - deg - - - - - - -180 - - - 180 - - - - - - - positve = left - - - - - - @@ -1180,9 +1067,6 @@ tabWidget camdevice_combo res_x_spin - camroll_combo - campitch_spin - camyaw_spin threshold_slider model_tabs m1x_spin diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index fec503e1..e427f54e 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -302,29 +302,3 @@ void VICamera::_set_res() if (active) restart(); } #endif - -// ---------------------------------------------------------------------------- -Mat FrameRotation::rotate_frame(Mat frame) -{ - switch (rotation) - { - case CLOCKWISE: - { - Mat dst; - transpose(frame, dst); - flip(dst, dst, 1); - return dst; - } - - case COUNTER_CLOCKWISE: - { - Mat dst; - transpose(frame, dst); - flip(dst, dst, 0); - return dst; - } - - default: - return frame; - } -} diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 889bf2d3..2bce6f35 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -5,8 +5,7 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef CAMERA_H -#define CAMERA_H +#pragma once #include #ifndef OPENTRACK_API @@ -128,14 +127,3 @@ enum RotationType ZERO = 1, COUNTER_CLOCKWISE = 2 }; - -// ---------------------------------------------------------------------------- -class FrameRotation -{ -public: - RotationType rotation; - - cv::Mat rotate_frame(cv::Mat frame); -}; - -#endif //CAMERA_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 9b3795b9..a32288f4 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -66,7 +66,6 @@ void Tracker::run() { QMutexLocker lock(&mutex); - frame = frame_rotation.rotate_frame(frame); const std::vector& points = point_extractor.extract_points(frame); for (auto p : points) { @@ -119,22 +118,15 @@ void Tracker::apply_inner() camera.set_device_index(s.cam_index); camera.set_res(s.cam_res_x, s.cam_res_y); camera.set_fps(s.cam_fps); - frame_rotation.rotation = static_cast(static_cast(s.cam_roll)); point_extractor.threshold_val = s.threshold; point_extractor.threshold_secondary_val = s.threshold_secondary; point_extractor.min_size = s.min_point_size; point_extractor.max_size = s.max_point_size; t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); - R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), - 0, 1, 0, - -sin(deg2rad*s.cam_yaw), 0, cos(deg2rad*s.cam_yaw)); - R_GC = R_GC * Matx33f( 1, 0, 0, - 0, cos(deg2rad*s.cam_pitch), sin(deg2rad*s.cam_pitch), - 0, -sin(deg2rad*s.cam_pitch), cos(deg2rad*s.cam_pitch)); - - FrameTrafo X_MH(Matx33f::eye(), t_MH); - X_GH_0 = R_GC * X_MH; - qDebug()<<"Tracker::apply ends"; + R_GC = cv::Matx33f::eye(); + FrameTrafo X_MH(Matx33f::eye(), t_MH); + X_GH_0 = R_GC * X_MH; + qDebug()<<"Tracker::apply ends"; } void Tracker::reset() @@ -145,7 +137,7 @@ void Tracker::reset() void Tracker::center() { - point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet + point_tracker.reset(); QMutexLocker lock(&mutex); FrameTrafo X_CM_0 = point_tracker.pose(); FrameTrafo X_MH(Matx33f::eye(), t_MH); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 921d61cf..33e03ea8 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -62,7 +62,6 @@ private: volatile int commands; CVCamera camera; - FrameRotation frame_rotation; PointExtractor point_extractor; PointTracker point_tracker; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index a15e97b9..1b5b5910 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -34,17 +34,10 @@ TrackerDialog::TrackerDialog() ui.camdevice_combo->addItem(iter->c_str()); } - ui.camroll_combo->addItem("-90"); - ui.camroll_combo->addItem("0"); - ui.camroll_combo->addItem("90"); - tie_setting(s.cam_index, ui.camdevice_combo); tie_setting(s.cam_res_x, ui.res_x_spin); tie_setting(s.cam_res_y, ui.res_y_spin); tie_setting(s.cam_fps, ui.fps_spin); - tie_setting(s.cam_roll, ui.camroll_combo); - tie_setting(s.cam_pitch, ui.campitch_spin); - tie_setting(s.cam_yaw, ui.camyaw_spin); tie_setting(s.threshold_secondary, ui.threshold_secondary_slider); tie_setting(s.threshold, ui.threshold_slider); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 9365eb9a..b301db31 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -21,9 +21,6 @@ struct settings cam_res_x, cam_res_y, cam_fps, - cam_roll, - cam_pitch, - cam_yaw, threshold, threshold_secondary, min_point_size, @@ -45,9 +42,6 @@ struct settings cam_res_x(b, "camera-res-width", 640), cam_res_y(b, "camera-res-height", 480), cam_fps(b, "camera-fps", 30), - cam_roll(b, "camera-roll", 1), - cam_pitch(b, "camera-pitch", 0), - cam_yaw(b, "camera-yaw", 0), threshold(b, "threshold-primary", 128), threshold_secondary(b, "threshold-secondary", 128), min_point_size(b, "min-point-size", 10), -- cgit v1.2.3