使用现有的关节角度计算Kinect骨骼膝关节和肘关节角度

问题描述 投票:1回答:1

我正在开展一个项目,将Kinect捕获的联合数据映射到机器人。我需要计算肘部和膝盖的角度。以左膝为例,我得到髋关节膝盖和膝角矢量,并尝试计算两个矢量之间的角度。代码如下

Vector3D KL = new Vector3D(skeleton.Joints[JointType.KneeLeft].Position.X, skeleton.Joints[JointType.KneeLeft].Position.Y, skeleton.Joints[JointType.KneeLeft].Position.Z);
        Vector3D KR = new Vector3D(skeleton.Joints[JointType.KneeRight].Position.X, skeleton.Joints[JointType.KneeRight].Position.Y, skeleton.Joints[JointType.KneeRight].Position.Z);

        Vector3D HL = new Vector3D(skeleton.Joints[JointType.HipLeft].Position.X, skeleton.Joints[JointType.HipLeft].Position.Y, skeleton.Joints[JointType.HipLeft].Position.Z);
        Vector3D HR = new Vector3D(skeleton.Joints[JointType.HipRight].Position.X, skeleton.Joints[JointType.HipRight].Position.Y, skeleton.Joints[JointType.HipRight].Position.Z);

        //caculte knee angle
        Vector3D AKL = Vector3D.Subtract(AL, KL);
        Vector3D KHL = Vector3D.Subtract(KL, HL);

        double LAngAK_KH = Vector3D.AngleBetween(AKL, KHL);

对于正常的站立姿势,出来的角度应该在180左右。但是,输出总是在15左右。我仔细检查了算法和编码,非常困惑。感谢任何建议。

c# kinect angle
1个回答
0
投票

我认为你的问题可能是:

Vector3D AKL = Vector3D.Subtract(AL, KL);

您复制的代码中不存在AL。 你的意思是人力资源?

© www.soinside.com 2019 - 2024. All rights reserved.