none
How to get a joint using v2 sdk? RRS feed

  • Question

  • As we know in v1 sdk the code is as follows:

    Joint joint = new Joint();

    Joint joint = skeleton.Joints[JointType.Spine];

    while the code is using v2 as follows:

    Joint joint = body.Joints[JointType.SpineBase].

    But the code met a error says: [] does not match dictionary

    Maybe The Type of Joint is IReadOnlyDictionary,which differs with Joint in v1.So the question is

    How get the joint in v2 sdk.Thank you!

    Tuesday, November 18, 2014 1:36 PM

Answers

  • In C++:

    Joint * pJoints = new Joint[JointType_Count];
    body->GetJoints(JointType_Count, pJoints);
    auto spineJoint = pJoints[JointType::JointType_SpineBase];
    

    In c#:

    IReadOnlyDictionary<JointType, Joint> joints = body.Joints;
    var spineJoint = joints[JointType.SpineBase];
    

    Nothing wrong with the above lines of code. They work fine for me. What is your specific error?


    Sr. Enterprise Architect | Trainer | Consultant | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer |blog: http://dgoins.wordpress.com

    Tuesday, November 18, 2014 5:34 PM

All replies

  • In C++:

    Joint * pJoints = new Joint[JointType_Count];
    body->GetJoints(JointType_Count, pJoints);
    auto spineJoint = pJoints[JointType::JointType_SpineBase];
    

    In c#:

    IReadOnlyDictionary<JointType, Joint> joints = body.Joints;
    var spineJoint = joints[JointType.SpineBase];
    

    Nothing wrong with the above lines of code. They work fine for me. What is your specific error?


    Sr. Enterprise Architect | Trainer | Consultant | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer |blog: http://dgoins.wordpress.com

    Tuesday, November 18, 2014 5:34 PM
  • Do you have a valid body frame you acquired from the reader? Have you followed what is provided in the samples as the pattern for writing v2 code?

    Carmine Sirignano - MSFT

    Tuesday, November 18, 2014 7:43 PM
  • I find the reason that my pc's .Net version is 4.5.IReadOnlyCollection is not in v4.5. Thank you!
    Wednesday, November 19, 2014 4:49 AM
  • Yes, code is : using( BodyFrame bodyFrame = e.FrameReference.AcquireFrame().I'm following the demo provided by SDK browser. The problem is that IReadOnlyDictionary is not in .Net 4.5. How to add the IReadOnlyDictionary?

    Wednesday, November 19, 2014 4:56 AM