I’m using OpenNI version 1.5.4.0 and NITE version 1.5.2.21 and I’m on Ubuntu 12.04.
Still using OF 0.8.x
gameoverhack master branch
Most of the parts work, except for one: I can’t see the user masks.
The native OpenNI examples work: I can see user outlines in them. But from OpenFrameworks, I can’t seem to get a user mask.
For each user in my OpenFrameworks code, I can do this:
// "user" is an object returned from ofxOpenNI::getTrackedUser
// This actually displays a skeleton:
user.drawSkeleton();
// These two do nothing:
user.drawMask();
user.drawPointCloud();
I tryed this also, but same result:
void testApp::setup() {
//ofBackground(0,0,0);
ofSetLogLevel(OF_LOG_VERBOSE);
openNIDevice.setup();
openNIDevice.addDepthGenerator();
openNIDevice.addUserGenerator();
ofSetFrameRate(15);
openNIDevice.addImageGenerator();
openNIDevice.setRegister(true);
openNIDevice.setMirror(true);
openNIDevice.setMaxUsers(2);
openNIDevice.setMaxNumUsers(2);
openNIDevice.setMaxUsersVis(2);
//openNIDevice.setSkeletonProfile(XN_SKEL_PROFILE_NONE);
user = new ofxOpenNIUser();
(*user).setUseMaskTexture(true);
(*user).setUseMaskPixels(true);
(*user).setMaskPixelFormat(OF_PIXELS_RGB);
(*user).setUsePointCloud(true);
(*user).setPointCloudDrawSize(2);
(*user).setPointCloudResolution(2);
openNIDevice.setBaseUserClass(*user);
where user is defined in the .h file as ofxOpenNI *user;
In the update I do the following
void testApp::update()
{
openNIDevice.update();
openNIDevice.setMaxUsersVis(2);
.....//nothing special
}
draw:
void testApp::draw(){
// use a blend mode so we can see 'through' the mask(s)
ofEnableBlendMode(OF_BLENDMODE_ALPHA);
//openNIDevice.drawDepth(0, 0);
//openNIDevice.drawImage(640, 0);
int numUsers = openNIDevice.getNumTrackedUsers();
for (int i = 0; i < numUsers; i++){
// get a reference to this user
ofxOpenNIUser & user2 = openNIDevice.getTrackedUser(i);
user = static_cast<ofxOpenNIUser*>(&user2);
// draw the mask texture for this user
user->drawMask();
}
ofDisableBlendMode();
}
Thanks so much in advance