# Accurate distance to kinect with Openni

Hi, I know this question might be very easy but I could not find a direct solution for that in the previous questions. I have a kinect and I use openni_tracker to detect the person's joint. Now I want to find the distance of the person to the camera. I know that I receive XYZ information for every joint, and in my case X will be the distance to the camera, but I want to use another node (openni_camera) to find out distance information, it is needed to be very accurate! I am not very familiar with PCL or Open_CV. Do I need to use them? Which topic in openni_camera will give me the calibrated and accurate depth (distance) information? I just need the distance of the person (for example his torso) from the camera every time.

edit retag close merge delete

Sort by » oldest newest most voted

openni_tracker broadcasts tf data for the body pose (not just XYZ data), and to be clear, X DOES NOT represent the distance from the camera, it represents the X coordinate of the 3D position of that point in some coordinate frame.

If you want to find the distance of the tracked person from the camera, you should choose one of the frames that openni_tracker broadcasts (torso might be a good choice), then lookup the transform between camera_depth_optical_frame and torso. Once you have that transform, you can take the translation X,Y,Z values and use the Pythagorean theorem to find the distance. No OpenCV or PCL required.

more