text: Kin.
  In Chapter 3 we looked at how to work with the raw depth data. This is often useful when you are trying to do something new but when you just need to know the position of a player in the scene it is easier to let the Kinect take the strain and use its skeleton tracking.
  Kinect has two types of raw output - standard color video and the depth field which tells you how far away each pixel is.
  In.
  Make sure to read at least chapter two before you continue to find out how to get started. This chapter also builds on the ideas in chapter three.
  To work with the user index data you need to set the Kinect up to perform the skeletonization procedure as well as returning raw depth information. In this first example we will use a Windows forms application but the start of the program is the same for a WPF application.
  As always you need add a reference to
  Microsoft.Kinect.dll.
  and add
  using Microsoft.Kinect;
  to the start of the code.
  The user index is derived from the skeleton data so you can't have it without turning on the skeleton data. The program starts off in the usual way with the creation of a KinectSensor object:
  sensor = KinectSensor.KinectSensors[0]
  Next you have to enable the depth stream in the usual way and also the Skeleton stream as we want the player index data - even though you don't actaully want to use the Skeleton stream data.
  sensor.DepthStream.Enable( DepthImageFormat.Resolution320x240Fps30);sensor.SkeletonStream.Enable();
  As we only want the depth data stream we only attach an interrupt handler to the DepthFrameReady event:
  sensor.DepthFrameReady += DepthFrameReady;
  and start the data streams running:
  sensor.Start();}
  You can also turn on the video camera but it isn't going to be used in this simple example.
  So far everything has been the same as working with the basic depth data as described in the previous chapter apart from enabling the Skeleton stream.
  We now need define an interrupt handler that will be called when a frame of depth data is ready:
  void DepthFrameReady(object sender, DepthImageFrameReadyEventArgs e){
  From this point we can access the depth data as a short array as in the previous chapter:
  DepthImageFrame imageFrame= e.OpenDepthImageFrame()if (imageFrame != null){ short[] pixelData = new short[imageFrame.PixelDataLength]; imageFrame.CopyPixelDataTo(pixelData);
  Now we have the data in pixelData and are ready to process it. The only difference is that now the low order three bits of the 16 bit number are no longer set to zero but are set to the player index.
  So now each element of the array carries two pieces of data - the depth stored in the top most 13 bits and the player index stored in the bottom three bits.