none
Is ChooseSkeletons() method a bug in SDK? RRS feed

  • Question

  • Hi all, I just work for a kinect application and I have a problem here.

    Kinect can detect 6 players but at most 2 of them got skeleton tracked due to performance reason. Other players will be in PositionOnly state. In default, kinect tracks the first 2 players in scope.

    However I need to manually control the skeletal tracking. For example, Alice walks in Kinect scope and tracked, Bob walks in Kinect scope and tracked, then Robert walks in Kinect scope and detected as PositionOnly. Now I want to tell Kinect to set Alice's state to PositionOnly and set Robert's state to tracked, is it possible?

    I heard some articles said set SkeletonStream.AppChooseSkeletons to true, and use SkeletonStream.ChooseSkeletons() can handle this situation. I found ChooseSkeleton() method can take 0-2 arguments of TrackingId and I thought this method should do so. However it's not. When I use this method, I found the application become uncontrollable.

    In debugging, I found where the problem was. In auto skeleton tracking, even the first skeleton walked in Kinect scope was marked PositionOnly first (then Tracked); in manual skeleton tracking, there existed a tracking ID but NotTracked(waiting for manual tracking, which is as expected). But when the ChooseSkeletons(id) called, it just set the skeleton having this id to PositionOnly, not Tracked state - even if there's no Tracked skeleton here. Since my application need a Tracked skeleton to work, it's uncontrollable at all.

    I was shocked by this. If ChooseSkeletons() accepts 0-2 arguments, shouldn't the method change the skeleton of the IDs to Tracked state? However I'm not sure whether it is a bug in SDK(I use 1.7), or it is a incompatible problem because I'm using a Kinect for Xbox yet, and I already found Kinect for Xbox had some unstable problems when programming with Kinect Interaction.

    Friday, June 28, 2013 6:39 AM

Answers

  • Did you remember to set ST to this.kinect.SkeletonStream.AppChoosesSkeletons = true?

    Keep in mind the ST is going to take ~3-4 frames to get a skeleton. Once you choose a skeleton, it may take a couple of frames before you get the ST for that id.

    Since you already have the array of Skeletons, it may be best to just iterate all of them every frame and output the Skeleton Tracking State to visualize this. You can certainly "track" all 6 people if you setup a round-robin type cycle that will choose the first 2 id's and wait for ST to acquire. Once the ST comes in for them, ChooseSkeletons for the next 2 and wait. Keep following this cycle. 

    http://msdn.microsoft.com/en-us/library/jj131025.aspx#Active_User_Tracking


    Carmine Si - MSFT



    Monday, July 8, 2013 5:37 PM

All replies

  • Hi,

    The ChooseSkeletons method works with Kinect for Windows AND Kinect for Xbox.

    All 6 visible users (tracked or position only) have a TrackingId and the value doesn't change unless they become invisible and appears again.

    The skeleton array contains 6 slots for 6 possibly visible users. If there are only 3 users you will get:

    • skeletons[0].TrackingState = Tracked
    • skeletons[1].TrackingState = Tracked
    • skeletons[2].TrackingState = PositionOnly
    • skeletons[3].TrackingState = NotTracked
    • skeletons[4].TrackingState = NotTracked
    • skeletons[5].TrackingState = NotTracked
    • * Tracked skeletons may not always be the first of the array

    When using ChooseSkeletons method, please ensure:

    • if you want to track 2 users, you must send the trackingID of both users
    • TrackingId is the TrackingId property of the skeleton object, you must not use skeleton index in the skeleton array

    Hope this helps


    Vincent Guigui Innovative Technologies Expert at OCTO Technology MVP Kinect

    Friday, June 28, 2013 10:40 AM
  • I already know that. My logic was iterating skeleton data array, when detected a new TrackingId, call ChooseSkeletons with that id.

    But I found after the call, the relative id's state only changed from NotTracked to PositionOnly, why not Tracked?

    Part of my code is like this, where skeleton_tracking_player stores application's last controller's TrackingId, initial value is zero
            private void SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
            {
                SkeletonFrame skeleton_frame = e.OpenSkeletonFrame();
                if (skeleton_frame != null)
                {
                    skeleton_frame.CopySkeletonDataTo(skeleton_data);
                    if (skeleton_tracking_player == 0) // new track
                    {
                        foreach (Skeleton skel in skeleton_data)
                        {
                            if (skel.TrackingId != 0)
                            {                            
                                skeleton_tracking_player = skel.TrackingId;
                                ChooseSkeletons(skeleton_tracking_player);
                                break;
                            }
                        }
                    }

    Monday, July 1, 2013 1:16 AM
  • Did you remember to set ST to this.kinect.SkeletonStream.AppChoosesSkeletons = true?

    Keep in mind the ST is going to take ~3-4 frames to get a skeleton. Once you choose a skeleton, it may take a couple of frames before you get the ST for that id.

    Since you already have the array of Skeletons, it may be best to just iterate all of them every frame and output the Skeleton Tracking State to visualize this. You can certainly "track" all 6 people if you setup a round-robin type cycle that will choose the first 2 id's and wait for ST to acquire. Once the ST comes in for them, ChooseSkeletons for the next 2 and wait. Keep following this cycle. 

    http://msdn.microsoft.com/en-us/library/jj131025.aspx#Active_User_Tracking


    Carmine Si - MSFT



    Monday, July 8, 2013 5:37 PM