【发布时间】:2015-04-23 15:08:05
【问题描述】:
对此很抱歉,但我需要对这个函数和计算进行一些确认
我目前有这些向量:
Vector3D ElbowLeft = new Vector3D(body.Joints[JointType.ElbowLeft].Position.X, body.Joints[JointType.ElbowLeft].Position.Y, body.Joints[JointType.ElbowLeft].Position.Z);
Vector3D WristLeft = new Vector3D(body.Joints[JointType.WristLeft].Position.X, body.Joints[JointType.WristLeft].Position.Y, body.Joints[JointType.WristLeft].Position.Z);
Vector3D ShoulderLeft = new Vector3D(body.Joints[JointType.ShoulderLeft].Position.X, body.Joints[JointType.ShoulderLeft].Position.Y, body.Joints[JointType.ShoulderLeft].Position.Z);
Vector3D Head = new Vector3D(body.Joints[JointType.Head].Position.X, body.Joints[JointType.Head].Position.Y, body.Joints[JointType.Head].Position.Z);
Vector3D Neck = new Vector3D(body.Joints[JointType.Neck].Position.X, body.Joints[JointType.Neck].Position.Y, body.Joints[JointType.Neck].Position.Z);
Vector3D SpineShoulder = new Vector3D(body.Joints[JointType.SpineShoulder].Position.X, body.Joints[JointType.SpineShoulder].Position.Y, body.Joints[JointType.SpineShoulder].Position.Z);
我正在使用这个函数计算两个向量之间的角度
public double AngleBetweenTwoVectors(Vector3D vectorA, Vector3D vectorB)
{
double dotProduct = 0.0;
vectorA.Normalize();
vectorB.Normalize();
dotProduct = Vector3D.DotProduct(vectorA, vectorB);
return (double)Math.Acos(dotProduct) / Math.PI * 180;
}
我这样称呼它:
double LeftElbowAngle = AngleBetweenTwoVectors(ElbowLeft - ShoulderLeft, ElbowLeft - WristLeft);
double NeckAngle = AngleBetweenTwoVectors(Neck - Head, Neck - SpineBase);
这是正确的吗?我只是怀疑自己,因为当我伸直手臂或站直时,它会检测到大约 170 - 175 而不是 180 的角度。在我的脖子和肘关节上
【问题讨论】:
-
请记住,那里有 3 个维度,让手臂或头部完全笔直可能并不容易。其他角度如何?
-
左/右肘关节是 170-178ish,在我看来是直臂。当我完全笔直站立时,颈部也大致相同。与腿的膝盖相同。而且我还没有弄清楚如何进行手腕计算,因为 Kinect 还将手腕连接到拇指......我的朋友帮助我确认一切在数学上都是正确的。
-
45、90 和 135 度怎么样?看起来还好吗?
-
是的,当我将手臂移动到看起来像直角的地方时,它会在 80-90 之间波动。 45 也是一样,它们似乎主要波动 10。就像当我完全伸直手臂时,它不会给我像 120 这样的奇怪东西。
-
听起来它工作正常。我猜想 kinects 的深度精度根本不足以给你一个完美的直线 3D 线。如果手臂完全笔直,它可能也很难真正很好地跟踪肘关节。