none
How to select all ids to track two by two during a time? RRS feed

  • Question

  • Hello! 

    Kinect can recognize six people and track two!

    I would like to track all of the 6 ppl in the scene circling the track among those 6 people for a certain  amount of time. that way all of then get covered by the tracking system.

    How can I program to the trcaking system stay in ID1 and ID2 for 7 seconds

    then go to ID3 and 4 for 7 seconds

    then 5 and 6 for 7 seconds

    and go back to 1 and 2 and keep going...

    if someone could help, it would be better to start with this code:

    How to select the users to track in C#

    The application can take control of the users to track by setting AppChoosesSkeletons to true. To specify the user or users to track, call the SkeletonStream.ChooseSkeletons method and pass the tracking ID of one or two skeletons you want to track (or no parameters if no skeletons are to be tracked).

      private void TrackClosestSkeleton()
      {
        if (this.kinect != null && this.kinect.SkeletonStream != null)
            {
            if (!this.kinect.SkeletonStream.AppChoosesSkeletons)
            {
            this.kinect.SkeletonStream.AppChoosesSkeletons = true; // Ensure AppChoosesSkeletons is set
            }

            float closestDistance = 10000f; // Start with a far enough distance
            int closestID = 0;

            foreach (Skeleton skeleton in this.skeletonData.Where(s => s.TrackingState != SkeletonTrackingState.NotTracked))
            {
            if (skeleton.Position.Z < closestDistance)
            {
              closestID = skeleton.TrackingId;
              closestDistance = skeleton.Position.Z;
            }
          }

          if (closestID > 0)
          {
            this.kinect.SkeletonStream.ChooseSkeletons(closestID); // Track this skeleton
          }
        }
      }

    well I hope it isnt hard to do!


    • Edited by dorkito Tuesday, October 23, 2012 10:21 PM
    Tuesday, October 23, 2012 10:20 PM