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



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:


Or a jump from a 2.


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 thoughts on “[# KINECT] HowTo: Paint 2 skeletons in a WPF Canvas”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.