summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/tracker.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-02-12 16:13:30 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-02-12 16:13:30 +0000
commit63ce1b5dc62e5c1a079f8a675c0a4371adb27d29 (patch)
tree0a8ac58de927502c9f33d97a2c82966ae980e54a /FaceTrackNoIR/tracker.cpp
parenta8a619f078f543b56e8ae785d92844b806444195 (diff)
Displaying headpose-data seemed to cause crashes.
Update is now done in FaceTrackNoIR.cpp, using a timer. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@51 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/tracker.cpp')
-rw-r--r--FaceTrackNoIR/tracker.cpp79
1 files changed, 47 insertions, 32 deletions
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index c8208023..6455f9b6 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -258,7 +258,7 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
bool DLL_Ok;
// retrieve pointers to the User Interface and the main Application
- headPoseWidget = head;
+// headPoseWidget = head;
mainApp = parent;
if (selectedTracker == FT_SM_FACEAPI) {
@@ -277,15 +277,6 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
pTracker->StartTracker();
}
- // set up the line edits for calling
- headXLine = headPoseWidget->findChild<QLineEdit *>("headXLine");
- headYLine = headPoseWidget->findChild<QLineEdit *>("headYLine");
- headZLine = headPoseWidget->findChild<QLineEdit *>("headZLine");
-
- headRotXLine = headPoseWidget->findChild<QLineEdit *>("headRotXLine");
- headRotYLine = headPoseWidget->findChild<QLineEdit *>("headRotYLine");
- headRotZLine = headPoseWidget->findChild<QLineEdit *>("headRotZLine");
-
//
// Check if the Protocol-server files were installed OK.
// Some servers also create a memory-mapping, for Inter Process Communication.
@@ -320,9 +311,6 @@ void Tracker::run() {
bool lastStartStopKey = false;
bool lastInhibitKey = false;
- float rawrotX, rawrotY, rawrotZ; // Locals...
- float rawposX, rawposY, rawposZ;
-
SYSTEMTIME now;
long newHeadPoseTime;
float dT;
@@ -336,6 +324,27 @@ void Tracker::run() {
smEngineHeadPoseData temp_head_pose; // headpose from faceAPI
# endif
+ current_camera_position.x = 0.0f;
+ current_camera_position.y = 0.0f;
+ current_camera_position.z = 0.0f;
+ current_camera_position.yaw = 0.0f;
+ current_camera_position.pitch = 0.0f;
+ current_camera_position.roll = 0.0f;
+
+ target_camera_position.x = 0.0f;
+ target_camera_position.y = 0.0f;
+ target_camera_position.z = 0.0f;
+ target_camera_position.yaw = 0.0f;
+ target_camera_position.pitch = 0.0f;
+ target_camera_position.roll = 0.0f;
+
+ new_camera_position.x = 0.0f;
+ new_camera_position.y = 0.0f;
+ new_camera_position.z = 0.0f;
+ new_camera_position.yaw = 0.0f;
+ new_camera_position.pitch = 0.0f;
+ new_camera_position.roll = 0.0f;
+
//
// Test some Filter-stuff
//
@@ -533,22 +542,6 @@ void Tracker::run() {
MessageBeep (MB_ICONASTERISK);
Tracker::set_initial = true;
}
-
- rawrotX = Tracker::Pitch.headPos- Tracker::Pitch.initial_headPos; // degrees
- rawrotY = Tracker::Yaw.headPos- Tracker::Yaw.initial_headPos;
- rawrotZ = Tracker::Roll.headPos - Tracker::Roll.initial_headPos;
- rawposX = Tracker::X.headPos - Tracker::X.initial_headPos; // centimeters
- rawposY = Tracker::Y.headPos - Tracker::Y.initial_headPos;
- rawposZ = Tracker::Z.headPos - Tracker::Z.initial_headPos;
-
- headRotXLine->setText(QString("%1").arg( rawrotX, 0, 'f', 1)); // show degrees
- headRotYLine->setText(QString("%1").arg( rawrotY, 0, 'f', 1));
- headRotZLine->setText(QString("%1").arg( rawrotZ, 0, 'f', 1));
-
- headXLine->setText(QString("%1").arg( rawposX, 0, 'f', 1)); // show centimeters
- headYLine->setText(QString("%1").arg( rawposY, 0, 'f', 1));
- headZLine->setText(QString("%1").arg( rawposZ, 0, 'f', 1));
-
}
//
@@ -614,21 +607,30 @@ void Tracker::run() {
server_Game->setHeadRotY( new_camera_position.yaw );
server_Game->setHeadRotZ( new_camera_position.roll );
- server_Game->setHeadPosX( new_camera_position.x ); // centimeters
+ server_Game->setHeadPosX( new_camera_position.x ); // centimeters
server_Game->setHeadPosY( new_camera_position.y );
server_Game->setHeadPosZ( new_camera_position.z );
}
// All Protocol server(s)
if (server_Game) {
- server_Game->setVirtRotX ( new_camera_position.pitch ); // degrees
+ server_Game->setVirtRotX ( new_camera_position.pitch ); // degrees
server_Game->setVirtRotY ( new_camera_position.yaw );
server_Game->setVirtRotZ ( new_camera_position.roll );
- server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
+ server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
server_Game->setVirtPosY ( new_camera_position.y );
server_Game->setVirtPosZ ( new_camera_position.z );
}
+// headRotXLine->setText(QString("%1").arg( new_camera_position.pitch, 0, 'f', 1)); // show degrees
+// headRotYLine->setText(QString("%1").arg( new_camera_position.yaw, 0, 'f', 1));
+// headRotZLine->setText(QString("%1").arg( new_camera_position.roll, 0, 'f', 1));
+//
+//// headXLine->setText(QString("%1").arg( new_camera_position.x, 0, 'f', 1)); // show centimeters
+// headYLine->setText(QString("%1").arg( new_camera_position.y, 0, 'f', 1));
+// headZLine->setText(QString("%1").arg( new_camera_position.z, 0, 'f', 1));
+
+
# ifdef USE_DEBUG_CLIENT
debug_Client->setHeadRotX( Tracker::Pitch.headPos ); // degrees
debug_Client->setHeadRotY( Tracker::Yaw.headPos );
@@ -848,6 +850,19 @@ void Tracker::setPowCurve( int x ) {
}
//
+// Set the filter-value from the GUI.
+//
+void Tracker::getHeadPose( THeadPoseData *data ) {
+ data->x = Tracker::X.headPos - Tracker::X.initial_headPos; // centimeters
+ data->y = Tracker::Y.headPos - Tracker::Y.initial_headPos;
+ data->z = Tracker::Z.headPos - Tracker::Z.initial_headPos;
+
+ data->pitch = Tracker::Pitch.headPos- Tracker::Pitch.initial_headPos; // degrees
+ data->yaw = Tracker::Yaw.headPos- Tracker::Yaw.initial_headPos;
+ data->roll = Tracker::Roll.headPos - Tracker::Roll.initial_headPos;
+}
+
+//
// Get the Smoothed value from the QList.
//
float Tracker::getSmoothFromList ( QList<float> *rawList ) {