Exemplo n.º 1
0
 public AreaGrab(string _UserName, char _CurrentLetter)
 {
     UserName = _UserName;
     CurrentLetter = _CurrentLetter;
     dataSourceFactory = new SDKDataSourceFactory();
     handDataSource = new HandDataSource(dataSourceFactory.CreateShapeDataSource(), new HandDataSourceSettings());
 }
        private void ImageJ_btn_Click(object sender, EventArgs e)
        {
            var dataSource = new HandDataSource(this.dataSourceFactory.CreateShapeDataSource(this.clusteringSettings, this.shapeSettings));

            new ImageForm(dataSource).Show();
            dataSource.Start();
        }
Exemplo n.º 3
0
        public Kinect()
        {
            IDataSourceFactory dataSourceFactory = new SDKDataSourceFactory();
            var handDataSource = new HandDataSource(dataSourceFactory.CreateShapeDataSource());

            handDataSource.NewDataAvailable += new NewDataHandler <HandCollection>(handDataSource_NewDataAvailable);
            handDataSource.Start();
        }
        private void buttonHandTracking_Click(object sender, EventArgs e)
        {
            this.SetImageDataSource(this.dataSourceFactory.CreateDepthBitmapDataSource());
            var dataSource     = (this.dataSourceFactory as OpenNIDataSourceFactory).CreateTrackingClusterDataSource();
            var handDataSource = new HandDataSource(this.dataSourceFactory.CreateShapeDataSource(dataSource, this.shapeSettings), this.handDetectionSettings);

            this.activeDataSources.Add(handDataSource);
            var layer = new HandLayer(handDataSource);

            this.videoControl.AddLayer(layer);
            handDataSource.Start();
        }
Exemplo n.º 5
0
        private void RunTest(string framePath, Action<HandCollection> assertions)
        {
            var frameSize = new IntSize(640, 480);
            var frame = new DepthDataFrameRepository(frameSize).Load(framePath);
            using (var frameDataSource = new DepthFramePointerDataSource(frame))
            {
                var src = new HandDataSource(new ClusterShapeDataSource(new OpenNIClusterDataSource(frameDataSource, new ClusterDataSourceSettings())));
                frameDataSource.Push();

                assertions(src.CurrentValue);
            }
        }
Exemplo n.º 6
0
        private void RunTest(string framePath, Action <HandCollection> assertions)
        {
            var frameSize = new IntSize(640, 480);
            var frame     = new DepthDataFrameRepository(frameSize).Load(framePath);

            using (var frameDataSource = new DepthFramePointerDataSource(frame))
            {
                var src = new HandDataSource(new ClusterShapeDataSource(new OpenNIClusterDataSource(frameDataSource, new ClusterDataSourceSettings())));
                frameDataSource.Push();

                assertions(src.CurrentValue);
            }
        }
Exemplo n.º 7
0
 private void buttonHandTracking_Click(object sender, EventArgs e)
 {
     this.SetImageDataSource(this.dataSourceFactory.CreateDepthBitmapDataSource());
     var dataSource = (this.dataSourceFactory as OpenNIDataSourceFactory).CreateTrackingClusterDataSource();
     var handDataSource = new HandDataSource(this.dataSourceFactory.CreateShapeDataSource(dataSource, this.shapeSettings), this.handDetectionSettings);
     this.activeDataSources.Add(handDataSource);
     var layer = new HandLayer(handDataSource);
     this.videoControl.AddLayer(layer);
     handDataSource.Start();
 }
Exemplo n.º 8
0
 private void buttonImageManipulation_Click(object sender, EventArgs e)
 {
     var dataSource = new HandDataSource(this.dataSourceFactory.CreateShapeDataSource(this.clusteringSettings, this.shapeSettings));
     new ImageForm(dataSource).Show();
     dataSource.Start();
 }
