Esempio n. 1
0
        //キャリブレーション後の画像を返す
        public ShadowPackage GetCalibedBackImage()
        {
            ShadowPackage backPackage = new ShadowPackage();

            backPackage.srcMat = this.backDstImg;
            return(backPackage);
        }
Esempio n. 2
0
        //セットアップ
        public KinectImage()
        #region
        {
            //キネクト
            this.kinect = KinectSensor.GetDefault();

            //bodyIndexFrameの処理
            this.bodyIndexFrameDes    = this.kinect.BodyIndexFrameSource.FrameDescription;
            this.bodyIndexFrameReader = this.kinect.BodyIndexFrameSource.OpenReader();
            this.bodyIndexFrameReader.FrameArrived += this.BodyIndexFrame_Arrived;
            //画像情報
            this.kinectImgPackage = new ShadowPackage();
            this.imageWidth       = this.bodyIndexFrameDes.Width;  // imgW;
            this.imageHeight      = this.bodyIndexFrameDes.Height; // imgH;

            this.imageBytePerPixel = (int)this.bodyIndexFrameDes.BytesPerPixel;
            this.bitmapRec         = new Int32Rect(0, 0, this.imageWidth, this.imageHeight);
            this.bitmapStride      = (int)(this.imageWidth * this.imageBytePerPixel);

            this.bodyIndexBuffer = new byte[this.imageWidth *
                                            this.imageHeight * this.imageBytePerPixel];
            this.kinectImage = new Mat(this.imageHeight, this.imageWidth, MatType.CV_8UC1);
            //キネクト開始
            this.kinect.Open();
        }
Esempio n. 3
0
        public ShadowPackage GetCalibedFloorImage()
        {
            ShadowPackage floorPackage = new ShadowPackage();

            floorPackage.srcMat = this.floorDstImg;
            return(floorPackage);
        }
Esempio n. 4
0
        //画像の表示とキャリブレーション
        void CastingImage(object org)
        {
            try
            {
                // 画像の取得
                if (this.kinectDevice.GetImage().srcMat != null)
                {
                    this.inputPackage = this.kinectDevice.GetImage();
                    try
                    {
                        if (this.recKinect.GetImage().srcMat != null)
                        {
                            //Console.WriteLine("LLL");
                            if (this.recKinect.GetImage().srcMat.Size() == this.kinectDevice.GetImage().srcMat.Size())
                            {
                                this.inputPackage.srcMat = this._sumMat(this.recKinect.GetImage().srcMat, this.kinectDevice.GetImage().srcMat, false);
                            }
                        }
                    }
                    catch { }

                    this._showInputImage(this.inputPackage.srcMat);
                }

                //Console.WriteLine("img");
            }
            catch { }
        }
Esempio n. 5
0
        //セットアップ
        public KinectImage()
        #region
        {
            //キネクト
            this.kinect = KinectSensor.GetDefault();
            
            //bodyIndexFrameの処理
            this.bodyIndexFrameDes = this.kinect.BodyIndexFrameSource.FrameDescription;
            this.bodyIndexFrameReader = this.kinect.BodyIndexFrameSource.OpenReader();
            this.bodyIndexFrameReader.FrameArrived += this.BodyIndexFrame_Arrived;
            //画像情報
            this.kinectImgPackage = new ShadowPackage();
            this.imageWidth =  this.bodyIndexFrameDes.Width;  // imgW;
            this.imageHeight = this.bodyIndexFrameDes.Height; // imgH;

            this.imageBytePerPixel = (int)this.bodyIndexFrameDes.BytesPerPixel;
            this.bitmapRec = new Int32Rect(0, 0, this.imageWidth, this.imageHeight);
            this.bitmapStride = (int)(this.imageWidth * this.imageBytePerPixel);
           
            this.bodyIndexBuffer = new byte[this.imageWidth *
                                                this.imageHeight * this.imageBytePerPixel];
            this.kinectImage = new Mat(this.imageHeight, this.imageWidth, MatType.CV_8UC1);
            //キネクト開始
            this.kinect.Open();
            
        }
