private void Start()
        {
            this.Cursor = Cursors.Wait;
            this.checkClusterLayer.IsEnabled = true;
            this.checkHandLayer.IsEnabled    = true;


            this.factory = new SDKDataSourceFactory();

            this.clusterDataSource = this.factory.CreateClusterDataSource(new ClusterDataSourceSettings {
                MaximumDepthThreshold = 1000
            });
            this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));
            //this.rgbImageDataSource = this.factory.CreateRGBImageDataSource();
            //this.rgbImageDataSource.Start();

            var depthImageSource = this.factory.CreateDepthImageDataSource();

            depthImageSource.NewDataAvailable += new NewDataHandler <ImageSource>(MainWindow_NewDataAvailable);
            depthImageSource.Start();
            handDataSource.Start();

            //this.mouseController = new MouseController(handDataSource,true);

            this.Cursor = Cursors.Arrow;

            handDataSource.NewDataAvailable += new NewDataHandler <HandCollection>(handDataSource_NewDataAvailable);
        }
示例#2
0
        private void Start()
        {
            this.Cursor = Cursors.Wait;
            this.buttonHandInterface.IsEnabled = true;
            this.buttonManipulation.IsEnabled = true;
            this.buttonRectangleVideo.IsEnabled = true;
            this.buttonTouch.IsEnabled = true;
            this.checkClusterLayer.IsEnabled = true;
            this.checkHandLayer.IsEnabled = true;
            this.radioKinectSDK.IsEnabled = false;
            this.radioOpenNI.IsEnabled = false;

            if (this.radioKinectSDK.IsChecked.GetValueOrDefault())
            {
                this.factory = new SDKDataSourceFactory();
            }
            else
            {
                this.factory = new OpenNIDataSourceFactory("config.xml");
            }
            this.clusterDataSource = this.factory.CreateClusterDataSource(new Core.Clustering.ClusterDataSourceSettings { MaximumDepthThreshold = 900 });
            this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));
            this.rgbImageDataSource = this.factory.CreateRGBImageDataSource();
            this.rgbImageDataSource.Start();

            var depthImageSource = this.factory.CreateDepthImageDataSource();
            depthImageSource.NewDataAvailable += new NewDataHandler<ImageSource>(MainWindow_NewDataAvailable);
            depthImageSource.Start();
            handDataSource.Start();
            this.Cursor = Cursors.Arrow;
        }
示例#3
0
 public ClusterShapeDataSource(IClusterDataSource clusterDataSource, ShapeDataSourceSettings settings)
     : base(clusterDataSource)
 {
     this.factory      = new ClusterShapeFactory(settings);
     this.size         = clusterDataSource.Size;
     this.CurrentValue = new ShapeCollection();
 }
示例#4
0
        private void Start()
        {
            this.Cursor = Cursors.Wait;
            this.buttonHandInterface.IsEnabled  = true;
            this.buttonManipulation.IsEnabled   = true;
            this.buttonRectangleVideo.IsEnabled = true;
            this.buttonTouch.IsEnabled          = true;
            this.checkClusterLayer.IsEnabled    = true;
            this.checkHandLayer.IsEnabled       = true;
            this.radioKinectSDK.IsEnabled       = false;
            this.radioOpenNI.IsEnabled          = false;

            if (this.radioKinectSDK.IsChecked.GetValueOrDefault())
            {
                this.factory = new SDKDataSourceFactory();
            }
            else
            {
                this.factory = new OpenNIDataSourceFactory("config.xml");
            }
            this.clusterDataSource = this.factory.CreateClusterDataSource(new Core.Clustering.ClusterDataSourceSettings {
                MaximumDepthThreshold = 900
            });
            this.handDataSource     = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));
            this.rgbImageDataSource = this.factory.CreateRGBImageDataSource();
            this.rgbImageDataSource.Start();

            var depthImageSource = this.factory.CreateDepthImageDataSource();

            depthImageSource.NewDataAvailable += new NewDataHandler <ImageSource>(MainWindow_NewDataAvailable);
            depthImageSource.Start();
            handDataSource.Start();
            this.Cursor = Cursors.Arrow;
        }
        private void Start()
        {
            this.Cursor = Cursors.Wait;
            this.checkClusterLayer.IsEnabled = true;
            this.checkHandLayer.IsEnabled = true;
            

            this.factory = new SDKDataSourceFactory();

            this.clusterDataSource = this.factory.CreateClusterDataSource(new ClusterDataSourceSettings { MaximumDepthThreshold = 1000 });
            this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));
            //this.rgbImageDataSource = this.factory.CreateRGBImageDataSource();
            //this.rgbImageDataSource.Start();

            var depthImageSource = this.factory.CreateDepthImageDataSource();
            depthImageSource.NewDataAvailable += new NewDataHandler<ImageSource>(MainWindow_NewDataAvailable);
            depthImageSource.Start();
            handDataSource.Start();

            //this.mouseController = new MouseController(handDataSource,true);

            this.Cursor = Cursors.Arrow;

            handDataSource.NewDataAvailable += new NewDataHandler<HandCollection>(handDataSource_NewDataAvailable);
        }
