diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-09-29 08:28:56 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-09-29 08:28:56 +0000 |
commit | 71736d2d3bf639096c3c1b51565fd4c45239e44a (patch) | |
tree | 46f9c9089d424c9b6c2238754b1fa912626737b3 /FTNoIR_Tracker_PT | |
parent | c1c630b418256bdb385d0eaf938d4002dbd568b5 (diff) |
Unversioning local .vcproj and .sln
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@183 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_PT')
-rw-r--r-- | FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui | 13 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/camera.cpp | 2 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 22 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 6 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h | 15 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp | 20 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h | 4 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/point_tracker.cpp | 4 |
8 files changed, 42 insertions, 44 deletions
diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui index 77e412af..77e3ada7 100644 --- a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui +++ b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui @@ -335,6 +335,8 @@ </item>
</layout>
<zorder></zorder>
+ <zorder>caminfo_label</zorder>
+ <zorder>formLayoutWidget</zorder>
</widget>
</item>
</layout>
@@ -661,13 +663,10 @@ </spacer>
</item>
<item>
- <widget class="QPushButton" name="tcalib_button">
+ <widget class="QPushButton" name="pushButton">
<property name="text">
<string>Calibrate</string>
</property>
- <property name="checkable">
- <bool>true</bool>
- </property>
</widget>
</item>
</layout>
@@ -720,6 +719,11 @@ </layout>
</item>
</layout>
+ <zorder>groupBox_3</zorder>
+ <zorder>groupBox_4</zorder>
+ <zorder>label_32</zorder>
+ <zorder>horizontalLayoutWidget_3</zorder>
+ <zorder>label_33</zorder>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@@ -820,6 +824,7 @@ <tabstop>tx_spin</tabstop>
<tabstop>ty_spin</tabstop>
<tabstop>tz_spin</tabstop>
+ <tabstop>pushButton</tabstop>
</tabstops>
<resources>
<include location="ftnoir_tracker_pt.qrc"/>
diff --git a/FTNoIR_Tracker_PT/camera.cpp b/FTNoIR_Tracker_PT/camera.cpp index a0bae694..c1d0149c 100644 --- a/FTNoIR_Tracker_PT/camera.cpp +++ b/FTNoIR_Tracker_PT/camera.cpp @@ -54,7 +54,7 @@ cv::Mat Camera::get_frame(float dt) if (!frame.empty())
{
dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid;
- cam_info.fps = 1.0 / dt_mean;
+ cam_info.fps = 1.0 / (dt_mean + 1e-6);
dt_valid = 0;
}
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index f6682c58..db1512cb 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -58,12 +58,13 @@ void Tracker::run() if (commands & PAUSE) continue;
commands = 0;
- float dt = time.elapsed() / 1000.0;
+ float dt = time.elapsed();
time.restart();
frame = camera.get_frame(dt);
if (!frame.empty())
{
+ qDebug()<<"processing frame";
const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, draw_frame);
point_tracker.track(points, camera.get_info().f, dt);
frame_count++;
@@ -94,7 +95,6 @@ void Tracker::apply_without_camindex(const TrackerSettings& settings) point_tracker.point_model = boost::shared_ptr<PointModel>(new PointModel(settings.M01, settings.M02));
sleep_time = settings.sleep_time;
draw_frame = settings.video_widget;
- t_MH = settings.t_MH;
}
//-----------------------------------------------------------------------------
@@ -123,7 +123,7 @@ void Tracker::refreshVideo() {
Mat frame_copy;
shared_ptr< vector<Vec2f> > points;
- //qDebug("Tracker::refreshVideo()");
+ qDebug("Tracker::refreshVideo()");
{
QMutexLocker lock(&mutex);
if (!draw_frame || frame.empty()) return;
@@ -152,6 +152,21 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) const float rad2deg = 180.0/3.14159265;
{
QMutexLocker lock(&mutex);
+<<<<<<< .mine
+ // convert to cm
+ data->x = pose.t[0] / 10.0;
+ data->y = pose.t[1] / 10.0;
+ data->z = pose.t[2] / 10.0;
+ const Matx33f& R = pose.R;
+ data->yaw = atan2( -R(2,0), sqrt(R(0,0)*R(0,0) + R(1,0)*R(1,0)) );
+ float cos_beta = cos(data->yaw);
+ if (cos_beta != 0)
+ {
+ data->pitch = rad2deg * atan2( R(2,1)/cos_beta, R(2,2)/cos_beta);
+ data->roll = rad2deg * atan2( R(1,0)/cos_beta, R(0,0)/cos_beta);
+ }
+ data->yaw *= rad2deg;
+=======
FrameTrafo X_CM = point_tracker.get_pose();
FrameTrafo X_MH(Matx33f::eye(), t_MH);
@@ -182,6 +197,7 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) data->yaw = rad2deg * alpha;
data->pitch = rad2deg * beta;
data->roll = rad2deg * gamma;
+>>>>>>> .r148
}
return true;
}
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index 24ecb6f1..6b6af060 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -41,10 +41,6 @@ public: void apply_without_camindex(const TrackerSettings& settings); // changing the camindex is expensive and not suitable for realtime editing
void run();
- void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); }
- int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); }
- void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); }
-
protected:
FrameTrafo X_CH_0; // for centering
@@ -62,7 +58,7 @@ protected: Camera camera;
PointExtractor point_extractor;
PointTracker point_tracker;
- cv::Vec3f t_MH;
+ FrameTrafo X_MH;
bool draw_frame;
int sleep_time;
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h index 81f6fc83..4b92fa72 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h @@ -12,9 +12,6 @@ #include "ftnoir_tracker_pt_settings.h"
#include "ftnoir_tracker_pt.h"
#include "ui_FTNoIR_PT_Controls.h"
-#include "trans_calib.h"
-
-#include <QTimer>
//-----------------------------------------------------------------------------
class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog
@@ -28,8 +25,6 @@ public: void Initialize(QWidget *parent);
void registerTracker(ITracker *tracker);
void unRegisterTracker();
-
- void trans_calib_step();
protected slots:
void doOK();
@@ -50,13 +45,6 @@ protected slots: void set_m2x(int val) { settings.M02[0] = val; settings_changed(); }
void set_m2y(int val) { settings.M02[1] = val; settings_changed(); }
void set_m2z(int val) { settings.M02[2] = val; settings_changed(); }
- void set_tx(int val) { settings.t_MH[0] = val; settings_changed(); }
- void set_ty(int val) { settings.t_MH[1] = val; settings_changed(); }
- void set_tz(int val) { settings.t_MH[2] = val; settings_changed(); }
-
- void startstop_trans_calib(bool start);
-
- void poll_tracker_info();
protected:
void settings_changed();
@@ -65,9 +53,6 @@ protected: bool settings_dirty;
Tracker* tracker;
- TranslationCalibrator trans_calib;
- bool trans_calib_running;
- QTimer timer;
Ui::UICPTClientControls ui;
};
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp index e540d78f..408ac9d2 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp @@ -25,15 +25,13 @@ void TrackerSettings::load_ini() threshold = iniFile.value("PointExtractThreshold", 128).toInt();
min_point_size = iniFile.value("PointExtractMinSize", 2).toInt();
max_point_size = iniFile.value("PointExtractMaxSize", 50).toInt();
- M01[0] = iniFile.value("PointModelM01x", 0).toFloat();
- M01[1] = iniFile.value("PointModelM01y", 40).toFloat();
- M01[2] = iniFile.value("PointModelM01z", -30).toFloat();
- M02[0] = iniFile.value("PointModelM02x", 0).toFloat();
- M02[1] = iniFile.value("PointModelM02y", -70).toFloat();
- M02[2] = iniFile.value("PointModelM02z", -80).toFloat();
- t_MH[0] = iniFile.value("tMHx", 0).toFloat();
- t_MH[1] = iniFile.value("tMHy", 0).toFloat();
- t_MH[2] = iniFile.value("tMHz", 0).toFloat();
+ M01[0] = iniFile.value("PointModelM01x", 0).toFloat();
+ M01[1] = iniFile.value("PointModelM01y", 40).toFloat();
+ M01[2] = iniFile.value("PointModelM01z", -30).toFloat();
+ M02[0] = iniFile.value("PointModelM02x", 0).toFloat();
+ M02[1] = iniFile.value("PointModelM02y", -70).toFloat();
+ M02[2] = iniFile.value("PointModelM02z", -80).toFloat();
+ //TODO: headpos
video_widget = iniFile.value("VideoWidget", true).toBool();
sleep_time = iniFile.value("SleepTime", 10).toInt();
@@ -61,9 +59,7 @@ void TrackerSettings::save_ini() const iniFile.setValue("PointModelM02x", M02[0]);
iniFile.setValue("PointModelM02y", M02[1]);
iniFile.setValue("PointModelM02z", M02[2]);
- iniFile.setValue("tMHx", t_MH[0]);
- iniFile.setValue("tMHy", t_MH[1]);
- iniFile.setValue("tMHz", t_MH[2]);
+ //TODO: headpos
iniFile.setValue("VideoWidget", video_widget);
iniFile.setValue("SleepTime", sleep_time);
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h index de0366e9..18ff6e37 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h @@ -27,8 +27,8 @@ struct TrackerSettings cv::Vec3f M01;
cv::Vec3f M02;
- // head to model translation
- cv::Vec3f t_MH;
+ // head pos
+ FrameTrafo X_MH;
int sleep_time;
bool video_widget;
diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp index 90093032..cbe3e9da 100644 --- a/FTNoIR_Tracker_PT/point_tracker.cpp +++ b/FTNoIR_Tracker_PT/point_tracker.cpp @@ -223,8 +223,8 @@ void PointTracker::POSIT(float f) X_CM.t[1] = p[0][1] * Z0/f;
X_CM.t[2] = Z0;
- //qDebug()<<"iter: "<<i;
- //qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2];
+ qDebug()<<"iter: "<<i;
+ qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2];
//Vec3f r;
//Rodrigues(X_CM.R, r);
//qDebug()<<"r: "<<r[0]<<' '<<r[1]<<' '<<r[2]<<'\n';
|