image

Good,

After the post yesterday where I showed as a painting on a Canvas a skeleton from the data provided to us by Kinect, I have received a couple of questions where you ask me as paint 2 skeletons.

As well to achieve something similar to the following images, all we need to change on the code of yesterday is the routine where Kinect tells us that it has detected a Skeleton. In this routine us encargábamos of painting it, because well we now do it this way:

   1: void KinectSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
   2: {
   3:     var skeletonId = 0;
   4:     Skeleton.Children.Clear();
   5:     foreach (var skeleton in e.SkeletonFrame.Skeletons.Where
   6:              (skeleton => 
   7:                        SkeletonTrackingState.Tracked == skeleton.TrackingState))
   8:     {
   9:         PaintBones(skeleton, KinectCanvas.SkeletonColors[skeletonId]);
  10:         PaintJoints(skeleton);
  11:         skeletonId++;
  12:     }
  13: }

The big difference is that for each Skeleton import a static color from a dictionary. Yellow and green for my taste.

   1: public static Dictionary<int, Color> SkeletonColors 
   2:         = new Dictionary<int, Color>
   3:           {
   4:             {0, Colors.Yellow},
   5:             {1, Colors.Green}
   6:           };

At this point we can already have a skeleton tracker to help us show a static pose:

image

Or a jump from a 2.

image

Previous images we can see how the Valentino me comes to her knees and the points of the Skeleton show detail interesting.

The example to download from

https://SkyDrive.live.com/embedicon.aspx/code%20Samples/2011%2011%2012%20-%20ElBruno.KinectSkeleton01.zip?CID=bef06dffdb192125 & sc = documents

Greetings @ Home

The Bruno

2 responses to “[# KINECT] HowTo: Paint 2 skeletons in a WPF Canvas”

  1. […] [# KINECT] HowTo: Paint 2 skeletons in a WPF Canvas […]

    Like

  2. Awesome! Its really amazing post, I have got much clear idea on the
    topic of from this post.

    Like

Leave a comment

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading