将kinect关节位置映射到2d点

时间:2012-10-05 22:32:42

标签: xna kinect

我是XNA中使用官方Kinect SDK 1.5进行编程的新手。如何将Skeleton关节的位置映射到XNA 2D屏幕以匹配图像流?

1 个答案:

答案 0 :(得分:2)

这很简单,因为Kinect SDK提供了一些Mapping辅助方法。

MapSkeletonPointToColor将为您提供2D色框中SkeletonPoint的位置。你只需要传递两个参数:你的骨架点和目标颜色框架格式。

foreach (Joint joint in skeleton.Joints)
{
    // Transforms a SkeletonPoint to a ColorImagePoint
    var colorPoint = Kinect.MapSkeletonPointToColor(joint.Position, Kinect.ColorStream.Format);

    // colorPoint has two properties : X and Y which gives you the positions in the 2D color frame.
    // TODO : Do something with the colorPoint value. 
}
相关问题