Exemple #1
0
        private void initialize()
        {
            try
            {
                if (KinectSensor.KinectSensors.Count == 0)
                {
                    throw new Exception("Kinect isn't connected");
                }
                this.kinectSensor = KinectSensor.KinectSensors[0];

                this.KinectImage = new KinectImage();

                //rgb
                this.kinectSensor.ColorStream.Enable(colorImageFormat);
                this.videoFrameClass   = new VideoFrameClass(this.kinectSensor, colorImageFormat);
                this.KinectImage.Color = this.videoFrameClass.VideoColors;

                // 深度ストリーム
                this.kinectSensor.DepthStream.Enable(depthImageFormat);
                this.depthFrameClass           = new DepthFrameClass(this.kinectSensor, depthImageFormat, this.scale);
                this.KinectImage.Depth         = this.depthFrameClass.KinectDepth;
                this.KinectImage.PlayerIndexes = this.depthFrameClass.PlayerIndexes;

                // スケルトンストリーム
                this.kinectSensor.SkeletonStream.Enable();
                this.skeletonFrameClass   = new SkeletonFrameClass(this.kinectSensor, this.scale);
                this.KinectImage.Skeleton = this.skeletonFrameClass.skeletonList;

                //通常モードで使用
                this.kinectSensor.DepthStream.Range = DepthRange.Default;

                // Kinectの動作を開始する
                this.kinectSensor.Start();

                //水平角の修正
                if (this.kinectSensor.ElevationAngle != 0)
                {
                    this.kinectSensor.ElevationAngle = 0;
                }
            }
            catch (Exception e)
            {
                throw new Exception("Kinect internal error");
            }
        }
        private void initialize()
        {
            try
            {
                if (KinectSensor.KinectSensors.Count == 0) throw new Exception("Kinect isn't connected");
                this.kinectSensor = KinectSensor.KinectSensors[0];

                this.KinectImage = new KinectImage();

                //rgb
                this.kinectSensor.ColorStream.Enable(colorImageFormat);
                this.videoFrameClass = new VideoFrameClass(this.kinectSensor, colorImageFormat);
                this.KinectImage.Color = this.videoFrameClass.VideoColors;

                // 深度ストリーム
                this.kinectSensor.DepthStream.Enable(depthImageFormat);
                this.depthFrameClass = new DepthFrameClass(this.kinectSensor, depthImageFormat, this.scale);
                this.KinectImage.Depth = this.depthFrameClass.KinectDepth;
                this.KinectImage.PlayerIndexes = this.depthFrameClass.PlayerIndexes;

                // スケルトンストリーム
                this.kinectSensor.SkeletonStream.Enable();
                this.skeletonFrameClass = new SkeletonFrameClass(this.kinectSensor, this.scale);
                this.KinectImage.Skeleton = this.skeletonFrameClass.skeletonList;

                //通常モードで使用
                this.kinectSensor.DepthStream.Range = DepthRange.Default;

                // Kinectの動作を開始する
                this.kinectSensor.Start();

                //水平角の修正
                if (this.kinectSensor.ElevationAngle != 0)
                    this.kinectSensor.ElevationAngle = 0;

            }
            catch (Exception e)
            {
                throw new Exception("Kinect internal error");
            }
        }