summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/tracker.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-01-24 21:18:52 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-01-24 21:18:52 +0000
commit5a63e2a7735fa982885b1164e35aedbaabf95047 (patch)
tree786a2317a3d51f9116006b44f5eea0f5ab249c2a /FaceTrackNoIR/tracker.cpp
parenta1126d63fe3068cc5651c8c3060647a33e4bb710 (diff)
EWMA2-filter implemented.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@43 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/tracker.cpp')
-rw-r--r--FaceTrackNoIR/tracker.cpp47
1 files changed, 40 insertions, 7 deletions
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index ab2f3b86..c054873d 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -53,7 +53,7 @@
// Definitions for testing purposes
//
#define USE_HEADPOSE_CALLBACK
-#define USE_DEBUG_CLIENT
+//#define USE_DEBUG_CLIENT
using namespace sm::faceapi;
using namespace sm::faceapi::qt;
@@ -80,6 +80,10 @@ TShortKey Tracker::CenterKey; // ShortKey to Center headposition
TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking
TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking
+ITrackerPtr Tracker::pTracker; // Pointer to Tracker instance (in DLL)
+IFilterPtr Tracker::pFilter; // Pointer to Filter instance (in DLL)
+
+
/** constructor **/
Tracker::Tracker( int clientID, int facetrackerID ) {
importGetTracker getIT;
@@ -552,7 +556,6 @@ void Tracker::run() {
if (Tracker::do_tracking && Tracker::confid) {
// Pitch
- current_camera_position = new_camera_position; // Remember the latest position
target_camera_position.x = X.headPos - X.offset_headPos - X.initial_headPos;
target_camera_position.y = Y.headPos - Y.offset_headPos - Y.initial_headPos;
target_camera_position.z = Z.headPos - Z.offset_headPos - Z.initial_headPos;
@@ -607,11 +610,11 @@ void Tracker::run() {
// All Protocol server(s)
if (server_Game) {
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->setVirtPosY ( new_camera_position.y );
- //server_Game->setVirtPosZ ( new_camera_position.z );
+ server_Game->setVirtRotY ( new_camera_position.yaw );
+ server_Game->setVirtRotZ ( new_camera_position.roll );
+ server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
+ server_Game->setVirtPosY ( new_camera_position.y );
+ server_Game->setVirtPosZ ( new_camera_position.z );
}
# ifdef USE_DEBUG_CLIENT
@@ -806,6 +809,36 @@ void Tracker::addRaw2List ( QList<float> *rawList, float maxIndex, float raw ) {
}
//
+// Set the filter-value from the GUI.
+//
+void Tracker::setMinSmooth ( int x ) {
+ if (Tracker::pFilter) {
+ Tracker::pFilter->setParameterValue(0, x);
+ qDebug() << "Tracker::setMinSmooth Min Smooting frames set to: " << x;
+ }
+}
+
+//
+// Set the filter-value from the GUI.
+//
+void Tracker::setMaxSmooth ( int x ) {
+ if (Tracker::pFilter) {
+ Tracker::pFilter->setParameterValue(1, x);
+ qDebug() << "Tracker::setMaxSmooth Max Smooting frames set to: " << x;
+ }
+}
+
+//
+// Set the filter-value from the GUI.
+//
+void Tracker::setPowCurve( int x ) {
+ if (Tracker::pFilter) {
+ Tracker::pFilter->setParameterValue(2, x);
+ qDebug() << "Tracker::setPowCurve Pow Curve set to: " << x;
+ }
+}
+
+//
// Get the Smoothed value from the QList.
//
float Tracker::getSmoothFromList ( QList<float> *rawList ) {