Body joints angle using Kinect

系统 1862 0
      
        
          http://stackoverflow.com/questions/12608734/body-joints-angle-using-kinect-checking-time-interval?rq=1
          
http://stackoverflow.com/questions/15989322/calculate-kinect-skeleton-knee-and-elbow-angles-using-existing-joint-angles
http://channel9.msdn.com/coding4fun/kinect/Kinect-Earth-Move
http://social.msdn.microsoft.com/Forums/en-US/8516bab7-c28b-4834-82c9-b3ef911cd1f7/using-kinect-to-calculate-angles-between-human-body-joints
public static double myMethodZY(Joint j1, Joint j2, Joint j3) { Vector3 a = new Vector3(0, j1.Position.Y- j2.Position.Y, j1.Position.Z- j2.Position.Z); Vector3 b = new Vector3(0, j3.Position.Y - j2.Position.Y, j3.Position.Z - j2.Position.Z); a.Normalize(); b.Normalize(); double dotProduct = Vector3.Dot(a,b); double angle= Math.Acos(dotProduct); angle = angle * 180 / Math.PI; //angle = 180 - angle; return angle; }

f you are using Kinect SDK to get the skeletal tracking, the you can use this:

      
        
          /// <summary>
        
        
          /// Return the angle between 3 Joints
        
        
          /// Regresa el ángulo interno dadas 3 Joints
        
        
          /// </summary>
        
        
          /// <param name="j1"></param>
        
        
          /// <param name="j2"></param>
        
        
          /// <param name="j3"></param>
        
        
          /// <returns></returns>
        
        
          public
        
        
          static
        
        
          double
        
        
          AngleBetweenJoints
        
        
          (
        
        
          Joint
        
        
           j1
        
        
          ,
        
        
          Joint
        
        
           j2
        
        
          ,
        
        
          Joint
        
        
           j3
        
        
          )
        
        
          {
        
        
          double
        
        
          Angulo
        
        
          =
        
        
          0
        
        
          ;
        
        
          double
        
        
           shrhX 
        
        
          =
        
        
           j1
        
        
          .
        
        
          Position
        
        
          .
        
        
          X 
        
        
          -
        
        
           j2
        
        
          .
        
        
          Position
        
        
          .
        
        
          X
        
        
          ;
        
        
          double
        
        
           shrhY 
        
        
          =
        
        
           j1
        
        
          .
        
        
          Position
        
        
          .
        
        
          Y 
        
        
          -
        
        
           j2
        
        
          .
        
        
          Position
        
        
          .
        
        
          Y
        
        
          ;
        
        
          double
        
        
           shrhZ 
        
        
          =
        
        
           j1
        
        
          .
        
        
          Position
        
        
          .
        
        
          Z 
        
        
          -
        
        
           j2
        
        
          .
        
        
          Position
        
        
          .
        
        
          Z
        
        
          ;
        
        
          double
        
        
           hsl 
        
        
          =
        
        
           vectorNorm
        
        
          (
        
        
          shrhX
        
        
          ,
        
        
           shrhY
        
        
          ,
        
        
           shrhZ
        
        
          );
        
        
          double
        
        
           unrhX 
        
        
          =
        
        
           j3
        
        
          .
        
        
          Position
        
        
          .
        
        
          X 
        
        
          -
        
        
           j2
        
        
          .
        
        
          Position
        
        
          .
        
        
          X
        
        
          ;
        
        
          double
        
        
           unrhY 
        
        
          =
        
        
           j3
        
        
          .
        
        
          Position
        
        
          .
        
        
          Y 
        
        
          -
        
        
           j2
        
        
          .
        
        
          Position
        
        
          .
        
        
          Y
        
        
          ;
        
        
          double
        
        
           unrhZ 
        
        
          =
        
        
          j3
        
        
          .
        
        
          Position
        
        
          .
        
        
          Z 
        
        
          -
        
        
           j2
        
        
          .
        
        
          Position
        
        
          .
        
        
          Z
        
        
          ;
        
        
          double
        
        
           hul 
        
        
          =
        
        
           vectorNorm
        
        
          (
        
        
          unrhX
        
        
          ,
        
        
           unrhY
        
        
          ,
        
        
           unrhZ
        
        
          );
        
        
          double
        
        
           mhshu 
        
        
          =
        
        
           shrhX 
        
        
          *
        
        
           unrhX 
        
        
          +
        
        
           shrhY 
        
        
          *
        
        
           unrhY 
        
        
          +
        
        
           shrhZ 
        
        
          *
        
        
           unrhZ
        
        
          ;
        
        
          double
        
        
           x 
        
        
          =
        
        
           mhshu 
        
        
          /
        
        
          (
        
        
          hul 
        
        
          *
        
        
           hsl
        
        
          );
        
        
          if
        
        
          (
        
        
          x 
        
        
          !=
        
        
          Double
        
        
          .
        
        
          NaN
        
        
          )
        
        
          {
        
        
          if
        
        
          (-
        
        
          1
        
        
          <=
        
        
           x 
        
        
          &&
        
        
           x 
        
        
          <=
        
        
          1
        
        
          )
        
        
          {
        
        
          double
        
        
           angleRad 
        
        
          =
        
        
          Math
        
        
          .
        
        
          Acos
        
        
          (
        
        
          x
        
        
          );
        
        
          Angulo
        
        
          =
        
        
           angleRad 
        
        
          *(
        
        
          180.0
        
        
          /
        
        
          Math
        
        
          .
        
        
          PI
        
        
          );
        
        
          }
        
        
          else
        
        
          Angulo
        
        
          =
        
        
          0
        
        
          ;
        
        
          }
        
        
          else
        
        
          Angulo
        
        
          =
        
        
          0
        
        
          ;
        
        
          return
        
        
          Angulo
        
        
          ;
        
        
          }
        
        
          /// <summary>
        
        
          /// Euclidean norm of 3-component Vector
        
        
          /// </summary>
        
        
          /// <param name="x"></param>
        
        
          /// <param name="y"></param>
        
        
          /// <param name="z"></param>
        
        
          /// <returns></returns>
        
        
          private
        
        
          static
        
        
          double
        
        
           vectorNorm
        
        
          (
        
        
          double
        
        
           x
        
        
          ,
        
        
          double
        
        
           y
        
        
          ,
        
        
          double
        
        
           z
        
        
          )
        
        
          {
        
        
          return
        
        
          Math
        
        
          .
        
        
          Sqrt
        
        
          (
        
        
          Math
        
        
          .
        
        
          Pow
        
        
          (
        
        
          x
        
        
          ,
        
        
          2
        
        
          )
        
        
          +
        
        
          Math
        
        
          .
        
        
          Pow
        
        
          (
        
        
          y
        
        
          ,
        
        
          2
        
        
          )
        
        
          +
        
        
          Math
        
        
          .
        
        
          Pow
        
        
          (
        
        
          z
        
        
          ,
        
        
          2
        
        
          ));
        
        
          }
        
      
    

This method use 3 joints to get an angle.

enter image description here

share | improve this answer

Body joints angle using Kinect


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论