【问题标题】:How do I get player Depth from the data Kinect SDK C#?如何从数据 Kinect SDK C# 中获取播放器深度?
【发布时间】:2012-03-15 21:34:44
【问题描述】:

做一个小组项目,试图在玩家(特别是玩家)近/远时发生一些事情,所以我们编写了这个函数。 (我们不允许使用骨架特征)

private void FindDepth(DepthImageFrame depthFrame)
    {

        short[] rawDepthData = new short[depthFrame.PixelDataLength];
        depthFrame.CopyPixelDataTo(rawDepthData);

        Byte[] pixels = new byte[depthFrame.Height * depthFrame.Width * 4];

        for (int depthIndex = 0; depthIndex < rawDepthData.Length; depthIndex++)
        {
            int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
            int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;

            if (player > 0)
            {
                playerDepth = rawDepthData[depthIndex];
            }

        }

    }

为什么这不能通过抓取一个像素来正确抓取玩家的深度?

【问题讨论】:

    标签: c# kinect


    【解决方案1】:

    深度像素表示为 16 位。低 3 位提供播放器索引,其余 13 位提供深度,例如{深度位}{玩家索引位}

    {0100 1011 1001 0}{010}

    因此,为了找到玩家索引,我们通过 DepthImageFrame.PlayerIndexBitmask 与如下所示

    (0100 1011 1001 0010) AND (0000 0000 0000 0111) = 0000 0000 0000 0010 = 2 即第二个玩家

    为了找到距离,我们右移 3 位,返回 13 位,如下所示 0000 1001 0111 0010 = 2418 即 2418 毫米

    【讨论】:

      【解决方案2】:

      重要的是要记住,只有在以下情况下才会将玩家编号值添加到深度图像中 骨骼跟踪已打开。如果骨骼跟踪关闭,每个深度的玩家编号 值设置为 0。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-24
        • 2016-12-01
        相关资源
        最近更新 更多