none
Utilizing Tracking ID to find body index RRS feed

  • Question

  • Hello!

    I am beginner writing WPF program using Kinect V2.

    I am currently working on finding index of the body when someone is performing certain gesture.

    So far, I can retrieve trackingID of the body I want to know but it seems like bodies array is not an array consist of trackingID.

    Is there way to find index of the body array using tracking ID?

    Thank you for your time!

    Monday, August 22, 2016 8:58 AM

Answers

  • Well, the bodies array doesn't promise to provide the bodies with the same index, each frame. Therefore if you use the trackingID, then you have to lookup&compare the trackingID per frame to figure out the index.

    int index=-1;
    for(int i=0;i<bodies.Length;i++)
    {
      if(my_tracking_id == bodies[i].UniqueTrackingID)
      {
        index = i;
        break;
      }
    }
    
    if(index ==-1) //ERROR
    else //PROCEED



    • Edited by Nikolaos Patsiouras Monday, August 22, 2016 9:49 AM
    • Marked as answer by t3dk Tuesday, August 23, 2016 1:30 AM
    Monday, August 22, 2016 9:45 AM