예제 #1
0
        private void InitializeKinectSensor(KinectSensor sensor)
        {
            if (sensor != null)
            {
                sensor.DepthStream.Range = DepthRange.Default;

                sensor.SkeletonStream.Enable();
                sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
                sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);


                DepthImageStream depthStream = sensor.DepthStream;
                this.screenImageBitmap       = new WriteableBitmap(depthStream.FrameWidth, depthStream.FrameHeight, 96, 96, PixelFormats.Bgra32, null);
                this._GreenScreenImageRect   = new Int32Rect(0, 0, (int)Math.Ceiling(this.screenImageBitmap.Width), (int)Math.Ceiling(this.screenImageBitmap.Height));
                this.ScreenImageStride       = depthStream.FrameWidth * 4;
                this.GreenScreenImage.Source = this.screenImageBitmap;

                this.depthPixelData = new short[this.kinectSensor.DepthStream.FramePixelDataLength];
                this.colorPixelData = new byte[this.kinectSensor.ColorStream.FramePixelDataLength];
                if (!this._DoUsePolling)
                {
                    sensor.AllFramesReady += KinectDevice_AllFramesReady;
                }

                sensor.Start();

                //init the image processer
                imageProcesser = new ColorImageProcesser(this, sensor,
                                                         this.kinectSensor.DepthStream.FramePixelDataLength, this.kinectSensor.ColorStream.FramePixelDataLength,
                                                         depthStream.FrameWidth, depthStream.FrameHeight,
                                                         sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight,
                                                         sensor.DepthStream.Format, sensor.ColorStream.Format);
                imageProcesser.Start();
            }
        }
예제 #2
0
        public VideoShot(ColorImageProcesser processer, MainWindow window, int videoNum,
                         KinectSensor kinectDevice,
                         int dWidht, int dHeight,
                         int cWidth, int cHeight,
                         DepthImageFormat dImageFormat, ColorImageFormat cImageFormat)
        {
            parentProcesser = processer;
            videoName       = PadLeft(videoNum);
            _windowUI       = window;
            _kinectDevice   = kinectDevice;


            depthFrameWidth  = dWidht;
            depthFrameHeight = dHeight;

            colorFrameWidth  = cWidth;
            colorFrameHeight = cHeight;

            depthFrameStride = depthFrameWidth * BytesPerPixel;
            colorFrameStride = colorFrameWidth * BytesPerPixel;

            depthImageFormat = dImageFormat;
            colorImageFormat = cImageFormat;

            screenHeight = SystemParameters.PrimaryScreenHeight;
            screenWidth  = SystemParameters.PrimaryScreenWidth;

            Start();
        }
예제 #3
0
        public VideoShot(ColorImageProcesser processer, MainWindow window, int videoNum,
            KinectSensor kinectDevice,
            int dWidht, int dHeight,
            int cWidth, int cHeight,
            DepthImageFormat dImageFormat, ColorImageFormat cImageFormat)
        {
            parentProcesser = processer;
            videoName = PadLeft(videoNum);
            _windowUI = window;
            _kinectDevice = kinectDevice;

            depthFrameWidth = dWidht;
            depthFrameHeight = dHeight;

            colorFrameWidth = cWidth;
            colorFrameHeight = cHeight;

            depthFrameStride = depthFrameWidth * BytesPerPixel;
            colorFrameStride = colorFrameWidth * BytesPerPixel;

            depthImageFormat = dImageFormat;
            colorImageFormat = cImageFormat;

            screenHeight = SystemParameters.PrimaryScreenHeight;
            screenWidth = SystemParameters.PrimaryScreenWidth;

            Start();
        }
        private void InitializeKinectSensor(KinectSensor sensor)
        {
            if (sensor != null)
            {
                sensor.DepthStream.Range = DepthRange.Default;

                sensor.SkeletonStream.Enable();
                sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
                sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);

                DepthImageStream depthStream = sensor.DepthStream;
                this.screenImageBitmap = new WriteableBitmap(depthStream.FrameWidth, depthStream.FrameHeight, 96, 96, PixelFormats.Bgra32  , null);
                this._GreenScreenImageRect = new Int32Rect(0, 0, (int)Math.Ceiling(this.screenImageBitmap.Width), (int)Math.Ceiling(this.screenImageBitmap.Height));
                this.ScreenImageStride = depthStream.FrameWidth * 4;
                this.GreenScreenImage.Source = this.screenImageBitmap;

                this.depthPixelData = new short[this.kinectSensor.DepthStream.FramePixelDataLength];
                this.colorPixelData = new byte[this.kinectSensor.ColorStream.FramePixelDataLength];
                if (!this._DoUsePolling)
                {
                    sensor.AllFramesReady += KinectDevice_AllFramesReady;
                }

                sensor.Start();

                //init the image processer
                imageProcesser = new ColorImageProcesser(this, sensor,
                    this.kinectSensor.DepthStream.FramePixelDataLength, this.kinectSensor.ColorStream.FramePixelDataLength,
                    depthStream.FrameWidth, depthStream.FrameHeight,
                    sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight,
                    sensor.DepthStream.Format,sensor.ColorStream.Format);
                imageProcesser.Start();
            }
        }