Skeleton Basics-WPF C# Sample
Kinect for Windows 1.5, 1.6, 1.7, 1.8
Overview
When you run this sample, you see the following:
- Skeleton tracking for up to two players standing in front of the Kinect; 20 joints per skeleton are rendered.
- A checkbox for seated mode. If you select this, you will see skeleton tracking for up to two players while seated; 10 joints per skeleton are rendered.
The Sample Uses the Following APIs | To Do This |
---|---|
KinectSensor.KinectSensors Property | Get the Kinect sensors that are plugged in and ready for use. |
SkeletonStream.Enable Method | Enable the skeleton stream. |
SkeletonFrame.SkeletonArrayLength Property | Specify the length of the array of Skeleton classes when you allocate memory to store the skeleton stream data from the Kinect. |
KinectSensor.Start Method and KinectSensor.Stop Method | Start or stop streaming data. |
KinectSensor.SkeletonFrameReady Event | Add an event handler for the skeleton data. The sensor will signal the event handler when each new frame of skeleton data is ready. |
SkeletonFrameReadyEventArgs.OpenSkeletonFrame Method | Get a frame of skeleton data in the event handler. |
SkeletonFrame.CopySkeletonDataTo Method | Copy a frame of skeleton data to the pre-allocated array of Skeletons. |
SkeletonTrackingState Enumeration | For each frame of skeleton data, use the enumeration value to distinguish a fully tracked skeleton (SkeletonTrackingState.Tracked) from a skeleton that is tracked with position data only (SkeletonTrackingState.PositionOnlyTracked). |
JointType Enumeration | Draw a skeleton by drawing the bones that make up the skeleton. For each skeleton, use this enumeration to identify each bone from the two joints that are the endpoints of the bone. For instance, use the head joint (JointType.Head) and the shoulder center joint (JointType.ShoulderCenter) to identify the bone between the head and the center of the shoulders. |
Skeleton.Joints Property | Use the joints collection to walk through a list of joints in a skeleton. |
CoordinateMapper.MapSkeletonPointToDepthPoint Method | Convert points from skeleton space to depth space so you can identify their position on screen. |
SkeletonStream.TrackingMode Property | Check the depth mode to distinguish between default depth (SkeletonTrackingState.Default) and near mode (SkeletonTrackingState.Seated). |
To run a sample you must have the Kinect for Windows SDK installed. To compile a sample, you must have the developer toolkit installed. The latest SDK and developer toolkit are available on the developer download page. If you need help installing the toolkit, look on this page: To Install the SDK and Toolkit. The toolkit includes a sample browser, which you can use to launch a sample or download it to your machine. To open the sample browser, click Start > All Programs > Kinect for Windows SDK [version number] > Developer Toolkit Browser.
If you need help loading a sample in Visual Studio or using Visual Studio to compile, run, or debug, see Opening, Building, and Running Samples in Visual Studio.