none
Player tracking RRS feed

  • Question

  • Has anyone been able to limit the tracking of skeleton to just one player? I had played around with UserIndex and TrackingID but unable get a constant value for those.

    Would appreciate if anyone could enlighten me.

    Monday, June 27, 2011 2:42 PM

Answers

  • The Kinect SDK Beta does not include any APIs to limit tracking of skeleton to just one player. The level of consistency provided by the API is that a given tracking ID will be in the same skeleton slot until that skeleton is lost. If one skeleton tracked gets lost and then reappears, it will have a different tracking ID and most likely end up in a different skeleton data slot, so you application will have to do some work to associate the new tracking ID with the application's higher level concept of "player".

    Hope this helps!
    Eddy


    I'm here to help
    Friday, July 1, 2011 9:34 PM

All replies

  • I don't think you can force the tracking engine to track only one skeleton at a time (I mean how should it know wwich one?!).

    But in one of the Quickstarts they use this code to react only to the first (or only) tracked skeleton:

    //Inside the nui_SkeletonFrameReady-event
    SkeletonFrame allSkeleton = e.SkeletonFrame;
    SkeletonData skeleton = (from s in allSkeleton.Skeletons
                       where s.TrackingState == SkeletonTrackingState.Tracked
                       select s).FirstOrDefault();
    //now you can use skeleton to work with, for example this is the only skeleton that controls the player..
    

    Is that what you're trying to do?

    Friday, July 1, 2011 8:50 AM
  • The Kinect SDK Beta does not include any APIs to limit tracking of skeleton to just one player. The level of consistency provided by the API is that a given tracking ID will be in the same skeleton slot until that skeleton is lost. If one skeleton tracked gets lost and then reappears, it will have a different tracking ID and most likely end up in a different skeleton data slot, so you application will have to do some work to associate the new tracking ID with the application's higher level concept of "player".

    Hope this helps!
    Eddy


    I'm here to help
    Friday, July 1, 2011 9:34 PM
  • I would have to relook at trackingID because it seems to give me either 0 or 254. Perhaps i made a mistake somewhere.
    • Marked as answer by zzLZHzz Saturday, July 2, 2011 1:31 PM
    • Unmarked as answer by zzLZHzz Saturday, July 2, 2011 1:31 PM
    Saturday, July 2, 2011 1:30 PM
  • Is there by any chance that the following code stop working after the SDK Beta Refresh? It working fine before the SDK Refresh. Is there any workaround for this?

    SkeletonFrame allSkeleton = e.SkeletonFrame;
    SkeletonData skeleton = (from s in allSkeleton.Skeletons
         where s.TrackingState == SkeletonTrackingState.Tracked
         select s).FirstOrDefault()

    As a result of the above code, NullReferenceException occur upon hitting the following line of code

     

    canvasBody.Children.Add(getBodySegment(data.Joints, brush, JointID.HipCenter, JointID.Spine, JointID.ShoulderCenter, JointID.Head));


    Saturday, August 20, 2011 3:17 AM
  • Hi,

    You need to check if the SkeletonData skeleton variable is null before you use that.

    if(skeleton != null)

    {\\To do

    }

    Note that instead of data.joints, you should use skeleton.joints as skeleton variable is declared above, not data.

    Monday, August 22, 2011 9:38 AM
  • Hi zzLZHzz,

     

    In my application I have set the SDK to track only one user, but with the limitation that it is the closest user to the camera (which is quite often who you want to be tracking anyway!) by using the following code:

     

    //If the skeleton is tracked and the Centre Hip Z position is less than the active user + 10cm (to allow for some movement)

                    if ((SkeletonTrackingState.Tracked == data.TrackingState) &&  (data.Joints[JointID.HipCenter].Position.Z < (_activeUserWaist + 0.1)))

    Which then only performs the action for the user closest to the camera

     

    Matt

    Monday, August 22, 2011 11:00 AM
  • Hello Mattazzer.

     

    What happens if a Player walks between you and the camera (e.g. to get a beer ;-) )

    Than your application will track the player till he's out of range.

     

    I think the smartest solution is to track the person that was first recognized. Or if the person is the only one (for about 10 seconds) that is currently tracked.

    Here a person can walk through the camera range and won't be tracked, because you were the first person, that got tracked.

    If you want to change the "tracked" person, another one could appear in front of the camera. You leave the area and after 10 seconds the "new" person is being tracked!

     

    Friday, September 30, 2011 8:25 AM