示例#6
0
        private void Start()
        {
            // initialize sensor Microsoft Kinect SDK
            sensor = Microsoft.Kinect.KinectSensor.KinectSensors.FirstOrDefault();
            sensor.Start();
            sensor.ElevationAngle = 13;

            // initialize some element

            this.Cursor  = Cursors.Wait;
            this.factory = new SDKDataSourceFactory();

            this.clusterDataSource = this.factory.CreateClusterDataSource(new Core.Clustering.ClusterDataSourceSettings {
                MaximumDepthThreshold = 900
            });
            this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));

            var depthImageSource = this.factory.CreateDepthImageDataSource();

            depthImageSource.NewDataAvailable += new NewDataHandler <ImageSource>(MainWindow_NewDataAvailable);
            handDataSource.NewDataAvailable   += new NewDataHandler <HandCollection>(handDataSource_NewDataAvailable);
            HandInterfaceWindow(this.handDataSource, depthImageSource);
            //new HandInterfaceWindow(this.handDataSource, this.rgbImageDataSource).Show();
            depthImageSource.Start();
            handDataSource.Start();
            this.Cursor = Cursors.Arrow;
        }
示例#7
0
        private void Start()
        {
            _checkClusterLayer.IsEnabled = true;
            _checkClusterLayer.IsChecked = true;
            _checkHandLayer.IsEnabled    = true;
            _checkHandLayer.IsChecked    = true;

            _factory = new SDKDataSourceFactory();

            _depthImageSource = _factory.CreateDepthImageDataSource();
            _depthImageSource.NewDataAvailable += new NewDataHandler <ImageSource>(MainWindow_NewDataAvailable);
            _depthImageSource.Start();

            _clusterDataSource = _factory.CreateClusterDataSource(new ClusterDataSourceSettings {
                MaximumDepthThreshold = 900
            });
            _clusterDataSource.NewDataAvailable += new NewDataHandler <ClusterCollection>(ClusterDataSource_NewDataAvailable);
            _clusterDataSource.Start();

            _handDataSource = new HandDataSource(_factory.CreateShapeDataSource(_clusterDataSource, new ShapeDataSourceSettings()));
            _handDataSource.NewDataAvailable += new NewDataHandler <HandCollection>(HandDataSource_NewDataAvailable);
            _handDataSource.Start();

            UpdateLayers();
        }
示例#8
0
        //This function starts the communcation between the Candescent NUI library with the Kinect device.
        private void Start()
        {
            //Specifies that the Kinect device is in not in Near Mode
            this.factory = new SDKDataSourceFactory(useNearMode: false);

            //This specifies the minimum and maximum depth threshold that the Kinect will use to find hands.
            this.clusterDataSource = this.factory.CreateClusterDataSource(new Core.Clustering.ClusterDataSourceSettings {
                MaximumDepthThreshold = 1000
            });
            this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));

            //This will output the display of the video feed in depth mode
            var depthImageSource = this.factory.CreateDepthImageDataSource();

            depthImageSource.NewDataAvailable += new NewDataHandler <ImageSource>(MainWindow_NewDataAvailable);
            depthImageSource.Start();
            handDataSource.Start();
            handDataSource.NewDataAvailable += new NewDataHandler <HandCollection>(handDataSource_NewDataAvailable);

            //This add a layer and paint any detected hands in the colour green with a white dot for detected palms and purple dots for each finger tip detected.
            var layers = new List <IWpfLayer>();

            layers.Add(new WpfHandLayer(this.handDataSource));
            this.videoControl.Layers = layers;
        }
