none
Depth data to real world coordinates RRS feed

  • Question

  • I'm using the Microsoft Kinect SDK to get the depth and color information from a Kinect and then convert that information into a point cloud. I need the depth information to be in real world coordinates with the centre of the camera as the origin.

    I've seen a number of conversion functions but these are apparently for OpenNI and non-Microsoft drivers. I've read that the depth information coming from the Kinect is already in millimetres, and is contained in the 11bits... or something.

    How do I convert this bit information into real world coordinates that I can use?

    Thanks in advance!

    Monday, January 9, 2012 11:30 PM

All replies

  • Found the answer, for anyone else interested. You need to use nui.SkeletonEngine.DepthImageToSkeleton. And to get the depth value use:

     

            private int GetDistanceWithPlayerIndex(byte firstFrame, byte secondFrame)
            {
                //offset by 3 in first byte to get value after player index
                int distance = (int)(firstFrame >> 3 | secondFrame << 5);
                return distance;
            }

    • Proposed as answer by ni28 Tuesday, January 10, 2012 9:46 AM
    Tuesday, January 10, 2012 3:32 AM
  • You also need to shift the depth value left by 3. Heres my call to the function:

     

    Microsoft.Research.Kinect.Nui.Vector point = nui.SkeletonEngine.DepthImageToSkeleton((float)x / depthBitmap.Width, (float)y / depthBitmap.Height, (short)(depth << 3));

    Tuesday, January 10, 2012 3:33 AM
  • For future reference for anyone looking, this is covered in the Channel 9 kinect quick start tutorials here: http://channel9.msdn.com/Series/KinectSDKQuickstarts/Working-with-Depth-Data :)
    Tuesday, January 10, 2012 9:47 AM