From edd74a92a7d6e3c11d2409ba34085073185af43f Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Fri, 21 Jan 2011 16:26:41 +0000 Subject: Starting work on Tracker in DLL git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@40 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FaceTrackNoIR/FaceTrackNoIR.vcproj | 28 ++++++++++++++++------------ FaceTrackNoIR/tracker.cpp | 23 +++++++++++++++++++++++ FaceTrackNoIR/tracker.h | 10 ++++++++++ 3 files changed, 49 insertions(+), 12 deletions(-) (limited to 'FaceTrackNoIR') diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj index 7eebeece..2ec885e4 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.vcproj +++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj @@ -47,7 +47,7 @@ OmitFramePointers="false" EnableFiberSafeOptimizations="false" WholeProgramOptimization="false" - AdditionalIncludeDirectories=".\GeneratedFiles;"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\QtOpenGL";"$(QTDIR)\include\QtWebKit";"$(QTDIR)\include\QtTest";"$(SM_API_PATH)\include";"$(SM_API_CPP_WRAPPERS)\include";"$(SM_API_QTDIR)\include";"$(SM_API_WIDGETS)\include"" + AdditionalIncludeDirectories=".\GeneratedFiles;"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\QtOpenGL";"$(QTDIR)\include\QtWebKit";"$(QTDIR)\include\QtTest";"$(SM_API_PATH)\include";"$(SM_API_CPP_WRAPPERS)\include";"$(SM_API_QTDIR)\include";"$(SM_API_WIDGETS)\include";"$(SolutionDir)\FTNoIR_Tracker_UDP"" PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_THREAD_SUPPORT;QT_NO_DEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_OPENGL_LIB;QT_NETWORK_LIB;QT_DLL" RuntimeLibrary="2" FloatingPointModel="2" @@ -195,6 +195,10 @@ Filter="cpp;cxx;c;def" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > + + @@ -254,7 +258,7 @@ @@ -280,7 +284,7 @@ @@ -306,7 +310,7 @@ @@ -332,7 +336,7 @@ @@ -362,7 +366,7 @@ @@ -388,7 +392,7 @@ @@ -418,7 +422,7 @@ @@ -444,7 +448,7 @@ @@ -478,7 +482,7 @@ @@ -508,7 +512,7 @@ @@ -534,7 +538,7 @@ diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index d1ebe6ea..974b1251 100644 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -82,6 +82,8 @@ TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking /** constructor **/ Tracker::Tracker( int clientID, int facetrackerID ) { +importGetTracker getIT; +QLibrary *trackerLib; // Remember the selected client, from the ListBox // If the Tracker runs, this can NOT be changed... @@ -117,7 +119,23 @@ Tracker::Tracker( int clientID, int facetrackerID ) { QMessageBox::warning(0,"faceAPI Error",e.what(),QMessageBox::Ok,QMessageBox::NoButton); } break; + case FT_FTNOIR: + trackerLib = new QLibrary("FTNoIR_Tracker_UDP.dll"); + + getIT = (importGetTracker) trackerLib->resolve("GetTracker"); + + if (getIT) { + ITrackerPtr ptrXyz(getIT()); + if (ptrXyz) + { + pTracker = ptrXyz; + qDebug() << "Tracker::setup Function Resolved!"; + } + } + else { + QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton); + } break; default: @@ -224,6 +242,11 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) { smLoggingSetFileOutputEnable( false ); } + if (selectedTracker == FT_FTNOIR) { + int fooResult = pTracker->Foo(42); + qDebug() << "Tracker::setup Foo gives: " << fooResult; + } + // set up the line edits for calling headXLine = headPoseWidget->findChild("headXLine"); headYLine = headPoseWidget->findChild("headYLine"); diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index b7a653d9..20fd60d8 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -45,6 +45,15 @@ #include "ExcelServer.h" // Excel-server (for analysing purposes) #include "FTNoIR_cxx_protocolserver.h" +#include "FTNoIR_Tracker_base.h" +#include "AutoClosePtr.h" + +// 1a. COM-Like usage with smart pointer. +// No need to call `ITracker::Release'; the instance will +// be released automatically in destructor of the smart pointer. +typedef AutoClosePtr ITrackerPtr; +typedef ITracker *(WINAPI *importGetTracker)(void); + // include the DirectX Library files #pragma comment (lib, "dinput8.lib") #pragma comment (lib, "dxguid.lib") @@ -129,6 +138,7 @@ private: APIScope *faceapi_scope; QSharedPointer _engine; smEngineHandle _engine_handle; + ITrackerPtr pTracker; // Pointer to Tracker instance (in DLL) /** static callback method for the head pose tracking **/ static void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame); -- cgit v1.2.3