none
Modify Gesture Builder Basics- WPF to only get one person RRS feed

  • Question

  • Hi!

    I'm new usign Kinect and I'm trying to modify the Kinect example "Gesture Builder Basic- WPF". This example has the option to detect 6 people, and for each people it has a picture that is changed depending if the person is seated or not. How can I change the code in order to detect one person? I have change the appearence to show one picture and skeleton.

    I hope you can help me,

    Thank you.

    Tuesday, May 12, 2015 2:13 PM

All replies

  • Do you mean DiscreteGestureBasics-WPF? If so, take a look at the Reader_BodyFrameArrived method (lines 222-244). The code loops through available bodies to manage gesture detectors. You cannot tell Kinect to track only one body, instead, you will have to write some code to "filter" the bodies and get the one you want to follow according to your own criteria (e.g. the one nearest to the sensor, the first to get a valid tracking state...).

    Wednesday, May 13, 2015 8:04 AM
  • Yes that is what I need, but how can I do it? Is there any method to filter the bodies?
    Thursday, May 14, 2015 1:06 PM
  • No, as I said, you have to write your own code for that. Imagine you want to keep the nearest body, the basic idea would be:

    - Loop through bodies array.

    - Take the hip center joint and see which has the lowest Z value.

    - If no user is being tracked, add the gesture recognizer.

    - If a user is being tracked, check if it is the same you have just selected. If it is, do nothing, if it isn't change hook the gesture recognizer to the new body.

    You can improve the concept or change the filtering criteria (look for another joint, look for a user wearing glasses instead of the nearest or whatever), but in any case, you have to write the code for that filtering.

    Thursday, May 14, 2015 2:04 PM