When you work with apps on Kinect that require a special code for each body recognized by the sensor, the entry point tends to be the collection of bodies returning to us in the line 15 of the first block in the following code example
The problem with these lines is the collection of bodies it is usually complete by 6 elements, however there are no 6 people in front of the Kinect. The following image shows the collection and at the same, the 6th element is a correct body, but with the property IsTracked = False .
The solution is quite simple, a small array preprocessing, filtering by the bodies that are correctly identified. In line 16 of the second block of code we obtain the total number of bodies where IsTracked == True and from there to be processed.
Greetings @ Home