ofxKinect and ofxOpenNI


I have got ofxKinect with uses libfreenect and libusb to work.

Separately, I have got ofxOpenNI to work which uses PrimeSense’s usb drivers to work.

When I try to use both at the same time, I run into issues.

Here’s the code:

// ofxOpenNI setup calls for skeleton tracker
user.setup(&context, &depth);

// ofxKinect setup calls

The ofxKinect setup calls aren’t working. I’m guessing this is because the ofxOpenNI setup calls open the kinect device then the ofxKinect setup calls try to open an already open device.

The only reason I want the ofxKinect library is to make the call:


If anyone knows how to either get the distance pixels from ofxOpenNI or how to get the two libraries to work together, I’d really appreciate it!


openNI can give you really precise depth information.
You can look into ofxDepthImageGenerator / generateTexture. It generates a textures from the distance information.
OpenNI can also gives you x, y, and z in mm in real world from the center of the kinect with the scene analyzer, but probably also by just analyzing depth image or user information.
I will soon release a tracking addons using kinect where you can already have a look here :
(there is actually a bug with osc to resolve before to release it)

also in ofxKinect there’s a class called ofxKinectCalibration that does all the calculations so you can use it without having to start the whole ofxKinect pugin. you can passs it the raw data from ofxOpenNI and it will return the distance pixels and any other calibrated data that you can get from ofxKinect

Hey there

I’ve recently added a bunch of methods for getting depth pixel information using the openNI drivers in my fork of ofxOpenNI.

It’s at https://github.com/gameoverhack/ofxopenni