ofxKinect and ofxOpenCv track position

Hello all !

I am using a kinect to add a video some effects when approaching a hand to the kinect.

i already have a thresholded depth image and get a blob of my hand.

I would like to use the position of the blob and the distance from the kinect to add some variation to the effect.

How can i get the position and the distance of the blob ?

thank you

PS : i am using oF 0.8.3 in OSX Mavericks with XCode 5. Using original ofxKinect and ofxOpenCv addons

I haven’t used it before, but I believe what you are looking for is ofxKinect::getDistancePixels or ofxKinect::getDistanceAt. Both give you floats that correspond to the distance from the camera.

Well yes i saw these methods but was looking for a solution to get a pixel to pass to these functions.
I found a solution (which is not perfect but that’s a start) when looking into openCV in ofxContourFinder which is used to detect blobs.

Then here i can use contourFinder.blobs.at(0).centroid to access the average track point of a blob.

I can then grab the distance with :


thank you for the help.