diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-27 07:49:08 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-27 07:49:08 +0100 |
commit | 56a78f48547081a1b20977596d842dadb710210e (patch) | |
tree | 22a682bb70ee6f3108f53ccca6d417b40026b036 | |
parent | 48a8485317a90687e51419fe32c512cd1ebb2943 (diff) |
pt: remove manual camera rotation declaration
We do it in core. And if we don't, we have to!
Issue: #63
-rw-r--r-- | ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 116 | ||||
-rw-r--r-- | ftnoir_tracker_pt/camera.cpp | 26 | ||||
-rw-r--r-- | ftnoir_tracker_pt/camera.h | 14 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 18 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.h | 1 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 7 | ||||
-rw-r--r-- | 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 @@ -277,119 +277,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Camera orientation</string> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Roll</string> - </property> - <property name="buddy"> - <cstring>camroll_combo</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="camroll_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Rotation of the camera image</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Pitch</string> - </property> - <property name="buddy"> - <cstring>campitch_spin</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="campitch_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing upwards</string> - </property> - <property name="suffix"> - <string> deg</string> - </property> - <property name="minimum"> - <number>-180</number> - </property> - <property name="maximum"> - <number>180</number> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>positive = upwards</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>Yaw</string> - </property> - <property name="buddy"> - <cstring>camyaw_spin</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camyaw_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing leftwards</string> - </property> - <property name="suffix"> - <string> deg</string> - </property> - <property name="prefix"> - <string/> - </property> - <property name="minimum"> - <number>-180</number> - </property> - <property name="maximum"> - <number>180</number> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>positve = left</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="groupBox_2"> <property name="title"> <string>Point extraction</string> @@ -1180,9 +1067,6 @@ <tabstop>tabWidget</tabstop> <tabstop>camdevice_combo</tabstop> <tabstop>res_x_spin</tabstop> - <tabstop>camroll_combo</tabstop> - <tabstop>campitch_spin</tabstop> - <tabstop>camyaw_spin</tabstop> <tabstop>threshold_slider</tabstop> <tabstop>model_tabs</tabstop> <tabstop>m1x_spin</tabstop> 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 <opencv2/core/core.hpp> #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<cv::Vec2f>& 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<RotationType>(static_cast<int>(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), |