15
Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Embed Size (px)

Citation preview

Page 1: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 1 | Microsoft

Work WithDepth Data

Kinect for Windows Video CoursesJan 2013

Page 2: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 2 | Microsoft

Demo: How to get depth data

Page 3: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 3 | Microsoft

Kinect For Windows SDK & Toolkit• Download SDK & Toolkit:

http://www.microsoft.com/en-us/kinectforwindows/• Install SDK & Toolkit.• Install examples provided in toolkit (DepthBasics-WPF)

Page 4: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 4 | Microsoft

4 Steps to Get Depth Data• Find an available Kinect sensor.• Enable depth data stream.• Register stream ready event handler function.• Start capturing data.

Page 5: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 5 | Microsoft

4 Steps to Get Depth Data – Find an available Kinect Sensor• KinectSensor object represents a Kinect sensor entity.• Enumerate all Kinect sensors and find a usable one.

foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { this.sensor = potentialSensor; break; } }

Page 6: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 6 | Microsoft

4 Steps to Get Depth Data – Find an available Kinect Sensor• Status of Kinect sensor:

• Disconnected – Sensor has been plugged off USB port.• Connected – Sensor is ready to use.• Initializing – Sensor is being initialized.• Not powered – Sensor is connected to USB port but power line is disconnected.

Page 7: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 7 | Microsoft

4 Steps to Get Depth Data – Enable depth data stream• KinectSensor.DepthStream implements API functions related to depth data

retrieving and processing.• Initialize to enable depth data stream:

this.sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);

Page 8: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 8 | Microsoft

4 Steps to Get Depth Data – Register Stream Ready Event Handler Function• Register the stream event handler function to Kinect sensor so that when a

new depth frame comes in, the handler function is called to retrieve and process the data.

this.sensor.DepthFrameReady += this.SensorDepthFrameReady;

Page 9: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 9 | Microsoft

4 Steps to Get Depth Data – Start Kinect sensor• Call KienctSensor.Start() to let Kinect sensor begin capturing the data.

try { this.sensor.Start(); } catch (IOException) { this.sensor = null; }

Page 10: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 10 | Microsoft

Retrieve depth data• When new incoming data frame is ready, stream data ready event is

triggered.• Open image frame in stream data ready event handler function.

private void SensorDepthFrameReady(object sender, DepthImageFrameReadyEventArgs e){ using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())

{ if (depthFrame != null) { // Copy the pixel data from the image to a temporary array dpethFrame.CopyDepthImagePixelDataTo(this.depthPixels);

// Do whatever you need to do with the depth data } }

}

Page 11: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 11 | Microsoft

Depth Pixel• In each pixel, there are 2 kinds of important information:

• Depth – The distance in millimeters between the detected objects and the sensor. This information is presented in a “short” type value.

• Player Index – If Kinect successfully detected a human, it assigns an index number to the pixels which belong to the person (called player). Kinect can trace up to 6 players so valid player index is ranged from 1 to 6. 0 is assigned to indicate the pixel does not belong to any player. This information is also presented in a “short” type value.

Page 12: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 12 | Microsoft

• OverviewHardware overview and SDK installation

• Color• Introduction to color stream• Demo: How to get color data• Demo: ColorBasics sample

• Depth• Introduction to depth stream• Demo: How to get depth data• Demo: DepthBasics sample

• Skeleton• Introduction to skeleton stream• Demo: How to get skeleton data• Demo: SkeletonBasics sample

• Audio• Introduction to audio stream• Demo: How to capture audio• Demo: Speech recognition

• Advanced Topics• Streams sync and coordinate mapping• Demo: Streams sync and coordinates

mapping• Accelerometer and tilt angle• Demo: How to get accelerometer and tilt

angle

Page 13: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 13 | Microsoft

Learn More About Kinect for Windows in MSDN

http://msdn.microsoft.com/en-us/library/hh855352

Page 14: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 14 | Microsoft

Thanks

Contact us: http://social.msdn.microsoft.com/Forums/en-US/kinectsdk

Page 15: Page 1 | Microsoft Work With Depth Data Kinect for Windows Video Courses Jan 2013

Page 15 | Microsoft