Kinect V2-保存身体数据

时间:2016-03-16 02:57:08

标签: c# kinect kinect-sdk

我正在使用Kinect V2 SDK在C#中编写程序,并且正在努力记录Body数据。我试图将BodyFrame保存到文件中,但它不可序列化,也不是Body类。实现这一目标的最佳方法是什么?我目前的想法是保存每个框架中每个关节中每个关节的位置数据,但我感觉会很快变得复杂。建议?我在下面附加了Microsoft的一些示例BodyBasics代码,它将身体数据分解为关节。谢谢!

if (body.IsTracked)
{
     //this.DrawClippedEdges(body, dc);
     IReadOnlyDictionary<JointType, Joint> joints = body.Joints;

     // convert the joint points to depth (display) space
     Dictionary<JointType, Point> jointPoints = new Dictionary<JointType, Point>();

     foreach (JointType jointType in joints.Keys)
     {
         // sometimes the depth(Z) of an inferred joint may show as negative
         // clamp down to 0.1f to prevent coordinatemapper from returning (-Infinity, -Infinity)
         CameraSpacePoint position = joints[jointType].Position;
         if (position.Z < 0)
         {
             position.Z = InferredZPositionClamp;
         }

         DepthSpacePoint depthSpacePoint = this.coordinateMapper.MapCameraPointToDepthSpace(position);
         jointPoints[jointType] = new Point(depthSpacePoint.X, depthSpacePoint.Y);
      } 

1 个答案:

答案 0 :(得分:1)

使用JSON.net

expressions