Esempio n. 6
0
        //Window win;

        public RecordedData()
        {
            this.Add_Client_Click();
            this.package = new ShadowPackage();
            //6this.receivedimage = new Mat();

            //this.win = new Window("img");
        }
Esempio n. 7
0
        //Window win;

        public RecordedData()
        {
            this.Add_Client_Click();
            this.package = new ShadowPackage();
            //6this.receivedimage = new Mat();

            //this.win = new Window("img");
        }
Esempio n. 8
0
 void ProcessImage(object orgs)
 {
     try
     {
         if (this.inputPackage.srcMat != null)
         {
             //画像の加工
             this.processedPackage = this.inputPackage;
             //this.shadows.ElementAt(this.shadowIndex).SetOriginalImage(this.inputPackage);
             //this.shadows.ElementAt(this.shadowIndex).Processing();
         }
     }
     catch { }
 }
Esempio n. 9
0
        //加工前画像製造クラス
        //KinectImage kinectImage;

        #endregion

        //コンストラクタ
        public SystemMain()
        {
            this.recKinect = new RecordedData();
            this.kinectDevice = new KinectDevice();
            //this.camera._showImageEvent += this.CastingImage;
            this.inputPackage = new ShadowPackage();
            this.processedPackage = new ShadowPackage();

            this.inputimgTimer = new System.Threading.Timer(new TimerCallback(this.CastingImage));
            this.processimgTimer = new System.Threading.Timer(new TimerCallback(this.ProcessImage));
            this.outputimgTimer = new System.Threading.Timer(new TimerCallback(this.Calibration));
            this.inputimgTimer.Change(0,100);
            this.processimgTimer.Change(0,100);
            this.outputimgTimer.Change(0,100);
        }
Esempio n. 10
0
        //加工前画像製造クラス
        //KinectImage kinectImage;

        #endregion

        //コンストラクタ
        public SystemMain()
        {
            this.recKinect    = new RecordedData();
            this.kinectDevice = new KinectDevice();
            //this.camera._showImageEvent += this.CastingImage;
            this.inputPackage     = new ShadowPackage();
            this.processedPackage = new ShadowPackage();

            this.inputimgTimer   = new System.Threading.Timer(new TimerCallback(this.CastingImage));
            this.processimgTimer = new System.Threading.Timer(new TimerCallback(this.ProcessImage));
            this.outputimgTimer  = new System.Threading.Timer(new TimerCallback(this.Calibration));
            this.inputimgTimer.Change(0, 100);
            this.processimgTimer.Change(0, 100);
            this.outputimgTimer.Change(0, 100);
        }
Esempio n. 11
0
 public MakeShadowTest()
 {
     this.sizeofMat   = 6;
     this.package     = new ShadowPackage();
     this.rnd         = new Random();
     this.center      = new Point3f();
     this.shadowCalor = new Scalar[sizeofMat];
     this.players     = new _playrer[sizeofMat];
     this.pt          = new Point[sizeofMat];
     this.kinect      = KinectSensor.GetDefault();
     this.joints      = new Joint[this.sizeofMat];
     this.moveCenter  = new Point3f();
     this.vecofCenter = new Vec3f();
     this.param       = new Parameter();
 }
Esempio n. 12
0
 public MakeShadowTest()
 {
     this.sizeofMat = 6;
     this.package = new ShadowPackage();
     this.rnd = new Random();
     this.center = new Point3f();
     this.shadowCalor = new Scalar[sizeofMat];
     this.players = new _playrer[sizeofMat];
     this.pt = new Point[sizeofMat];
     this.kinect = KinectSensor.GetDefault();
     this.joints = new Joint[this.sizeofMat];
     this.moveCenter = new Point3f();
     this.vecofCenter = new Vec3f();
     this.param = new Parameter();
 }
