gameoverhack / ofxOpenNI

Wrapper for OpenNI, NITE and SensorKinect
gingold.com.au
Other
246 stars 121 forks source link

user thresholding/hot spot #42

Open cindyloo opened 10 years ago

cindyloo commented 10 years ago

Gameover you mentioned updated hotspot code on GitHub? But I don't see any User/Threshold/Mask stuff (the Hand example doesn't seem to work the way I need) that can help the following situation:

Currently - I've set the DepthThreshold here:

ofxOpenNIDepthThreshold depthThreshold = ofxOpenNIDepthThreshold(0,3500, false, true, true, true, true); openNIDevice.addDepthThreshold(depthThreshold);

and, I want the threshold to control whether the users are "seen" numBodies = openNIDevice.getNumTrackedUsers(); if (numBodies >0){ // 'tracked' users are still found regardless of depth!!! ofPushMatrix(); ofEnableBlendMode(OF_BLENDMODE_ALPHA); // iterate through users for (int i = 0; i < numBodies; i++){ ofxOpenNIUser & body = openNIDevice.getTrackedUser(i); body.setUseMaskTexture(true);

                body.setUseMaskPixels(true);
                ofPixels p =  body.getMaskPixels();
                body.drawMask();
                //not working reliably b/c UserTracking event may not have fired yet
                //ofxOpenNIROI roi = depththreshold.getROI()
                //roi.inside(body.getCentroid())

...

however, getNumTrackedUsers() finds these users even if they are beyond the threshold.

What do I need to set to "register" the thresholding and control the viewport (ignoring users above z ==3500 for example)

I've tried the roi.inside() and a number of other possibilities but it doesn't work for users before they are technically "found" so I can't depend on the USER_TRACKED event.position. USER_CALIBRATION_REGISTERED doesn't have position info...

thanks for any ideas!!! Cindy