OpenNI Skeleton Tracking

Hey, i’ve just stumpled upon this amazing new initiative: An open source natural interaction library, from the guys doing the technology behind the kinect! Skeleton tracking that works!

At the moment it only works on linux and windows, but i’m really up to trying compiling it for mac, and make it into a addon. Anybody with me?

There are some nice videos and texts here aswell:…-?p=5306483

1 Like

I’ve also been trying it out…


Wow, that is super exciting :stuck_out_tongue:
I’ve been looking for this very long…
We’ve created Animata (, where I used EyesWeb to track the skeleton, but now it seems that we can have out own tracker…
is it running in openframeworks?
can you share some advice or example how to use the library?


Hi all,

I’m not a pro in c++, but finally I got openNI running in OF, so the addon idea would be really nice!!

I’ve had some trouble getting the callbacks work.
I’ve used the Players example, and I put everything in the testApp.h

void XN_CALLBACK_TYPE NewUser(xn::UserGenerator& generator, XnUserID user, void* pCookie);  
void XN_CALLBACK_TYPE LostUser(xn::UserGenerator& generator, XnUserID user, void* pCookie);  

and tryed to register the callbacks in the setup():

XnCallbackHandle hUserCBs;  
g_UserGenerator.RegisterUserCallbacks(&testApp::NewUser, &testApp::LostUser, NULL, hUserCBs);  

when I got this error message:

cannot convert parameter 1 from ‘void (__stdcall testApp::* )(xn::UserGenerator &,XnUserID,void *)’ to ‘xn::UserGenerator::UserHandler’

so I ended up putting every callback related stuf in the main.h, and hack it togeter like this:

app = new testApp();  
app->setupOpenNI(&g_Context, &g_UserGenerator, &g_DepthGenerator, &g_nPlayer);  
ofRunApp( app );   

Which is probably the ugliest way to do it :slight_smile:
But I can say this framework is superb!!

it’s on my todo list too :smiley:

Man, that’s really cool! awesome! :shock:

Here are the steps to install openNI + NITE:




From the NITE examples I used Sample-Players


@bnc: on what platform are you working? On linux I can run the examples, but when I try to integrate it with OF in Code::Blocks I get into a few troubles…

I use windows and vs2008, I’ve copyed all lib-s and .h file into my src forler

surprisingly I didn’t get any error message, I only had problems width the callbacks.
I’m not sure if I can halp you, but maybe if you post the errors, othres can…



I’ll give Visual Studio a try.

Here’s what’s happening here:

  • on Ubuntu Karmic I could comile OpenNI, Nite with make / make install and run the samples
  • when I try to create a new project in Code::Blocks, as soon as I include xnOpenNI.h I get a “two or more data types in declaration of parameter” error from xnStatus.h

I’ll let you know if I manage to solve the problem…

Hi naus3a. Did you manage to find the cause of the problem? I’m getting the same error messages, and can’t figure it out:

/home/user/src/openFrameworks/apps/myApps/kinect_test_4/src/ni/include/XnStatus.h|54|error: two or more data types in declaration of ‘parameter’|  
/home/user/src/openFrameworks/apps/myApps/kinect_test_4/src/ni/include/XnStatus.h|63|error: two or more data types in declaration of ‘parameter’|  
/home/user/src/openFrameworks/apps/myApps/kinect_test_4/src/ni/include/XnStatus.h|72|error: two or more data types in declaration of ‘parameter’|  
/home/user/src/openFrameworks/apps/myApps/kinect_test_4/src/ni/include/XnStatus.h|72|error: expected ‘)’ before ‘,’ token|  
/home/user/src/openFrameworks/apps/myApps/kinect_test_4/src/ni/include/XnStatus.h|72|error: expected unqualified-id before ‘const’|  

Hi there,
here is my vs2008 project, it’s a very simple tracker, but working very well! maybe a starting point for an addon…
you’ll have to install the Prime Sense - Sensor drivers for your kinect to run it on windows.…


chris, does it do that ‘calibration’ step for every person that walks into the scene, or just once the first time it boots up?

@kyle from the google group…

"The pose purpose is to start learning the dimensions of the user (called the calibration process, learns the length of the limbs, user height, etc).

NITE implementation requires this pose specifically, as there’s no nice way to otherwise provide the calibration data.

You can however save the calibration data of a user, and then reapply it. That would mean you would need to recognize the user yourself (for example, Face recognition), and decide which pre-saved calibration data to assign to the user. "


"When running stick figure, please move a bit in the scene in order to be recognized. Once recognize, perform the calibration pose and you’re set.

Primesense Support. "

ok, so basically if you want to use this in an installation context… people need to strike the calibration pose before they can start working with it.

have you seen what the accuracy is like if you use one person’s calibration data on another person?

or maybe just do it for people of a few different heights and pick one that’s approximately correct?

@wayfarer_boy : did not have the time to investigate further; if I find workaround I’ll post it it here

@bnc : thanks I’ll test it before new year :slight_smile:

very, very small update: I quickly tried the code on a win machine:

  • first I tried an emply project, just including OpenNI on code::blocks: it does not compile properly and crashes into an #ifdef that check the visual studio version

  • so I took an empty OF visual studio project, added the OpenNI libraries as indicated in the user guide, added the #include “XnCppWrapper.h” and it compiled withouth problems.

this made me a little sad because I don’t like visual studio very much.

Hey Chris. I’ve been trying to run your code using the latest version of OF in snow leopard but i keep getting an error that says that there is no file or directory called highgui.h. I know this is an opencv error but i can’t figure out why i would not have that class included in my addon.

because highgui is the portable GUI toolkit that ships with openCV; it has functions for making windows, drawing lines, points and other stuff that is handled more powerfully in OF, so it isn’t included in ofxOpenCV.

I did not see the code you’re talking about, but generally speaking, when porting raw OpenCV code to OF, you can comment the highgui.h include and correct the eventual errors by changing the OpenCV drawing calls to their OF counterparts (ie: cvLine() -> ofLine()).

hi, i follow your steps but when i run NiViewer.exe i get “Error: A timeout has occured when waiting for new data”
i also tried your code in it compiles correctly but when i run it i only get a black window and the fps just falls from 60 to 0…
i’m using windows XP
below is my setup steps:
4.dpinst-x86.exe from avin2-SensorKinect-b7cd39d\avin2-SensorKinect-b7cd39d\Platform\Win32\Driver

[quote author=“bnc”]Here are the steps to install openNI + NITE:




From the NITE examples I used Sample-Players