简体   繁体   English

如何从kinect深度数据确定“真实世界”的x,y坐标?

[英]How to determine “real world” x, y coordinates from kinect depth data?

The depth values returned by the kinect sensor correspond to the real world z distance (in mm) from the xy-plane. kinkin传感器返回的深度值对应于与xy平面的真实世界z距离(以mm为单位)。 So far I can't find anything in the latest sdk that returns anything similar for the x and y coordinates. 到目前为止,我在最新的sdk中找不到任何返回x和y坐标相似内容的东西。 Is this provided in the sdk? 这是在SDK中提供的吗? Failing that, what would be a good way of computing x and y? 如果不这样做,什么是计算x和y的好方法?

You can use KinectSensor.MapDepthToSkeletonPoint method which return a SkeletonPoint. 您可以使用KinectSensor.MapDepthToSkeletonPoint方法,该方法返回SkeletonPoint。 The sample code can be 示例代码可以是

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]);                        
                }
            }

        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM