Microsoft Kinect SDK深度数据到真实世界的坐标

Sim*_*lla 15 kinect

我正在使用Microsoft Kinect SDK从Kinect获取深度和颜色信息,然后将该信息转换为点云.我需要深度信息在真实世界坐标中,以相机中心为原点.

我见过很多转换函数,但这些函数显然适用于OpenNI和非Microsoft驱动程序.我已经读过来自Kinect的深度信息已经是以毫米为单位,并且包含在11位......或其他内容中.

如何将此位信息转换为我可以使用的真实世界坐标?

提前致谢!

Lew*_*nge 10

这适用于使用Microsoft.Research.Kinect.Nui.SkeletonEngine类的Kinect for Windows库,以及以下方法:

public Vector DepthImageToSkeleton (
    float depthX,
    float depthY,
    short depthValue
)
Run Code Online (Sandbox Code Playgroud)

该方法将基于真实世界的测量结果将由Kinect产生的深度图像映射到矢量可缩放的深度图像.

从那里(当我在过去创建网格时),在枚举由Kinect深度图像创建的位图中的字节数组之后,您创建一个新的Vector点列表,类似于以下内容:

        var width = image.Image.Width;
        var height = image.Image.Height;
        var greyIndex = 0;

        var points = new List<Vector>();

        for (var y = 0; y < height; y++)
        {
            for (var x = 0; x < width; x++)
            {
                short depth;
                switch (image.Type)
                {
                    case ImageType.DepthAndPlayerIndex:
                        depth = (short)((image.Image.Bits[greyIndex] >> 3) | (image.Image.Bits[greyIndex + 1] << 5));
                        if (depth <= maximumDepth)
                        {
                            points.Add(nui.SkeletonEngine.DepthImageToSkeleton(((float)x / image.Image.Width), ((float)y / image.Image.Height), (short)(depth << 3)));
                        }
                        break;
                    case ImageType.Depth: // depth comes back mirrored
                        depth = (short)((image.Image.Bits[greyIndex] | image.Image.Bits[greyIndex + 1] << 8));
                        if (depth <= maximumDepth)
                        {
                            points.Add(nui.SkeletonEngine.DepthImageToSkeleton(((float)(width - x - 1) / image.Image.Width), ((float)y / image.Image.Height), (short)(depth << 3)));
                        }
                        break;
                }

                greyIndex += 2;
            }
        }
Run Code Online (Sandbox Code Playgroud)

通过这样做,最终结果是以毫米为单位存储的向量列表,如果你想要厘米乘以100(等等).