Getting a list of all the active users
In this recipe, we are going to cover one of the most basic features of NiTE—recognizing users in the scene based on the depth sensor's data.
Our main goal in this recipe is to present the nite::UserTracker
and nite::UserTrackerFrameRef
objects and to show you a basic way to retrieve and use them.
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...
Add the following line to the top of your source code (just below the
#include
lines):#include<conio.h>
Add the
ReadLastCharOfLine()
andHandleStatus()
functions from previous recipes next to the preceding line.Add the following lines next to the definition of the
ReadLastCharOfLine()
andHandleStatus()
functions:bool HandleStatus(nite::Status status) { return HandleStatus((openni::Status)status); }
Then locate this line:
int _tmain(int argc, _TCHAR* argv[]) {
Then...