getWorldCoordinateAt in ofxOpenNi

What is the equivalent of ofxKinect’s getWorldCoordinateAt in @roymacdonald’s ofxOpenNi?

I assumed it would be cameraToWorld(x,y) but I’m getting a 0 vector. Did I miss an initial flag to openni?

Hi @genekogan,
why are you using my branch? it is quite old and I dont remember why I pushed it.
As for your question, I really don’t remember. Is that a function I added or it was there from the original version?
I recommend you to use the original repo and not my fork.


yes, sorry my mistake, i was using the original branch.
cameraToWorld is in the original version – i am looking for the equivalent way of getting the real world coordinates which ofxKinect does using the function getWorldCoordinateAt.

Hi, that function should be.
make sure you are calling setUseDepthRawPixels(true) in the set up for it to work, otherwise it will not.

okay, i’ve got it.

make sure to set…


on update, grab the pixels.

depthPixels = kinect.getDepthRawPixels();

then the conversion for an ofPoint point.

float z = depthPixels[(int) (point.x + point.y*640)];
ofPoint depthPoint = ofPoint(point.x, points.y, z);
ofVec3f worldPoint = kinect.projectiveToWorld(depthPoint);