private void Window_Loaded(object sender, RoutedEventArgs e) { this.factory = new OpenNIDataSourceFactory("config.xml"); this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.factory.CreateClusterDataSource(new Core.Clustering.ClusterDataSourceSettings { MaximumDepthThreshold = 900 }), new Core.Shape.ShapeDataSourceSettings())); this.factory.CreateRGBImageDataSource().Start(); var depthImageSource = this.factory.CreateDepthImageDataSource(); depthImageSource.NewDataAvailable += new NewDataHandler<ImageSource>(MainWindow_NewDataAvailable); depthImageSource.Start(); handDataSource.Start(); }
private void StartDepthSource() { try { if (this.VideoSource == null) { Mouse.OverrideCursor = Cursors.Wait; this.dataSourceFactory = new OpenNIDataSourceFactory("config.xml"); this.VideoSource = dataSourceFactory.CreateDepthImageDataSource(); this.clusterdataSource = dataSourceFactory.CreateClusterDataSource(this.clusterDataSourceSettings); this.shapeDataSourceVideo = dataSourceFactory.CreateShapeDataSource(this.clusterdataSource, this.shapeDataSourceSettings); this.handDataSourceVideo = new HandDataSource(this.shapeDataSourceVideo, this.handDataSourceSettings); this.depthFrameFactory = new DepthDataFrameFactory(this.clusterdataSource.Size); this.VideoSource.Start(); Mouse.OverrideCursor = Cursors.Arrow; } this.ToggleLayers(); } catch (Exception exc) { MessageBox.Show("Error: " + exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }