How can i ID the first skeleton the kinect tracked and then do stuff with it. Im only interested in the first skeleton and whichever comes after i do not need them. Preferably the next skeleton that comes in is not tracked at all.
Can someone help me with this thanks. Currently the code below im using does not work. I have tried some quick linq query but im not very sure how to use it. Always having errors with it.
Can someone give me some examples i can work with thanks in advance!!
private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
Skeleton[] skeletons = new Skeleton[0];
using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
{
if (skeletonFrame != null)
{
skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
skeletonFrame.CopySkeletonDataTo(skeletons);
}
}
using (DrawingContext dc = this.drawingGroup.Open())
{
// Draw a transparent background to set the render size
dc.DrawRectangle(Brushes.Black, null, new Rect(160, 0.0, RenderWidth, RenderHeight));
if (skeletons.Length != 0)
{
foreach (Skeleton skel in skeletons)
{
RenderClippedEdges(skel, dc);
if (skel.TrackingState == SkeletonTrackingState.Tracked)
{
this.TrackingId = Skel;
sensor.SkeletonStream.AppChoosesSkeletons = true;
sensor.SkeletonStream.ChooseSkeletons(skel.TrackingId);
this.DrawBonesAndJoints(skel, dc);
if (skel == null)
{
Process.Start("wmplayer.exe", "C:\\Users\\User\\Downloads\\Test.wma");
}
}
else if (skel.TrackingState == SkeletonTrackingState.NotTracked)
{
sensor.SkeletonStream.AppChoosesSkeletons = false;
}
}
}
// prevent drawing outside of our render area
this.drawingGroup.ClipGeometry = new RectangleGeometry(new Rect(160, 0.0, RenderWidth, RenderHeight));
}
}