Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何确定;“真实世界”;x、 来自kinect深度数据的y坐标?_C#_Kinect - Fatal编程技术网

C# 如何确定;“真实世界”;x、 来自kinect深度数据的y坐标?

C# 如何确定;“真实世界”;x、 来自kinect深度数据的y坐标?,c#,kinect,C#,Kinect,kinect传感器返回的深度值对应于距xy平面的真实z距离(单位:mm)。到目前为止,我在最新的sdk中找不到任何返回类似x和y坐标的东西。sdk中是否提供了此功能?如果做不到这一点,计算x和y的好方法是什么?您可以使用KinectSensor.MapDepthToSkeletonPoint方法,该方法返回一个SkeletonPoint。示例代码可以是 using (DepthImageFrame depthimageFrame = e.OpenDepthImageFrame())

kinect传感器返回的深度值对应于距xy平面的真实z距离(单位:mm)。到目前为止,我在最新的sdk中找不到任何返回类似x和y坐标的东西。sdk中是否提供了此功能?如果做不到这一点,计算x和y的好方法是什么?

您可以使用KinectSensor.MapDepthToSkeletonPoint方法,该方法返回一个SkeletonPoint。示例代码可以是

using (DepthImageFrame depthimageFrame = e.OpenDepthImageFrame())
        {
            if (depthimageFrame == null)
            {
                return;
            }

            pixelData = new short[depthimageFrame.PixelDataLength];

            depthimageFrame.CopyPixelDataTo(pixelData);

            for (int x = 0; x < depthimageFrame.Width; x++)
            {
                for (int y = 0; y < depthimageFrame.Height; y++)
                {
                        SkeletonPoint p = sensor.MapDepthToSkeletonPoint(DepthImageFormat.Resolution640x480Fps30, x, y, pixelData[x + depthimageFrame.Width * y]);                        
                }
            }

        }
使用(DepthImageFrame DepthImageFrame=e.OpenDepthImageFrame())
{
if(depthimageFrame==null)
{
返回;
}
pixelData=新短[depthimageFrame.PixelDataLength];
CopyPixelDataTo(pixelData);
对于(int x=0;x