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

本文关键字:Kinect 计算 | 更新日期: 2023-09-27 18:08:54

我正在做一个项目,将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左右。我仔细检查了算法和编码,非常困惑。感谢您的任何建议。

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

我想你的问题可能是:

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

AL在您复制的代码中不存在。你是说HR吗?