Esempio n. 13
0
        //キャリブレーション
        public void CaliblationUpdate(ShadowPackage proccesedMatPckage)
        {
            Mat srcImg = new Mat();
            
            //入力画像
            srcImg = proccesedMatPckage.srcMat.Clone();
            
            this.imgChannles = srcImg.Channels();
            #region
            if (this.fragCutImg == 1)
            {
                this.cutRect = new CutRect(srcImg);
                this.fragCutImg = 0;
                this.imageWidth = srcImg.Width;
                this.imageHeight = srcImg.Height;
            }
            #endregion


            //座標の取得
            this.backIn_Pt = this.changePt(this._getPtForCalib(0));
            this.backOut_Pt = this.changePt(this._getPtForCalib(1));
            this.floorIn_Pt = this.changePt(this._getPtForCalib(2));
            this.floorOut_Pt = this.changePt(this._getPtForCalib(3));
            this.backOut_Pt = this.changePtRange(this.backOut_Pt);
            this.floorOut_Pt = this.changePtRange(this.floorOut_Pt);
           

            //back
            #region
            
            this.backIn_Pt = this.changePtRange(this.backIn_Pt);
            this.backDstImg = this.PerspectiveProject(srcImg, this.backIn_Pt, this.backOut_Pt).Clone();
            this.backDstImg = cutRect.CutImage(this.backDstImg,this.backOut_Pt).Clone();
            #endregion

            //floor
            #region
            
            this.floorIn_Pt = this.changePtRange(this.floorIn_Pt);
            this.floorDstImg = this.PerspectiveProject(srcImg, this.floorIn_Pt, this.floorOut_Pt).Clone();
            this.floorDstImg = cutRect.CutImage(this.floorDstImg, this.floorOut_Pt).Clone();
            #endregion

            srcImg.Dispose();

        }
Esempio n. 14
0
        //キャリブレーション
        public void CaliblationUpdate(ShadowPackage proccesedMatPckage)
        {
            Mat srcImg = new Mat();

            //入力画像
            srcImg = proccesedMatPckage.srcMat.Clone();

            this.imgChannles = srcImg.Channels();
            #region
            if (this.fragCutImg == 1)
            {
                this.cutRect     = new CutRect(srcImg);
                this.fragCutImg  = 0;
                this.imageWidth  = srcImg.Width;
                this.imageHeight = srcImg.Height;
            }
            #endregion


            //座標の取得
            this.backIn_Pt   = this.changePt(this._getPtForCalib(0));
            this.backOut_Pt  = this.changePt(this._getPtForCalib(1));
            this.floorIn_Pt  = this.changePt(this._getPtForCalib(2));
            this.floorOut_Pt = this.changePt(this._getPtForCalib(3));
            this.backOut_Pt  = this.changePtRange(this.backOut_Pt);
            this.floorOut_Pt = this.changePtRange(this.floorOut_Pt);


            //back
            #region

            this.backIn_Pt  = this.changePtRange(this.backIn_Pt);
            this.backDstImg = this.PerspectiveProject(srcImg, this.backIn_Pt, this.backOut_Pt).Clone();
            this.backDstImg = cutRect.CutImage(this.backDstImg, this.backOut_Pt).Clone();
            #endregion

            //floor
            #region

            this.floorIn_Pt  = this.changePtRange(this.floorIn_Pt);
            this.floorDstImg = this.PerspectiveProject(srcImg, this.floorIn_Pt, this.floorOut_Pt).Clone();
            this.floorDstImg = cutRect.CutImage(this.floorDstImg, this.floorOut_Pt).Clone();
            #endregion

            srcImg.Dispose();
        }