Exemplo n.º 9
0
        void InitKinect()
        {
            foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {
                    this._kinectDevice = potentialSensor;
                    break;
                }
            }

            if( null != this._kinectDevice)
            {
                //_kinectDevice = KinectSensor.KinectSensors[0];
                _kinectDevice.SkeletonStream.Enable();
                _kinectDevice.ColorStream.Enable();
                _kinectDevice.DepthStream.Enable();
                _kinectDevice.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(myKinect_ColorFrameReady);
                _kinectDevice.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(SkeletonHandler);
                try
                {
                    _kinectDevice.Start();
                    skeletonData = new Skeleton[_kinectDevice.SkeletonStream.FrameSkeletonArrayLength];
                    EnableNearModeSkeletalTracking();

                   // restPosCheck.Start(); //start restPos check thread.
                }
                catch (IOException)
                {
                    this._kinectDevice = null;
                }

                System.Diagnostics.Debug.WriteLine("detected:========="+ _kinectDevice.Status);
                //button for gesture recording.ADD.
                btnRecord.Enabled = true;
                btnRecord.Click += new EventHandler(btnRecord_Click);

                BtnCameraUp.Enabled = true;
                BtnCameraDown.Enabled = true;
                BtnCameraUp.Click += new EventHandler(BtnCameraUpClick);
                BtnCameraDown.Click += new EventHandler(BtnCameraDownClick);
                btnTestbegin.Enabled = true;
                btnTestbegin.Click += new EventHandler(Testingbegin_click);
            }

            #region CCT code
            //CCT hand tracking code:
            try
            {
                this.clusteringSettings.MaximumDepthThreshold = 2000; //added threshold. as per CCT eg
                IDataSourceFactory dataSourceFactory = new SDKDataSourceFactory(useNearMode: false); //trying new modded src
                var handDataSource = new HandDataSource(dataSourceFactory.CreateShapeDataSource(this.clusteringSettings, this.shapeSettings), this.handDetectionSettings);
                handDataSource.NewDataAvailable += new NewDataHandler<HandCollection>(handDataSource_NewDataAvailable);
                handDataSource.Start();
                //System.Diagnostics.Debug.WriteLine("hand data src started");

            }
            catch (ArgumentOutOfRangeException exc)
            {
                //Cursor.Current = Cursors.Default;
                //MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                System.Diagnostics.Debug.WriteLine("===Error using CCT !!=========== " + exc.Message);
                //return;
            }
            #endregion
        }
Exemplo n.º 10
0
        void InitKinect()
        {
            foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {
                    this._kinectDevice = potentialSensor;
                    break;
                }
            }

            if (null != this._kinectDevice)
            {
                //_kinectDevice = KinectSensor.KinectSensors[0];
                _kinectDevice.SkeletonStream.Enable();
                _kinectDevice.ColorStream.Enable();
                _kinectDevice.DepthStream.Enable();
                _kinectDevice.ColorFrameReady    += new EventHandler <ColorImageFrameReadyEventArgs>(myKinect_ColorFrameReady);
                _kinectDevice.SkeletonFrameReady += new EventHandler <SkeletonFrameReadyEventArgs>(SkeletonHandler);
                try
                {
                    _kinectDevice.Start();
                    skeletonData = new Skeleton[_kinectDevice.SkeletonStream.FrameSkeletonArrayLength];
                    EnableNearModeSkeletalTracking();

                    // restPosCheck.Start(); //start restPos check thread.
                }
                catch (IOException)
                {
                    this._kinectDevice = null;
                }

                System.Diagnostics.Debug.WriteLine("detected:=========" + _kinectDevice.Status);
                //button for gesture recording.ADD.
                btnRecord.Enabled = true;
                btnRecord.Click  += new EventHandler(btnRecord_Click);

                BtnCameraUp.Enabled   = true;
                BtnCameraDown.Enabled = true;
                BtnCameraUp.Click    += new EventHandler(BtnCameraUpClick);
                BtnCameraDown.Click  += new EventHandler(BtnCameraDownClick);
                btnTestbegin.Enabled  = true;
                btnTestbegin.Click   += new EventHandler(Testingbegin_click);
            }

            #region CCT code
            //CCT hand tracking code:
            try
            {
                this.clusteringSettings.MaximumDepthThreshold = 2000;                                //added threshold. as per CCT eg
                IDataSourceFactory dataSourceFactory = new SDKDataSourceFactory(useNearMode: false); //trying new modded src
                var handDataSource = new HandDataSource(dataSourceFactory.CreateShapeDataSource(this.clusteringSettings, this.shapeSettings), this.handDetectionSettings);
                handDataSource.NewDataAvailable += new NewDataHandler <HandCollection>(handDataSource_NewDataAvailable);
                handDataSource.Start();
                //System.Diagnostics.Debug.WriteLine("hand data src started");
            }
            catch (ArgumentOutOfRangeException exc)
            {
                //Cursor.Current = Cursors.Default;
                //MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                System.Diagnostics.Debug.WriteLine("===Error using CCT !!=========== " + exc.Message);
                //return;
            }
            #endregion
        }