summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_SM
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-03-22 21:34:47 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-03-22 21:34:47 +0000
commit277cc7603eb6b4d9fed6a0a2de245e4cdde6ee8b (patch)
tree1774fa28018005e4c96f5717d6d461dfb0123d5f /FTNoIR_Tracker_SM
parentbe57b6b8d3f8339980df08f196d23415f7974418 (diff)
Successfully use console app for faceAPI 3.2.6. combined with tracker class in DLL.
Even managed to get the video-widget connected to the main-window... git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@56 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_SM')
-rw-r--r--FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h2
-rw-r--r--FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp88
2 files changed, 28 insertions, 62 deletions
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h
index 5bed0a16..1edc612f 100644
--- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h
+++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h
@@ -19,7 +19,7 @@ public:
void Release();
void Initialize( QFrame *videoframe );
void StartTracker( HWND parent_window );
- void StopTracker();
+ void StopTracker( bool exit );
bool GiveHeadPoseData(THeadPoseData *data); // Returns true if confidence is good
void loadSettings();
bool SMCreateMapping();
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp
index a7f0668e..358ad962 100644
--- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp
+++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp
@@ -18,22 +18,22 @@ FTNoIR_Tracker_SM::~FTNoIR_Tracker_SM()
qDebug() << "stopTracker says: terminating";
if ( pMemData != NULL ) {
- pMemData->command = 100; // Issue 'stop' command
UnmapViewOfFile ( pMemData );
}
CloseHandle( hSMMutex );
CloseHandle( hSMMemMap );
hSMMemMap = 0;
-
- //_engine->stop();
- //smAPIQuit();
}
void FTNoIR_Tracker_SM::Release()
{
qDebug() << "FTNoIR_Tracker_SM::Release says: Starting ";
- delete this;
+
+ if ( pMemData != NULL ) {
+ pMemData->command = FT_SM_EXIT; // Issue 'exit' command
+ }
+ delete this;
}
void FTNoIR_Tracker_SM::Initialize( QFrame *videoframe )
@@ -48,91 +48,57 @@ void FTNoIR_Tracker_SM::Initialize( QFrame *videoframe )
QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton);
}
+ if ( pMemData != NULL ) {
+ pMemData->command = 0; // Reset any and all commands
+ pMemData->handle = videoframe->winId(); // 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);
-
- ////try {
- //// // Initialize the faceAPI Qt library
- //// sm::faceapi::qt::initialize();
- //// smLoggingSetFileOutputEnable( false );
-
- //// // Initialize the API
- //// faceapi_scope = new APIScope();
-
- //// //if (APIScope::internalQtGuiIsDisabled()){
- //// // QMessageBox::warning(0,"faceAPI Error","Something Bad",QMessageBox::Ok,QMessageBox::NoButton);
- //// //}
-
- //// // Create head-tracking engine v2 using first detected webcam
- //// CameraInfo::registerType(SM_API_CAMERA_TYPE_WDM);
- //// _engine = QSharedPointer<HeadTrackerV2>(new HeadTrackerV2());
-
- ////}
- ////catch (sm::faceapi::Error &e)
- ////{
- //// /* ERROR with camera */
- //// QMessageBox::warning(0,"faceAPI Error",e.what(),QMessageBox::Ok,QMessageBox::NoButton);
- ////}
-
-
+ QString program = "FTNoIR_FaceAPI_EXE.exe";
+ faceAPI = new QProcess(0);
+ faceAPI->start(program);
// Show the video widget
qDebug() << "FTNoIR_Tracker_SM::Initialize says: videoframe = " << videoframe;
- //// QMainWindow derived class. See mainwindow.h
- // QSharedPointer<CameraBase> camera;
- // main_window = new MainWindow(camera,_engine,0);
- // main_window->show();
-
- //videoframe->show();
- //_display = new VideoDisplayWidget( _engine, videoframe, 0 );
- //l = new QVBoxLayout(videoframe);
- //l->setMargin(0);
- //l->setSpacing(0);
- //l->addWidget(_display);
-
+ videoframe->show();
return;
}
void FTNoIR_Tracker_SM::StartTracker( HWND parent_window )
{
-
- //// starts the faceapi engine
- //if (_engine->state() != SM_API_ENGINE_STATE_HT_TRACKING) {
- // _engine->start();
- //}
-
- //// some parameteres [optional]
- //smHTSetHeadPosePredictionEnabled( _engine->handle(), false);
- //smHTSetLipTrackingEnabled( _engine->handle(), false);
- //smLoggingSetFileOutputEnable( false );
+ if ( pMemData != NULL ) {
+ pMemData->command = FT_SM_START; // Start command
+ }
return;
}
-void FTNoIR_Tracker_SM::StopTracker()
+void FTNoIR_Tracker_SM::StopTracker( bool exit )
{
qDebug() << "FTNoIR_Tracker_SM::StopTracker says: Starting ";
// stops the faceapi engine
-//// _engine->stop();
+ if ( pMemData != NULL ) {
+// if (exit == true) {
+ pMemData->command = (exit) ? FT_SM_EXIT : FT_SM_STOP; // Issue 'stop' command
+ //}
+ //else {
+ // pMemData->command = FT_SM_STOP; // Issue 'stop' command
+ //}
+ }
return;
}
bool FTNoIR_Tracker_SM::GiveHeadPoseData(THeadPoseData *data)
{
-
- qDebug() << "FTNoIR_Tracker_SM::GiveHeadPoseData says: Starting ";
-
//
// Check if the pointer is OK and wait for the Mutex.
//
if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) {
- qDebug() << "FTNoIR_Tracker_SM::GiveHeadPoseData says: Retrieving data.";
+// qDebug() << "FTNoIR_Tracker_SM::GiveHeadPoseData says: Retrieving data.";
//
// Copy the measurements to FaceTrackNoIR.