Beispiel #1
0
        protected override void Kinect_NewVideoFrame(VideoImage videoImage)
        {
            base.Kinect_NewVideoFrame(videoImage);

            if (NewCompressedKinectVideoFrame != null)
            {
                Compression<ImageFrame> comp = new Compression<ImageFrame>();
                byte[] compressedVal = comp.GzipCompress(videoImage.ImageFrame);
                NewCompressedKinectVideoFrame(compressedVal, videoImage.ImageFrame);
            }
        }
Beispiel #2
0
 protected override void Kinect_NewVideoFrame(VideoImage planerImage)
 {
     base.Kinect_NewVideoFrame(planerImage);
     if (Options.StoreColor)
     {
         this.ColorImages.Enqueue(planerImage.ImageFrame);
         if (this.ColorImages.Count > this.Options.ColorMax)
         {
             ImageFrame dead;
             this.ColorImages.TryDequeue(out dead);
         }
     }
 }
Beispiel #3
0
        public static BitmapSource VideoToBitmapSource(VideoImage Image)
        {
            BitmapSource bmap = BitmapSource.Create(
            Image.ImageFrame.Width,
            Image.ImageFrame.Height,
            96, 96,
            PixelFormats.Bgr32,
            null,
            Image.Data,
            Image.ImageFrame.Width * Image.ImageFrame.BytesPerPixel);

            return bmap;
        }
Beispiel #4
0
        protected override void Kinect_NewVideoFrame(VideoImage planerImage)
        {
            base.Kinect_NewVideoFrame(planerImage);

            //if (this.NewBitmapReady != null)
            //{
            //    lock (BitmapLock)
            //    {
            //        if (this.Bitmap == null)
            //        {
            //            Bitmap bmap = new Bitmap(
            //           planerImage.Image.Width,
            //           planerImage.Image.Height,
            //           PixelFormat.Format32bppRgb);
            //            this.Bitmap = bmap;
            //        }

            //        BitmapData bmapdata = this.Bitmap.LockBits(
            //         new Rectangle(0, 0, planerImage.Image.Width,
            //                             planerImage.Image.Height),
            //                             ImageLockMode.WriteOnly,
            //                             this.m_bitmap.PixelFormat);
            //        IntPtr ptr = bmapdata.Scan0;
            //        Marshal.Copy(planerImage.Image.Bits, 0, ptr, planerImage.Image.Width * planerImage.Image.BytesPerPixel * planerImage.Image.Height);
            //        this.Bitmap.UnlockBits(bmapdata);
            //    }

            //    Task t = new Task(new Action(delegate
            //    {
            //        lock (BitmapLock)
            //        {
            //            NewBitmapReady(this.Bitmap);
            //        }
            //    }));
            //    t.Start();
            //}
        }
Beispiel #5
0
 protected virtual void Kinect_NewVideoFrame(VideoImage videoImage)
 {
 }
Beispiel #6
0
 protected override void Kinect_NewVideoFrame(VideoImage planerImage)
 {
     this.Image = UIHelpers.VideoToBitmapSource(planerImage);
 }
Beispiel #7
0
 private void Kinect_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
 {
     if (this.NewVideoFrame != null)
     {
         using (ColorImageFrame color = e.OpenColorImageFrame())
         {
             if (color != null)
             {
                 VideoImage vid = new VideoImage(color);
                 this.NewVideoFrame(vid);
                 this.VideoFPS.hit();
             }
         }
     }
 }