我正在开发一个 kinect 手势应用程序。所以我从互联网上得到了一个举手手势的代码。
handupgesture()
{
bool up = false;
float refDistance = 0.2F;
SkeletonPoint refPos = localSkeletonHistory[0].Joints[JointType.ShoulderCenter].Position;
SkeletonPoint startPos = localSkeletonHistory[0].Joints[JointType.HandRight].Position;
for (int i = 20; i < localSkeletonHistory.Count; i++)
{
if (!(Math.Abs(localSkeletonHistory[i].Joints[JointType.ShoulderCenter].Position.Y - refPos.Y) < 0.05F &&
Math.Abs(localSkeletonHistory[i].Joints[JointType.HandRight].Position.X - startPos.X) < 0.05F &&
Math.Abs(localSkeletonHistory[i].Joints[JointType.HandRight].Position.Z - startPos.Z) < 0.05F ))
{
break;
}
if (localSkeletonHistory[i].Joints[JointType.HandRight].Position.Y >= (startPos.Y + refDistance))
{
up = true;
SkeletonHistory.Clear();
break;
}
}
return up;
}
我的疑问是:
- 什么是0.05F?是米吗?厘米?
- Z轴距离是指关节到kinect距离的距离。是吗 ?
此代码未检测到 hand up。有什么错误或建议吗?