Kinect SDK 1 - The Full Skeleton
Written by Harry Fairhead   
Wednesday, 04 April 2012
Article Index
Kinect SDK 1 - The Full Skeleton
Drawing the Body
The Full Skeleton

 

The Full Skeleton

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

//left leg
DrawBone( JointType.HipCenter,
JointType.HipLeft,
S, g);
DrawBone( JointType.HipLeft,
JointType.KneeLeft,
S, g);
DrawBone( JointType.KneeLeft,
JointType.AnkleLeft,
S, g);
DrawBone( JointType.AnkleLeft,
JointType.FootLeft,
S, g);
//Right Leg
DrawBone( JointType.HipCenter,
JointType.HipRight,
S, g);
DrawBone( JointType.HipRight,
JointType.KneeRight,
S, g);
DrawBone( JointType.KneeRight,
JointType.AnkleRight,
S, g);
DrawBone( JointType.AnkleRight,
JointType.FootRight,
S, g);

 

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

//Left Arm
DrawBone( JointType.ShoulderCenter,
JointType.ShoulderLeft,
S, g);
DrawBone( JointType.ShoulderLeft,
JointType.ElbowLeft,
S, g);
DrawBone( JointType.ElbowLeft,
JointType.WristLeft,
S, g);
DrawBone( JointType.WristLeft,
JointType.HandLeft,
S, g);
//Right Arm
DrawBone( JointType.ShoulderCenter,
JointType.ShoulderRight,
S, g);
DrawBone( JointType.ShoulderRight,
JointType.ElbowRight, S, g);
DrawBone( JointType.ElbowRight,
JointType.WristRight,
S, g);
DrawBone( JointType.WristRight,
JointType.HandRight, S, g);

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

Where next

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. This dumb approach does have the advantage of making it very obvious what work you have to do.

A better approach would be to store the sequences of joints in a collection and then write a routine to render each of the body parts as a polyline.

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. You could even take cartoon or photo cutouts of various body parts and use them to mark the position of each of the skeletons body parts. The effect that you can achieve by being just a little creative are quite impressive and very easy. .

 

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

 

Practical Windows Kinect in C#
Chapter List

  1. Introduction to Kinect
  2. Getting started with Microsoft Kinect SDK 1
  3. Using the Depth Sensor
  4. The Player Index
  5. Depth and Video Space
  6. Skeletons
  7. The Full Skeleton
  8. A 3D Point Cloud

 

blog comments powered by Disqus

 

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.

 

Further reading:

Avatar Kinect - a holodeck replacement

A Kinect Princess Leia hologram in realtime

Kinect augmented reality x-ray (video)

Kinect flies

Kinect plus a glass wedge gives ...

Kinect makes you Superman

Kinect goes self aware - a warning

Kinect for Microsoft Robots

Kinect knows what you are doing...

 

<ASIN:B006UIS53K@COM>

<ASIN:B0078LMS72@UK>

<ASIN:B002BSA298@COM>

<ASIN:B0036DDW2G@UK>

<ASIN:B0036DDW2G@FR>

<ASIN:B002BSA298@CA>

<ASIN:B003H4QT7Y@DE>

<ASIN:B00499DBCW@IT>



Last Updated ( Friday, 27 April 2012 )
 
 

   
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.