Getting started with Microsoft Kinect SDK - The Full Skeleton
Getting started with Microsoft Kinect SDK - The Full Skeleton
Written by Mike James   
Monday, 23 January 2012
Article Index
Getting started with Microsoft Kinect SDK - The Full Skeleton
Drawing the body
Joining the Bones


Drawing a Bone

it should be obvious that what we have to do next is draw a line between ShoulderCenter and Spine. Clearly this is just a repeat of what we have already done so this suggests another helper function:

void DrawBone(JointID j1,
JointID j2,
SkeletonData data,
Graphics g)
Point p1=GetJoint(j1,data);
Point p2 = GetJoint(j2, data);
g.DrawLine(Pens.Red, p1, p2);

This will draw a line between the two specified Joints. So to draw the body all we need is:

JointID.ShoulderCenter, data, g);
JointID.Spine, data, g);
JointID.HipCenter,data, g);

This is all we need!

If you run the program now you will see lines following the body.

Now that you have seen this much adding two legs should be easy:

//Left leg
JointID.HipLeft,data, g);
JointID.KneeLeft, data, g);
JointID.AnkleLeft, data, g);
JointID.FootLeft, data, g);
//Right Leg
JointID.HipRight,data, g);
JointID.KneeRight, data, g);
JointID.AnkleRight, data, g);
JointID.FootRight, data, g);


All we have left to do is to add the two arms:

//Left Arm
JointID.ShoulderLeft, data, g);
JointID.ElbowLeft, data, g);
JointID.WristLeft, data, g);
JointID.HandLeft, data, g);
//Right Arm
JointID.ShoulderRight, data, g);
JointID.ElbowRight, data, g);
JointID.WristRight, data, g);
JointID.HandRight, data, g);

Now if you run the program you will see a complete skeleton plot.

You can argue that there are better ways to organize the code but you have to have a list of the joints you want to draw lines between somewhere.

If you want to try taking it further why not change the drawing of the head for an ellipse and a rectangle for the body. It is all fairly easy.

Articles on the Microsoft Kinect SDK

  1. Getting started with Microsoft Kinect SDK
  2. Depth
  3. Player index
  4. Depth and Video space
  5. Skeletons
  6. The Full Skeleton (this article)

Next Time: Audio


You can download the code for the Windows Forms version of this program from the CodeBin (note you have to register first).






or email your comment to:


To be informed about new articles on I Programmer, subscribe to the RSS feed, follow us on Google+, Twitter, Linkedin or Facebook or sign up for our weekly newsletter.

Last Updated ( Monday, 06 February 2012 )

RSS feed of all content
I Programmer - full contents
Copyright © 2018 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.