【发布时间】:2016-03-16 02:57:08
【问题描述】:
我正在使用 Kinect V2 SDK 用 C# 编写程序,并正在努力记录身体数据。我试图将 BodyFrame 保存到一个文件中,但它不是可序列化的,Body 类也不是。实现这一目标的最佳方法是什么?我目前的想法是在每一帧中保存每个身体中每个关节的位置数据,但我有一种感觉会很快变得复杂。建议?我在下面附上了微软的部分 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);
}
【问题讨论】:
标签: c# kinect kinect-sdk