ofxKinectForWindows2 Body tracking sequence

Hi everybody,

I’m trying to track bodies from a kinect V2 but I encounter some troubles. I’d like to track by appearance of persons and map it to ableton live.
Like :

Person 1 appears -> Kinect audio track 1
Person 2 appears -> Kinect audio track 2
Person 3 appears -> Kinect audio track 3

But it seems that the add-on add bodies in a random order. For example, when looking at the vector : bodies I got that :

Index : 0 : not tracked
Index : 1 : second which has been tracked
Index : 2 : not tracked
Index : 3 : not tracked
Index : 4 : First which has been tracked
Index : 5 : not tracked

But It’s really random.

Does anyone know how I could add the body in an increasing sequence from 0 to 6 ?
So I could directly map my ableton audio track to my body.

I’ve tried a lot of things, (that’s why I didn’t post code) but here is some attempts :
Using numBodyTracked : -> Random
Copying to a new vector of ofxKinectForwindows2::Data::Body -> Random.

I think that the problem comes from this line, which I doesn’t understand very well:
for (auto body : bodies){

Thank !


If it could help, here is some further investigations :



Hello, it is not an add-on issue, this is the Way kinect sdk itself populates the array of bodies, you have to work your way in sorting the body data, you could, for example, use a parallel vector(or the data structure of your choice) and use your own criteria to fill it…to help you do this you have the bodyId and trackingId atributtes from the ofxKFW2::Data::Body class