summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_SM
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-03-08 22:10:06 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-03-08 22:10:06 +0000
commit7dc20f380c80b1b0597e619e66d23921f0309aa0 (patch)
treec5fb83c3b97b825112433a81ee3dfafe96dba84e /FTNoIR_Tracker_SM
parent63ce1b5dc62e5c1a079f8a675c0a4371adb27d29 (diff)
Start after update 1.5
Begin placing faceAPI in DLL git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@52 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_SM')
-rw-r--r--FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h44
-rw-r--r--FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj266
-rw-r--r--FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user65
-rw-r--r--FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp142
4 files changed, 517 insertions, 0 deletions
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h
new file mode 100644
index 00000000..0687730a
--- /dev/null
+++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h
@@ -0,0 +1,44 @@
+#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
+#include "ui_FTNoIR_SMClientcontrols.h"
+
+#include <sm_api_qt.h>
+#include <QMessageBox>
+#include <QSettings>
+#include "Windows.h"
+#include "math.h"
+
+using namespace sm::faceapi;
+using namespace sm::faceapi::qt;
+
+class FTNoIR_Tracker_SM : public ITracker
+{
+public:
+ FTNoIR_Tracker_SM();
+ ~FTNoIR_Tracker_SM();
+
+ void Release();
+ void Initialize();
+ void StartTracker();
+ void GiveHeadPoseData(THeadPoseData *data);
+ void loadSettings();
+
+ bool setParameterValue(const int index, const float newvalue);
+
+private:
+ /** face api variables **/
+ APIScope *faceapi_scope;
+ QSharedPointer<EngineBase> _engine;
+ smEngineHandle _engine_handle;
+
+ THeadPoseData newHeadPose; // Structure with new headpose
+
+ //parameter list for the filter-function(s)
+ enum
+ {
+ kPortAddress=0, // Index in QList
+ kNumFilterParameters // Indicate number of parameters used
+ };
+ QList<std::pair<float,float>> parameterRange;
+ QList<float> parameterValueAsFloat;
+
+};
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj
new file mode 100644
index 00000000..243e919b
--- /dev/null
+++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="FTNoIR_Tracker_SM"
+ ProjectGUID="{26346BCF-92A5-47A7-B4CF-73C402F7C3AD}"
+ RootNamespace="FTNoIR_Tracker_SM"
+ Keyword="Qt4VSv1.0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)/bin"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".\GeneratedFiles;&quot;$(QTDIR)\include&quot;;&quot;.\GeneratedFiles\$(ConfigurationName)&quot;;&quot;$(QTDIR)\include\qtmain&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtNetwork&quot;;&quot;$(QTDIR)\include\QtGui&quot;;.\;&quot;$(SM_API_PATH)\include&quot;;&quot;$(SM_API_CPP_WRAPPERS)\include&quot;;&quot;$(SM_API_QTDIR)\include&quot;;&quot;$(SM_API_WIDGETS)\include&quot;"
+ PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_THREAD_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;FTNOIR_TRACKER_BASE_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib QtNetwork4.lib smft32.lib smftcpp.lib smftqt.lib"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ AdditionalLibraryDirectories="$(QTDIR)\lib"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;.\"
+ PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_THREAD_SUPPORT,QT_CORE_LIB,FTNOIR_TRACKER_SM_LIB"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qtmaind.lib QtCored4.lib"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ AdditionalLibraryDirectories="$(QTDIR)\lib"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;cxx;c;def"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\ftnoir_tracker_faceapi.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\FTNoIR_Tracker_SM.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ AdditionalDependencies=""
+ Outputs=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ AdditionalDependencies=""
+ Outputs=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Form Files"
+ Filter="ui"
+ UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="qrc;*"
+ UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
+ ParseFiles="false"
+ >
+ </Filter>
+ <Filter
+ Name="Generated Files"
+ Filter="moc;h;cpp"
+ UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
+ SourceControlFiles="false"
+ >
+ <Filter
+ Name="Release"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ </Filter>
+ <Filter
+ Name="Debug"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="lupdateOnBuild"
+ Value="0"
+ />
+ <Global
+ Name="MocDir"
+ Value=".\GeneratedFiles\$(ConfigurationName)"
+ />
+ <Global
+ Name="MocOptions"
+ Value=""
+ />
+ <Global
+ Name="QtVersion Win32"
+ Value="QT462_VS2005"
+ />
+ <Global
+ Name="RccDir"
+ Value=".\GeneratedFiles"
+ />
+ <Global
+ Name="UicDir"
+ Value=".\GeneratedFiles"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user
new file mode 100644
index 00000000..12f78238
--- /dev/null
+++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.vcproj.VRIEND200810.Wim.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="VRIEND200810"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=$(QTDIR)\bin;&quot;$(QTDIR)\bin;$(PATH)"
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="VRIEND200810"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=$(QTDIR)\bin;&quot;$(QTDIR)\bin;$(PATH)"
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp
new file mode 100644
index 00000000..930ce090
--- /dev/null
+++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp
@@ -0,0 +1,142 @@
+#include "ftnoir_tracker_sm.h"
+
+using namespace sm::faceapi;
+using namespace sm::faceapi::qt;
+
+FTNoIR_Tracker_SM::FTNoIR_Tracker_SM()
+{
+ //allocate memory for the parameters
+ parameterValueAsFloat.clear();
+ parameterRange.clear();
+
+ // Add the parameters to the list
+ parameterRange.append(std::pair<float,float>(1000.0f,9999.0f));
+ parameterValueAsFloat.append(0.0f);
+ setParameterValue(kPortAddress,5551.0f);
+
+ newHeadPose.x = 0.0f;
+ newHeadPose.y = 0.0f;
+ newHeadPose.z = 0.0f;
+ newHeadPose.yaw = 0.0f;
+ newHeadPose.pitch = 0.0f;
+ newHeadPose.roll = 0.0f;
+}
+
+FTNoIR_Tracker_SM::~FTNoIR_Tracker_SM()
+{
+}
+
+void FTNoIR_Tracker_SM::Release()
+{
+ delete this;
+}
+
+void FTNoIR_Tracker_SM::Initialize()
+{
+ qDebug() << "FTNoIR_Tracker_SM::Initialize says: Starting ";
+ loadSettings();
+
+ 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());
+
+ // starts the faceapi engine
+ _engine->start();
+ }
+ catch (sm::faceapi::Error &e)
+ {
+ /* ERROR with camera */
+ QMessageBox::warning(0,"faceAPI Error",e.what(),QMessageBox::Ok,QMessageBox::NoButton);
+ }
+
+ return;
+}
+
+void FTNoIR_Tracker_SM::StartTracker()
+{
+ return;
+}
+
+void FTNoIR_Tracker_SM::GiveHeadPoseData(THeadPoseData *data)
+{
+ data->x = newHeadPose.x;
+ data->y = newHeadPose.y;
+ data->z = newHeadPose.z;
+ data->yaw = newHeadPose.yaw;
+ data->pitch = newHeadPose.pitch;
+ data->roll = newHeadPose.roll;
+ return;
+}
+
+bool FTNoIR_Tracker_SM::setParameterValue(const int index, const float newvalue)
+{
+ if ((index >= 0) && (index < parameterValueAsFloat.size()))
+ {
+ //
+ // Limit the new value, using the defined range.
+ //
+ if (newvalue < parameterRange[index].first) {
+ parameterValueAsFloat[index] = parameterRange[index].first;
+ }
+ else {
+ if (newvalue > parameterRange[index].second) {
+ parameterValueAsFloat[index] = parameterRange[index].second;
+ }
+ else {
+ parameterValueAsFloat[index] = newvalue;
+ }
+ }
+
+// updateParameterString(index);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+};
+
+//
+// Load the current Settings from the currently 'active' INI-file.
+//
+void FTNoIR_Tracker_SM::loadSettings() {
+
+ qDebug() << "FTNoIR_Tracker_SM::loadSettings says: Starting ";
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+
+ qDebug() << "FTNoIR_Tracker_SM::loadSettings says: iniFile = " << currentFile;
+
+ iniFile.beginGroup ( "FTNClient" );
+ setParameterValue(kPortAddress, (float) iniFile.value ( "PortNumber", 5550 ).toInt());
+ iniFile.endGroup ();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Tracker object.
+
+// Export both decorated and undecorated names.
+// 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")
+
+FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+{
+ return new FTNoIR_Tracker_SM;
+}