I am creating a an application using Kinect, I want to track only 1 person at a time, right now Kinect starts detecting another person if he comes in within Kinect range. I have written the following code, and it detects any person who comes within Kinect range. Kindly tell me how can i restrict it to detect only 1 person at a time.
/*------------------------------------------
* SKELETON JOINTS
--------------------------------------------
*/
Skeleton[] _skeletons = new Skeleton[0];
using (SkeletonFrame usingSkeletonFrame = e.OpenSkeletonFrame())
{
if (usingSkeletonFrame != null)
{
_skeletons = new Skeleton[usingSkeletonFrame.SkeletonArrayLength];
usingSkeletonFrame.CopySkeletonDataTo(_skeletons);
}
}
if(_skeletons.Length >0)
// if (_skeletons.Length == SkeletonTrackingState.Tracked)
{
isSkeleton = true;
foreach (Skeleton skl in _skeletons)
{
if (skl.TrackingState == SkeletonTrackingState.Tracked)
{
// string str = "";
Joint shoulderCenter = skl.Joints[JointType.ShoulderCenter];
Joint rightShoulder = skl.Joints[JointType.ShoulderRight];
leftShoulder = skl.Joints[JointType.ShoulderLeft];
Joint Head = skl.Joints[JointType.Head];