Tuesday, March 22, 2011

Aligning ofxOpenNI Skeleton and Point Cloud

Currently, the ofxOpenNI addon puts the skeleton in projective space instead of leaving it in real space. To change this, remove the following line from ofxTrackedUser.cpp inside ofxTrackedUser::updateLimb():

ConvertRealWorldToProjective(2, pos, pos);

If you are computing the point cloud with a flipped y axis, you also need to flip the skeleton at this point:

pos[0].Y *= -1;
pos[1].Y *= -1;

From here, the data is ready to be used. If you want to see it, you need to change one more thing. Inside ofxTrackedUser.h, in ofxLimb::debugDraw():

glVertex2f(begin.x, begin.y);
glVertex2f(end.x, end.y);

Needs to be changed to:

glVertex3f(begin.x, begin.y, begin.z);
glVertex3f(end.x, end.y, end.z);

No comments:

Post a Comment