Frank_Liu
Frank_Liu

Reputation: 55

Kinect2 raw depth to distance in meters

How to convert the Kinect2 raw depthdata to the distance in meters. The raw depthdata was got by Windows Kinect2 SDK. It's all Integral data. Point: It's kinect2 rather than kinect1. I already got the equation of Kinect1,but it's not match. So anyone can help me. The equation of Kinect1:

if (depthValue < 2047) 
{
  depthM = 1.0 / (depthValue*-0.0030711016 + 3.3309495161);
}

Upvotes: 4

Views: 2143

Answers (1)

agold
agold

Reputation: 6276

The Kinect API Overview (2) indicates:

The DepthFrame Class represents a frame where each pixel represents the distance of the closest object seen by that pixel. The data for this frame is stored as 16-bit unsigned integers, where each value represents the distance in millimeters. The maximum depth distance is 8 meters, although reliability starts to degrade at around 4.5 meters. Developers can use the depth frame to build custom tracking algorithms in cases where the BodyFrame Class isn’t enough.

Also V. Pterneas comments in his blog that the values are in meters, he refers to this code. So you could retrieve it from the DepthFrame in C# (extracted partially from this code):

public override void Update(DepthFrame frame)
{
    ushort minDepth = frame.DepthMinReliableDistance;
    ushort maxDepth = frame.DepthMaxReliableDistance;
    //..
    Width = frame.FrameDescription.Width;
    Height = frame.FrameDescription.Height;
    public ushort[] DepthData;
    //...
    frame.CopyFrameDataToArray(DepthData);
    // now Depthdata contains the depth
}

The minimum and maximum depth are given by the functions DepthMinReliableDistance and DepthMaxReliableDistance, also in millimeters.

Upvotes: 3

Related Questions