示例#9
0
 private void RefreshDepthFrame()
 {
     using (var depthFrameSource = new DepthFramePointerDataSource(this.CurrentFrame.Frame))
     {
         this.clusterDataSource = new OpenNIClusterDataSource(depthFrameSource, this.clusterDataSourceSettings);
         this.shapeDataSource   = new ClusterShapeDataSource(this.clusterDataSource, this.shapeDataSourceSettings);
         this.handDataSource    = new HandDataSource(this.shapeDataSource, this.handDataSourceSettings);
         this.ToggleLayers();
         this.ImageSource = new DepthImageDataSource(depthFrameSource);
         depthFrameSource.Push();
     }
 }
示例#10
0
        private void CreateControllerInTrackingMode()
        {
            //this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.trackingClusterDataSource));
            //this.mouseController = new MouseController(this.handDataSource, this.trackingClusterDataSource);
            this.clusterDataSource = this.factory.CreateClusterDataSource(new ClusterDataSourceSettings {
                MaximumDepthThreshold = 900
            });
            this.handDataSource  = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));
            this.mouseController = new MouseController(this.handDataSource);

            this.mouseController.Enabled = this.buttonToggle.IsChecked.Value;
            this.handDataSource.Start();
        }
示例#11
0
        public void ToggleLayers(IClusterDataSource clusterDataSource, IHandDataSource handDataSource)
        {
            foreach (var layer in this.Layers)
            {
                layer.Dispose();
            }
            var layers = new List<IWpfLayer>();

            if (this.DisplayClusteringLayer && clusterDataSource != null)
            {
                layers.Add(new WpfClusterLayer(clusterDataSource));
            }

            if (this.DisplayHandLayer && handDataSource != null)
            {
                layers.Add(new WpfHandLayer(handDataSource));
            }
            this.Layers = layers;
        }
示例#12
0
        public void ToggleLayers(IClusterDataSource clusterDataSource, IHandDataSource handDataSource)
        {
            foreach (var layer in this.Layers)
            {
                layer.Dispose();
            }
            var layers = new List <IWpfLayer>();

            if (this.DisplayClusteringLayer && clusterDataSource != null)
            {
                layers.Add(new WpfClusterLayer(clusterDataSource));
            }

            if (this.DisplayHandLayer && handDataSource != null)
            {
                layers.Add(new WpfHandLayer(handDataSource));
            }
            this.Layers = layers;
        }
示例#13
0
 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);
     }
 }
示例#14
0
        private void Start()
        {
            _checkClusterLayer.IsEnabled = true;
            _checkClusterLayer.IsChecked = true;
            _checkHandLayer.IsEnabled = true;
            _checkHandLayer.IsChecked = true;

            _factory = new SDKDataSourceFactory();

            _depthImageSource = _factory.CreateDepthImageDataSource();
            _depthImageSource.NewDataAvailable += new NewDataHandler<ImageSource>(MainWindow_NewDataAvailable);
            _depthImageSource.Start();

            _clusterDataSource = _factory.CreateClusterDataSource(new ClusterDataSourceSettings { MaximumDepthThreshold = 900 });
            _clusterDataSource.NewDataAvailable += new NewDataHandler<ClusterCollection>(ClusterDataSource_NewDataAvailable);
            _clusterDataSource.Start();

            _handDataSource = new HandDataSource(_factory.CreateShapeDataSource(_clusterDataSource, new ShapeDataSourceSettings()));
            _handDataSource.NewDataAvailable += new NewDataHandler<HandCollection>(HandDataSource_NewDataAvailable);
            _handDataSource.Start();

            UpdateLayers();
        }
