|
|
Head Tracking Integration Guide
Pre-note:
I really appreciate knowing how other people are using
this technology, so
please let me know about your project and in
return I will put something up about it on my website.
-
Before integrating any of the head tracking work, make your
project into a Visual Studio C++ project and ensure that it
compiles and runs.
-
Go to the Seeing Machines website
(www.seeingmachines.com)
and download the non-commercial FaceAPI. Install it and
try running building of their test applications.
-
Copy the FaceAPI headers and smft21.lib (found under the
Seeing Machines directory) to somewhere sensible in your
project folder.
-
Within Visual Studio, go into your project properties and...
-
add the header file directory to "Additional Include
Files"
-
add exception handling (/EHsc)
-
add smft21.lib to "Additional Library Directories"
-
From the non-commercial FaceAPI, use
the TestConsoleApp.cpp as a basis for fetching the head
data.
As example, here is some sample code,
that has
refactored this code into object. If you include these classes
into your project, you can then retrieve
the head data using the following code:
#include "facesdk/face_api.h"
#include "sm_api_geomtypes.h"
...
void STDCALL receiveHeadPose(void *, smEngineHeadPoseData head_pose)
{
DevMsg("pos(%.2f, %.2f, %.2f)\n",
head_pose.head_pos.x,
head_pose.head_pos.y,
head_pose.head_pos.z);
DevMsg("rot(%.2f, %.2f, %.2f)\n",
radToDeg(head_pose.head_rot.x_rads),
radToDeg(head_pose.head_rot.y_rads),
radToDeg(head_pose.head_rot.z_rads));
DevMsg("con: %f\n",
head_pose.confidence);
}
...
// declaration
FaceAPI face_api;
...
// initialisation code
face_api.init();
face_api.start(&receiveHeadPose);
...
// during low confidence
face_api.reset();
...
// clean up code
face_api.end();
Disclaimer: this code was writen for an earlier version of the
FaceAPI.
-
Once you've compiled your program, place the FaceAPI DLLs
and resource folder into the same directory as your exe
(these files are also found under the Seeing Machines
directory) and then run it.
|
|