ofxOpenNI and center of mass tracking

Hi folks,

I am using the ofxOpenNI addon from gameoverhack and trying to implement a center of mass tracking without the skeleton. This was pretty simple to do with the processing simpleni, but in OF it seems the center is only tracked when the skeleton is found. Does anyone have an example of how to alter this?


If you dont want to use the skeleton, maybe you can use a basic blob tracking by define a depth range so later you can get a centroid for each blob. hope that helps

Thanks, yes that would be another way to do it I suppose…

I managed to make it work adding this function:

ofPoint ofxOpenNI::getCenterOfMass(int nID){  
	XnPoint3D center;  
	g_User.GetCoM(nID, center);  
	return toOf(center);  

mmmmm, but this function requiere that you pass the id of the tracker person… or im wrong? so if you have that id means that you are using the skeleton… maybe im wrong.

well, openni records the positions of users before a skeleton is found. this makes sense to me as it would need to know where the user is in order to try to calibrate and match a skeleton. the ofxopenni addon i am using (have not tried others yet) uses the naming convention of trackedUsers, but I think it is really found users. the addon is currently not recording the centers before the skeleton is found (thus the need for my hack above) … in my case i want to have the application react before the skeleton is found or even if it is not found.

@mapupi did you also set the skeleton profile variable to XN_SKEL_PROFILE_NONE? I set to this value as it is done in the P5 example, but doing so it didn’t solve my problem. The skeleton needs to be tracked to get the CoM.

I thought this setting and then the calling to the getCentre() function could be enough to get the CoM since it is calculated in the updateUserTracker() function (wich is called by updategeneratos() and update()).
That’s why I didn’t implement a function as you did. Any take why this setting isn’t enough? Thanks.

ofxOpenNI - gameover master branch
OpenNI 1.5.4 unstable
NITE 1.5. 2 unstable
OS Ubuntu 64 bits

I respond to myself, according to my ofxOpenNI version to get the center of mass without doing skeleton tracking I needed to create some functions. I added a new constructor which receives the skeleton profile as a parameter and a function that return the center of mass of the users visibles.
If I apply the one of the addon it seems the users visibles are bonded to the skeleton tracking. I don’t know if I am correct, but that was my manner.

ofxOpenN: gameoverhack master branch
OpenNI 1.5.4
NITE 1.5.2
OS: Ubuntu 12.04 64 bits.