Finding the related user ID for each hand ID
When dealing with nite::HandTracker
and nite::HandData
, there is no way to find out which hand belongs to which user. Actually, there is no direct way of finding this out in NiTE at all. In this recipe, we will show you how it's possible to use nite::UserTracker
and nite::UserMap
along with nite::HandTracker
and nite::HandData
to determine the user ID of each hand.
Getting ready
Create a project in Visual Studio and prepare it for working with OpenNI and NiTE using the Create a project in Visual Studio 2010 recipe in Chapter 2, OpenNI and C++.
How to do it...
Copy
ReadLastCharOfLine()
andHandleStatus()
from the first recipe of this chapter to the top of your source code (just below the#include
lines).Then, locate the following line:
int _tmain(int argc, _TCHAR* argv[]) {
Add the following code inside the preceding line:
nite::Status status = nite::STATUS_OK; status = nite::NiTE::initialize(); if (!HandleStatus(status)) return 1; printf("Creating...