The depth values returned by the kinect sensor correspond to the real world z distance (in mm) from the xy-plane. So far I can't find anything in the latest sdk that returns anything similar for the x and y coordinates. Is this provided in the sdk? Failing that, what would be a good way of computing x and y?
1 Answers
6
votes
You can use KinectSensor.MapDepthToSkeletonPoint method which return a SkeletonPoint. The sample code can be
using (DepthImageFrame depthimageFrame = e.OpenDepthImageFrame())
{
if (depthimageFrame == null)
{
return;
}
pixelData = new short[depthimageFrame.PixelDataLength];
depthimageFrame.CopyPixelDataTo(pixelData);
for (int x = 0; x < depthimageFrame.Width; x++)
{
for (int y = 0; y < depthimageFrame.Height; y++)
{
SkeletonPoint p = sensor.MapDepthToSkeletonPoint(DepthImageFormat.Resolution640x480Fps30, x, y, pixelData[x + depthimageFrame.Width * y]);
}
}
}