1
votes

I wrote a c# program that worked with the old kinect. My graphics library dealing with the kinect. Since the old Kinect is no longer officially sold, i'm now updating it to the newer kinect one, with its Microsoft SDK2.0. For my updated library i try to keep most coding equal. So i can release an update library instead of the updating the whole program(s)

What i am wondering is, does the new kinect depth data still contains player data as it did in 1.7 SDK i did a bitmask operation to remove that with:

realDepth[i16] = (short)(realDepth[i16] >> DepthImageFrame.PlayerIndexBitmaskWidth);

Is this still needed, i couldnt find any information about its raw depth format.

Also the old Kinect, had some values for

  • distance unknown
  • distance to close
  • distance to far

Does it still provide this ?.

1

1 Answers

0
votes

In Microsoft Kinect SDK 2.0, you do not need the bitmask operation to get the correct depth value.

When you access a DepthFrame object, you can use something like this:

private void ProcessDepthFrame(DepthFrame frame)
{
    int width = frame.FrameDescription.Width;
    int height = frame.FrameDescription.Height;

    ushort minDepth = frame.DepthMinReliableDistance;
    ushort maxDepth = frame.DepthMaxReliableDistance;

    ushort[] depthData = new ushort[width * height];

    frame.CopyFrameDataToArray(depthData);

    int colorIndex = 0;
    for (int depthIndex = 0; depthIndex < depthData.Length; ++depthIndex)
    {
        ushort depth = depthData[depthIndex];
        byte intensity = (byte)(depth >= minDepth && depth <= maxDepth ? depth : 0);

        // Do what you want
    }
}

Also notice that, in the above example, DepthMinReliableDistance and DepthMaxReliableDistance properties of the DepthFrame class are used to figure out if the depth value is valid or not (which is a little different from SDK v1.x).

For more info, check also this tutorial.