Esempio n. 15
0
 public void SetOriginalImage(ShadowPackage srcPacage)
 {
     this.package = srcPacage;
     this.imgW    = this.package.srcMat.Width;
     this.imgH    = this.package.srcMat.Height;
     this.mats    = new Mat[this.sizeofMat];
     this.dstMats = new Mat[this.sizeofMat];
     for (int i = 0; i < this.sizeofMat; i++)
     {
         this.center.X       = 0;
         this.center.Y       = 0;
         this.center.Z       = 0;
         this.mats[i]        = new Mat(this.package.srcMat.Height, this.package.srcMat.Width, MatType.CV_8UC1);
         this.dstMats[i]     = new Mat(this.package.srcMat.Height, this.package.srcMat.Width, MatType.CV_8UC3);
         this.players[i].mat = new Mat(this.package.srcMat.Height, this.package.srcMat.Width, MatType.CV_8UC1);
     }
 }
Esempio n. 16
0
        public void SetOriginalImage(ShadowPackage srcPacage)
        {   
            this.package = srcPacage;
            this.imgW = this.package.srcMat.Width;
            this.imgH = this.package.srcMat.Height;
            this.mats = new Mat[this.sizeofMat];
            this.dstMats = new Mat[this.sizeofMat];
            for (int i = 0; i < this.sizeofMat; i++)
            {
                this.center.X = 0;
                this.center.Y = 0;
                this.center.Z = 0;
                this.mats[i] = new Mat(this.package.srcMat.Height, this.package.srcMat.Width, MatType.CV_8UC1);
                this.dstMats[i] = new Mat(this.package.srcMat.Height, this.package.srcMat.Width, MatType.CV_8UC3);
                this.players[i].mat = new Mat(this.package.srcMat.Height, this.package.srcMat.Width, MatType.CV_8UC1);
            }

        }
Esempio n. 17
0
 public KinectDevice()
 {
     //kinect設定
     this.kinect = KinectSensor.GetDefault();
     //設定とハンドラ
     //colorImage
     #region
     this.colorImageFormat = ColorImageFormat.Bgra;
     this.colorFrameDescription = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat);
     this.colorFrameReader = this.kinect.ColorFrameSource.OpenReader();
     this.colorFrameReader.FrameArrived += ColorFrame_Arrived;
     this.colors = new byte[this.colorFrameDescription.Width
                                    * this.colorFrameDescription.Height
                                    * this.colorFrameDescription.BytesPerPixel];
     #endregion
     //骨格情報
     #region
     this.bodyFrameReader = this.kinect.BodyFrameSource.OpenReader();
     this.bodyFrameReader.FrameArrived += BodyFrame_Arrived;
     #endregion
     //震度情報
     #region
     this.depthFrameReader = this.kinect.DepthFrameSource.OpenReader();
     this.depthFrameReader.FrameArrived += DepthFrame_Arrived;
     this.depthFrameDescription = this.kinect.DepthFrameSource.FrameDescription;
     this.depthBuffer = new ushort[this.depthFrameDescription.LengthInPixels];
     #endregion
     //BodyIndex
     #region
     this.bodyIndexFrameDes = this.kinect.BodyIndexFrameSource.FrameDescription;
     this.bodyIndexFrameReader = this.kinect.BodyIndexFrameSource.OpenReader();
     this.bodyIndexFrameReader.FrameArrived += this.BodyIndexFrame_Arrived;
     this.bodyIndexBuffer = new byte[this.bodyIndexFrameDes.Width *
                                         this.bodyIndexFrameDes.Height * this.bodyIndexFrameDes.BytesPerPixel];
     #endregion
     //kinect開始
     this.package = new ShadowPackage();
     this.imageWidth = this.bodyIndexFrameDes.Width; 
     this.imageHeight = this.bodyIndexFrameDes.Height; 
     this.imageBytePerPixel = (int)this.bodyIndexFrameDes.BytesPerPixel;
     this.kinectImage = new Mat(this.imageHeight, this.imageWidth, MatType.CV_8UC1);
     this.kinect.Open();
 }
