private void Window_Loaded(object sender, EventArgs e) { nui = new Microsoft.Research.Kinect.Nui.Runtime(); drawCore = new SkeletalCore.Draw(); player = new VirtualKinect.Player(); try { nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor); } catch (InvalidOperationException) { } player.DepthFrameReady += new EventHandler<VirtualKinect.ImageFrameReadyEventArgs>(nui_DepthFrameReady); player.SkeletonFrameReady += new EventHandler<VirtualKinect.SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); player.VideoFrameReady += new EventHandler<VirtualKinect.ImageFrameReadyEventArgs>(nui_ColorFrameReady); }
private void Window_Loaded(object sender, EventArgs e) { drawCore = new SkeletalCore.Draw(); nui = new Runtime(); recorder = new VirtualKinect.Recorder(); try { nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor); } catch (InvalidOperationException) { System.Windows.MessageBox.Show("Runtime initialization failed. Please make sure Kinect device is plugged in."); return; } try { nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color); nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex); } catch (InvalidOperationException) { System.Windows.MessageBox.Show("Failed to open stream. Please make sure to specify a supported image type and resolution."); return; } nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady); nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_ColorFrameReady); nui.NuiCamera.ElevationAngle = 0; }