示例#15
0
 public WpfClusterLayer(IClusterDataSource dataSource)
 {
     this.dataSource = dataSource;
     this.dataSource.NewDataAvailable += dataSource_NewDataAvailable;
 }
示例#16
0
 public ClusterLayer(IClusterDataSource dataSource, float zoomFactor)
 {
     this.dataSource = dataSource;
     this.dataSource.NewDataAvailable += dataSource_NewDataAvailable;
     this.zoomFactor = zoomFactor;
 }
示例#17
0
 public ClusterLayer(IClusterDataSource dataSource)
     : this(dataSource, 1)
 { }
示例#18
0
 public WpfClusterLayer(IClusterDataSource dataSource)
 {
     this.dataSource = dataSource;
     this.dataSource.NewDataAvailable += dataSource_NewDataAvailable;
 }
 private void SetClusterDataSource(IClusterDataSource dataSource)
 {
     this.SetDataSource(dataSource, new ClusterLayer(dataSource));
 }
 public IShapeDataSource CreateShapeDataSource(IClusterDataSource clusterdataSource)
 {
     return new ClusterShapeDataSource(clusterdataSource, new ShapeDataSourceSettings());
 }
示例#21
0
 private void SetClusterDataSource(IClusterDataSource dataSource)
 {
     this.SetDataSource(dataSource, new ClusterLayer(dataSource));
 }
示例#22
0
        private void CreateControllerInTrackingMode()
        {
            //this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.trackingClusterDataSource));
            //this.mouseController = new MouseController(this.handDataSource, this.trackingClusterDataSource);
            this.clusterDataSource = this.factory.CreateClusterDataSource(new ClusterDataSourceSettings { MaximumDepthThreshold = 900 });
            this.handDataSource = new HandDataSource(this.factory.CreateShapeDataSource(this.clusterDataSource, new Core.Shape.ShapeDataSourceSettings()));
            this.mouseController = new MouseController(this.handDataSource);

            this.mouseController.Enabled = this.buttonToggle.IsChecked.Value;
            this.handDataSource.Start();
        }
示例#23
0
 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);
     }
 }
 public IShapeDataSource CreateShapeDataSource(IClusterDataSource clusterdataSource)
 {
     return(new ClusterShapeDataSource(clusterdataSource, new ShapeDataSourceSettings()));
 }
示例#25
0
 public ClusterShapeDataSource(IClusterDataSource clusterDataSource)
     : this(clusterDataSource, new ShapeDataSourceSettings())
 {
 }
示例#26
0
 public ClusterLayer(IClusterDataSource dataSource)
     : this(dataSource, 1)
 {
 }
 public IShapeDataSource CreateShapeDataSource(IClusterDataSource clusterdataSource, ShapeDataSourceSettings shapeDataSourceSettings)
 {
     return new ClusterShapeDataSource(clusterdataSource, shapeDataSourceSettings);
 }
示例#28
0
 public ClusterLayer(IClusterDataSource dataSource, float zoomFactor)
 {
     this.dataSource = dataSource;
     this.dataSource.NewDataAvailable += dataSource_NewDataAvailable;
     this.zoomFactor = zoomFactor;
 }
 public IShapeDataSource CreateShapeDataSource(IClusterDataSource clusterdataSource, ShapeDataSourceSettings shapeDataSourceSettings)
 {
     return(new ClusterShapeDataSource(clusterdataSource, shapeDataSourceSettings));
 }
示例#30
0
 private void RefreshDepthFrame()
 {
     using (var depthFrameSource = new DepthFramePointerDataSource(this.CurrentFrame.Frame))
     {
         this.clusterDataSource = new OpenNIClusterDataSource(depthFrameSource, this.clusterDataSourceSettings);
         this.shapeDataSource = new ClusterShapeDataSource(this.clusterDataSource, this.shapeDataSourceSettings);
         this.handDataSource = new HandDataSource(this.shapeDataSource, this.handDataSourceSettings);
         this.ToggleLayers();
         this.ImageSource = new DepthImageDataSource(depthFrameSource);
         depthFrameSource.Push();
     }
 }