Kinect SDK Crash Course <ul><li>(In 12 slides or less) </li></ul><ul><li>Elliot Babchick </li></ul>
What Do You Get?
Important! <ul><li>Kinect shines brightest when you use it in a wide, open space. </li></ul><ul><li>Specifically, 0.8 - 4 ...
Setting it Up <ul><li>We did this for you in the skeleton code, but quickly: </li></ul><ul><li>Import it into your project...
Event-driven data streams <ul><li>An example handler, taking the RGB video and putting it into a WPF element named “video”...
What’s In A... ImageFrame ImageFrame We’ll cover this in more detail next week. For now, just know that you have access to...
What’s in a... DepthFrame DepthFrame Look familiar? It’s the same ImageFrame, but has a different Type field value (it’s a...
Making (quick) sense of a depth image <ul><li>Raw data in ImageFrame.Image.Bits </li></ul><ul><li>Array of bytes: public b...
What’s In A... SkeletonFrame SkeletonFrame A collection of skeletons, each with a collection of joints
Skeleton Data In Detail <ul><li>You get all the joints you see above with <x,y,z>. Z values get larger as you move away fr...
Mapping coordinates to the UI <ul><li>Coding4Fun Library extends the Joint object with: </li></ul><ul><li>ScaleTo(int x, i...
This is Slide #12 <ul><li>I had a slide to spare. Now let’s look at the skeleton code. </li></ul>
Upcoming SlideShare
Loading in …5
×

First kinectslides

271 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
271
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

First kinectslides

  1. 1. Kinect SDK Crash Course <ul><li>(In 12 slides or less) </li></ul><ul><li>Elliot Babchick </li></ul>
  2. 2. What Do You Get?
  3. 3. Important! <ul><li>Kinect shines brightest when you use it in a wide, open space. </li></ul><ul><li>Specifically, 0.8 - 4 meters is the supported range. The sweet spot is in the middle (~2.5 m). </li></ul><ul><li>If it can’t see your entire body, it can’t track you. Make sure your entire body is in the frame! </li></ul>
  4. 4. Setting it Up <ul><li>We did this for you in the skeleton code, but quickly: </li></ul><ul><li>Import it into your project via references include ‘using Microsoft.Research.Kinect.Nui’ (NUI = Natural User Interface) </li></ul><ul><li>The Nui is declared a “Runtime” object, pass it the sensors you want using RuntimeOptions and pipes (‘|’). You must specify these up-front (no asking for them after initialized). </li></ul>nui = new Runtime (); try { nui.Initialize( RuntimeOptions .UseDepthAndPlayerIndex | RuntimeOptions .UseSkeletalTracking | RuntimeOptions .UseColor); } catch (InvalidOperationException) { return 42 ; }
  5. 5. Event-driven data streams <ul><li>An example handler, taking the RGB video and putting it into a WPF element named “video” (really an image) </li></ul>nui.DepthFrameReady += new EventHandler < ImageFrameReadyEventArgs > (nui_DepthFrameReady); nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs> (nui_SkeletonFrameReady); nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs> (nui_ColorFrameReady); void nui_ColorFrameReady( object sender, ImageFrameReadyEventArgs e) { PlanarImage Image = e.ImageFrame.Image; video.Source = BitmapSource .Create( Image.Width, Image.Height, 96, 96, PixelFormats .Bgr32, null , Image.Bits, Image.Width * Image.BytesPerPixel); }
  6. 6. What’s In A... ImageFrame ImageFrame We’ll cover this in more detail next week. For now, just know that you have access to the raw bytes (misnamed “bits”) that makes up the pixels
  7. 7. What’s in a... DepthFrame DepthFrame Look familiar? It’s the same ImageFrame, but has a different Type field value (it’s a depth image, not a color image)
  8. 8. Making (quick) sense of a depth image <ul><li>Raw data in ImageFrame.Image.Bits </li></ul><ul><li>Array of bytes: public byte[] Bits; </li></ul><ul><li>2 bytes per pixel, moves left to right then top to bottom </li></ul><ul><li>Every 2 bytes tells how far away that particular pixel is (in millimeters). But you can’t just read the bytes straight out... </li></ul><ul><li>You need to bit-shift differently depending on whether you’re tracking depth and skeletons or just depth... more on this next week, see the link for more detail if you need it sooner: </li></ul><ul><li>http://channel9.msdn.com/Series/KinectSDKQuickstarts/Working-with-Depth-Data </li></ul>
  9. 9. What’s In A... SkeletonFrame SkeletonFrame A collection of skeletons, each with a collection of joints
  10. 10. Skeleton Data In Detail <ul><li>You get all the joints you see above with <x,y,z>. Z values get larger as you move away from the sensor. Moving right (your right) gives you larger X values. Moving up is left to you as an exercise (get it?). </li></ul>Units in meters (note that raw depth was in millimeters)
  11. 11. Mapping coordinates to the UI <ul><li>Coding4Fun Library extends the Joint object with: </li></ul><ul><li>ScaleTo(int x, int y, float maxSkeletonX, float maxSkeleton y) </li></ul><ul><li>x and y describe the rectangular space of pixels you’d like to scale a joint to. The second two arguments specify how far you need to move to traverse the scaled range. </li></ul><ul><li>For example, skeleton.Joints[JointID.HandRight].ScaleTo(640, 480, .5f, .5f) means that your right hand will only need to travel one meter (-.5 to .5) to cover the full 640-pixel-wide distance on screen. </li></ul><ul><li>Convenient function for converting ImageFrame’s byte data to actual images: ImageFrame.ToBitmapSource() </li></ul><ul><li>Find Coding4Fun here (but it’s already in the starter code project): http://c4fkinect.codeplex.com/ </li></ul>
  12. 12. This is Slide #12 <ul><li>I had a slide to spare. Now let’s look at the skeleton code. </li></ul>

×