summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp')
-rw-r--r--ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp88
1 files changed, 41 insertions, 47 deletions
diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp
index 624e35a0..35d3a3db 100644
--- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp
+++ b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp
@@ -24,6 +24,7 @@
********************************************************************************/
#include "ftnoir_tracker_sm.h"
#include <QtGui>
+#include "facetracknoir/global-settings.h"
FTNoIR_Tracker::FTNoIR_Tracker()
{
@@ -49,67 +50,60 @@ FTNoIR_Tracker::~FTNoIR_Tracker()
hSMMemMap = 0;
}
-void FTNoIR_Tracker::Initialize( QFrame *videoframe )
-{
- qDebug() << "FTNoIR_Tracker::Initialize says: Starting ";
-
- if (SMCreateMapping()) {
- qDebug() << "FTNoIR_Tracker::Initialize Mapping created.";
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton);
- }
-
- loadSettings();
-
- if ( pMemData != NULL ) {
- pMemData->command = 0; // Reset any and all commands
- if (videoframe != NULL) {
- pMemData->handle = videoframe->winId(); // Handle of Videoframe widget
- }
- else {
- pMemData->handle = NULL; // reset Handle of Videoframe widget
- }
- }
-
- //
- // Start FTNoIR_FaceAPI_EXE.exe. The exe contains all faceAPI-stuff and is non-Qt...
- //
- QString program = "FTNoIR_FaceAPI_EXE.exe";
- faceAPI = new QProcess(0);
- faceAPI->start(program);
-
- // Show the video widget
- qDebug() << "FTNoIR_Tracker::Initialize says: videoframe = " << videoframe;
-
- if (videoframe != NULL) {
- videoframe->show();
- }
- return;
-}
-
-void FTNoIR_Tracker::StartTracker( HWND parent_window )
+void FTNoIR_Tracker::StartTracker(QFrame *videoframe )
{
+ qDebug() << "FTNoIR_Tracker::Initialize says: Starting ";
+
+ if (SMCreateMapping()) {
+ qDebug() << "FTNoIR_Tracker::Initialize Mapping created.";
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton);
+ }
+
+ loadSettings();
+
+ if ( pMemData != NULL ) {
+ pMemData->command = 0; // Reset any and all commands
+ if (videoframe != NULL) {
+ pMemData->handle = videoframe->winId(); // Handle of Videoframe widget
+ }
+ else {
+ pMemData->handle = NULL; // reset Handle of Videoframe widget
+ }
+ }
+
+ //
+ // Start FTNoIR_FaceAPI_EXE.exe. The exe contains all faceAPI-stuff and is non-Qt...
+ //
+ // XXX TODO isolate it into separate directory
+ faceAPI = new QProcess();
+ faceAPI->setWorkingDirectory(QCoreApplication::applicationDirPath() + "/faceapi");
+ faceAPI->start("\"" + QCoreApplication::applicationDirPath() + "/faceapi/ftnoir-faceapi-wrapper" + "\"");
+ // Show the video widget
+ qDebug() << "FTNoIR_Tracker::Initialize says: videoframe = " << videoframe;
+
+ if (videoframe != NULL) {
+ videoframe->show();
+ }
if ( pMemData != NULL ) {
pMemData->command = FT_SM_START; // Start command
}
- return;
}
-void FTNoIR_Tracker::StopTracker( bool exit )
+void FTNoIR_Tracker::WaitForExit()
{
qDebug() << "FTNoIR_Tracker::StopTracker says: Starting ";
// stops the faceapi engine
if ( pMemData != NULL ) {
// if (exit == true) {
- pMemData->command = (exit) ? FT_SM_EXIT : FT_SM_STOP; // Issue 'stop' command
+ pMemData->command = FT_SM_EXIT;
//}
//else {
// pMemData->command = FT_SM_STOP; // Issue 'stop' command
//}
}
- return;
}
bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data)
@@ -246,9 +240,9 @@ bool FTNoIR_Tracker::SMCreateMapping()
// GetTracker - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetTracker@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
+//#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
+extern "C" FTNOIR_TRACKER_BASE_EXPORT void* CALLING_CONVENTION GetConstructor()
{
- return new FTNoIR_Tracker;
+ return (ITracker*) new FTNoIR_Tracker;
}