OpenNI skeleton tracks only once each run

Hey there.

I understand OpenNI is a bit out of date. But did’t find a better way for skeleton tracking.
After a few painful days, finally managed to get Kinect work on mac with Openframeworks(OF0.9.8, High Sierra 10.13.4) Didnt succeed with OF 0.10

The hand tracking is neat. Skeleton tracking is working, but the issue I am having is every time I go out of the picture, I cant be redetected when I go back. The detection only gives one shot for each run. This is a real pain for me, I have to rerun the app if I need to change the user. But the hand tracking is always there, even if I go to take a piss and come back.

I assume I have something to do with MaxNumUsers or getNumTrackedUsers… But did’t work out.

Can someone please help on this?
Thanks so much.

Or any better solution for Head Tracking? I know OpenCV would do that job, but I need it to work in dark and also a wider detecting range is preferred.

as you correcly say, OpenNI is super outdated. I have not used it on a mac for a long while, and even I dont remember how to fix the problems you are facing, although I can recall that I had to go through those at some point.
My advice to you is to run Windows and use the kinect sdk. it runs much better than openNi, specially if you use the kinect v2. OpenFrameworks runs very nicely with VisualStudio too.
If you insist on using OpenNi, there are several addons for it, as well as the openNi and Nite versions. Make sure you have the newest ones. as for the addons I remember that ofxNI2 was really good. check out in for all the available addons

Thanks so much, man.

Got some USB3 controller issues with windows as well, the kinect V2 keeps switching on and off…
So I moved back to Mac and Kinect V1.

I am trying to install ofxNI2 now,
didn’t really understand the readme,
Add to Run Script

cp -R ../../../addons/ofxNI2/libs/OpenNI2/lib/osx/ "$TARGET_BUILD_DIR/$";
cp -R ../../../addons/ofxNI2/libs/NiTE2/lib/osx/ "$TARGET_BUILD_DIR/$";


//#define HAVE_NITE2

in ofxNI2.h to use NiTE2.

Just feel the all kinect things are old, how should people do tracking in these days?

well yes. it is old stuff.
add to run script stuff you should add it to the xcode project configuration. clic on the xcode right pane, above the project files there is a blue icon with the project name. clic on it. From the main panel select “build Phases”. There is a plus sign, clic on it and choose to add a new run script phase. There you should paste thaat stuff,

I’ve been keeping ofxOpenNI working in my fork:

Been using it with openframeworks 0.10.0 on OSX Mojave.

  1. Add it to your project with the projectgenerator
  2. copy the contents of copy_contents_to_data_folder to your data folder.

No need to add extra build scripts.

Hey Wouter,

Yours is so cool, so easy to add and build.
But I still have the same issue, the first detection is instant.
But once I lost my detection, can not be redetected.

Could it be something wrong with my src code?

Here is my ofApp.cpp

#include "ofApp.h"

void ofApp::setup(){

    mode = false;

void ofApp::update(){


void ofApp::draw(){
        ofSetColor(255, 0, 0);
        ofDrawCircle(50,50, 10);
        ofSetColor(0, 255, 0);
        ofDrawCircle(50, 50, 10);
    ofTranslate(200, 50, - 100);
    if(kinect.getNumTrackedUsers() > 0 ){
        ofxOpenNIUser user = kinect.getTrackedUser(0);
        for(int i = 0; i < user.getNumLimbs(); i ++){
            ofxOpenNILimb limb = user.getLimb((enum Limb) i);
            if( limb.isFound()){
                float x1 = limb.getStartJoint().getProjectivePosition().x;
                float y1 = limb.getStartJoint().getProjectivePosition().y;
               float x2 = limb.getEndJoint().getProjectivePosition().x;
                float y2 = limb.getEndJoint().getProjectivePosition().y;
                ofDrawLine(x1, y1, x2, y2);
        ofVec2f pos;
        for( int i = 0 ; i < user.getNumJoints(); i ++){
            ofxOpenNIJoint joint = user.getJoint((enum Joint)i);
                mode = true;
                ofSetColor(0, 255, 0, 100  );
                float x = joint.getProjectivePosition().x;
                float y = joint.getProjectivePosition().y;
                pos.set(x, y);
                ofDrawCircle(pos.x, pos.y, 10);
                mode = false;

Thanks so much., I’ve got it built successfully. But I guess it is because the library is too old or something, no picture is showing up…

Got some information from console

/BuildRoot/Library/Caches/ Error: unsupported compressor 8

/BuildRoot/Library/Caches/ Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist’

/BuildRoot/Library/Caches/ Error: unsupported compressor 8

/BuildRoot/Library/Caches/ Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/AppExceptions.bundle/Exceptions.plist’

Could not find data file ./NiTE2/s.dat

current working directory = /Users/bian/Documents/of_v0.9.8_osx_release/apps/myApps/NI2test/bin

[ error ] ofxNiTE2:

[ error ] ofPixels: image type not supported

[ error ] ofPixels: image type not supported

Hi, those are related to the file system. I dont use High Sierra so I cant tell. But certainly you are missing the ./NiTE2/s.dat file. I think that that one should be in the same directory as the executable, which I guess is /Users/bian/Documents/of_v0.9.8_osx_release/apps/myApps/NI2test/bin/

FYI, for anyone using the Kinect 2 on Mac, there’s a cleaned up version of OpenNI2 with skeleton tracking working here:

1 Like