More Related Content Similar to how to develop apps for Kinect Similar to how to develop apps for Kinect (19) More from csdnmobile (20) how to develop apps for Kinect5. Agend 什么是 Kinect? Kinect历史 Kinect for Windows SDK简介 设置Kinect开发环境 Kinect开发介绍 Kinect示例 6. What’s is Kinect? Kinect是XBox360的外接体感设备 动作捕捉 语音识别 Kinect无需借助任何外设进行动作捕捉 目前只支持人类动作的捕捉 Rare负责软件开发,Range Camera技术由PrimeSense提供 同类产品 任天堂 Wii Play Station Move 7. Kinect History CodeName:Project Natal 2009年E3公布,2010年10月上市 有史以来销售最快的消费类电子产品 截止2011年3月9日,销售超过一千万部 2011年6月发布Kinect for Windows SDK 动作捕捉的机器学习技术获得2011 MacRobertAward工程创新大奖 9. Kinect for Windows SDK 非商业授权,商业授权将在下一个版本中提供 OS:Windows 7 Visual Studio 2010 Express以上版本 支持C++, C# 和 VB.NET 主要功能 Raw sensor streams Skeletal tracking Advanced audio capabilities 11. Setting Up Your Development Environment 硬件 Kinect Hardware AC Adapter/ Power Supply 软件 Kinect for Windows SDK http://research.microsoft.com/en-us/um/redmond/projects/kinectsdk/download.aspx Coding4Fun KinectToolkit http://c4fkinect.codeplex.com/ 12. 添加引用 添加引用 Microsoft.Research.Kinect Coding4Fun.Kinect.Wpf.dll (可选) 命名空间 using Microsoft.Research.Kinect.Nui; using Microsoft.Research.Kinect.Audio; using Coding4Fun.Kinect.Wpf; 13. 初始化Runtime Runtime nui; nui= new Runtime(); nui.Initialize(RuntimeOptions.UseColor| RuntimeOptions.UseDepth | RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); Runtime 封装一个Kinectsensor的功能 RutimeOptions 指定Kinectsensore能够使用的功能 14. Camera Fundamentals nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady); void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e) { PlanarImageimageData = e.ImageFrame.Image; image1.Source = BitmapSource.Create(imageData.Width, imageData.Height, 96, 96, PixelFormats.Bgr32, null, imageData.Bits, imageData.Width* imageData.BytesPerPixel); //image1.Source = e.ImageFrame.ToBitmapSource(); } VideoFrameReady事件 ImageFrameReadyEventArgs参数 ImageFrame.Image属性:PlanarImage 使用Coding4Fun Kinect Toolkit 15. 获取Depth信息 nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady); nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.Depth); void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) { image2.Source = e.ImageFrame.ToBitmapSource(); } 19. Skeletal Tracking Fundamentals (2) nui = new Runtime(); nui.Initialize(RuntimeOptions.UseSkeletalTracking); nui.SkeletonFrameReady+= new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { SkeletonFrameallSkeletons = e.SkeletonFrame; //get the first tracked skeleton SkeletonDataskeleton = (from s in allSkeletons.Skeletons where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault(); } 20. Working with Depth Data Runtime nui = new Runtime(); private void Window_Loaded(object sender, RoutedEventArgs e) { //UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); //register for event nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady); //DepthAndPlayerIndexImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) {}