ofxOpenNI + crude depths


I’ve setup a quick project to detect number of users and depth of each user in front of my kinect.
I’m using this fork of ofxOpenNI… https://github.com/gameoverhack/ofxOpenNI

My strategy was to use this to detect users, and then iterate through each user to find the depth of that user. The only way I can see how to do this is to test for an individual limbs.

Quite often the entire user returns as NULL, and there is no information for the skeleton. When I do get values for the skeleton, they print out to be 0. All I really need is a crude depth for the whole body, rather than individual skeleton points.

Am I missing a really easy way to do this?



if (isTracking) {  
			numberUsers = recordUser.getNumberOfTrackedUsers();  
		if (numberUsers > 0) {  
			// OSC out the number of users found  
			addMessage("/found", numberUsers);  
			// iterate through number of tracked users    
			for (int user = 0; user < numberUsers; user++) {    
				// get ref to a tracked user    
				ofxTrackedUser * trackedUser = recordUser.getTrackedUser(user);    
				if (trackedUser != NULL) {    
					int right_upper_torsoX = trackedUser->right_upper_torso.position[0].X;    
					int right_upper_torsoY = trackedUser->right_upper_torso.position[0].Y;    
					int right_upper_torsoZ = trackedUser->right_upper_torso.position[0].Z;    
					addMessage("/" + ofToString(user) + "/right_upper_torso/X/", right_upper_torsoX);  
					addMessage("/" + ofToString(user) + "/right_upper_torso/Y/", right_upper_torsoY);  
					addMessage("/" + ofToString(user) + "/right_upper_torso/Z/", right_upper_torsoZ);  
		} else {  
			// tell OSC there are no users  
			addMessage("/found", 0);  

Try float instead of int on right_upper_torsoX.

If I remember rightly, you only get position info if the user is tracked, i.e. they’ve done the calibration pose.

It might be worth looking at arturos version of ofxOpenNI2 anyway as he has changed quite a bit

Also I don’t know if this will work yet as means updating the addon, but…

“New unstable NITE release - No calibration pose needed!”