Esempio n. 18
0
 public KinectDevice()
 {
     //kinect設定
     this.kinect = KinectSensor.GetDefault();
     //設定とハンドラ
     //colorImage
     #region
     this.colorImageFormat               = ColorImageFormat.Bgra;
     this.colorFrameDescription          = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat);
     this.colorFrameReader               = this.kinect.ColorFrameSource.OpenReader();
     this.colorFrameReader.FrameArrived += ColorFrame_Arrived;
     this.colors = new byte[this.colorFrameDescription.Width
                            * this.colorFrameDescription.Height
                            * this.colorFrameDescription.BytesPerPixel];
     #endregion
     //骨格情報
     #region
     this.bodyFrameReader = this.kinect.BodyFrameSource.OpenReader();
     this.bodyFrameReader.FrameArrived += BodyFrame_Arrived;
     #endregion
     //震度情報
     #region
     this.depthFrameReader = this.kinect.DepthFrameSource.OpenReader();
     this.depthFrameReader.FrameArrived += DepthFrame_Arrived;
     this.depthFrameDescription          = this.kinect.DepthFrameSource.FrameDescription;
     this.depthBuffer = new ushort[this.depthFrameDescription.LengthInPixels];
     #endregion
     //BodyIndex
     #region
     this.bodyIndexFrameDes    = this.kinect.BodyIndexFrameSource.FrameDescription;
     this.bodyIndexFrameReader = this.kinect.BodyIndexFrameSource.OpenReader();
     this.bodyIndexFrameReader.FrameArrived += this.BodyIndexFrame_Arrived;
     this.bodyIndexBuffer = new byte[this.bodyIndexFrameDes.Width *
                                     this.bodyIndexFrameDes.Height * this.bodyIndexFrameDes.BytesPerPixel];
     #endregion
     //kinect開始
     this.package           = new ShadowPackage();
     this.imageWidth        = this.bodyIndexFrameDes.Width;
     this.imageHeight       = this.bodyIndexFrameDes.Height;
     this.imageBytePerPixel = (int)this.bodyIndexFrameDes.BytesPerPixel;
     this.kinectImage       = new Mat(this.imageHeight, this.imageWidth, MatType.CV_8UC1);
     this.kinect.Open();
 }
Esempio n. 19
0
 public ShadowPackage GetCalibedFloorImage()
 {
     ShadowPackage floorPackage = new ShadowPackage();
     floorPackage.srcMat = this.floorDstImg;
     return floorPackage;
 }
Esempio n. 20
0
 //キャリブレーション後の画像を返す
 public ShadowPackage GetCalibedBackImage()
 {
     ShadowPackage backPackage = new ShadowPackage();
     backPackage.srcMat = this.backDstImg;
     return backPackage;
 }
Esempio n. 21
0
        void ProcessImage(object orgs)
        {
            try
            {
                if(this.inputPackage.srcMat != null)
                {
                    //画像の加工
                    this.processedPackage = this.inputPackage;
                    //this.shadows.ElementAt(this.shadowIndex).SetOriginalImage(this.inputPackage);
                    //this.shadows.ElementAt(this.shadowIndex).Processing();
                }

            }
            catch { }
        }
Esempio n. 22
0
        //画像の表示とキャリブレーション
        void CastingImage(object org)
        {
            try
            {
                // 画像の取得
                if(this.kinectDevice.GetImage().srcMat != null)
                {

                    this.inputPackage = this.kinectDevice.GetImage();
                    try
                    {
                        if (this.recKinect.GetImage().srcMat != null)
                        {
                            //Console.WriteLine("LLL");
                            if(this.recKinect.GetImage().srcMat.Size() == this.kinectDevice.GetImage().srcMat.Size())
                                this.inputPackage.srcMat = this._sumMat(this.recKinect.GetImage().srcMat, this.kinectDevice.GetImage().srcMat,false);
                          
                            
                        }
                    }
                    catch { }

                    this._showInputImage(this.inputPackage.srcMat);



                }

                //Console.WriteLine("img");
            }
            catch { }
            
        }