Ejemplo n.º 1
0
 protected virtual void OnImageFrameArrived(ImageFrameArrivedEventArgs e)
 {
     if (ImageFrameArrived != null)
     {
         ImageFrameArrived(this, e);
     }
 }
Ejemplo n.º 2
0
        private void Panel_ImageFrameArrived(object Sender, ImageFrameArrivedEventArgs e)
        {
            vw.Write(e.Image[this.saveImageIndex]);

        }
Ejemplo n.º 3
0
        /// <summary>
        /// 画像の更新処理
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        private void M_srcPanel_ImageFrameArrived(object Sender, ImageFrameArrivedEventArgs e)
        {

            var image = e.Image[this.m_imageIndex];
            if (Sender != this)
            {
                if (this.m_LastReceivedImage != null)
                {
                    this.m_LastReceivedImage.Dispose();
                }
                this.m_LastReceivedImage = image.Clone();

                if (!this.IsInitWrap)
                {
                    this.IsInitWrap = true;
                    this.GetInitWrap(image);
                    this.m_srcPanel.SetGridSize(this.m_imageIndex, image.Width, image.Height);
                }
                this.m_dstPanel.InitImage(this, image);

                var _image = image.WarpPerspective(this.WarpMatrix, this.m_dstPanel.m_ProjectionImageMatrix.Size());


                if (this.m_AdditionMode == AdditionMode.Add)
                {
                    var __image = _image.Clone();
                    __image.SetTo(new Scalar(0, 0, 0));
                    _image.CopyTo(__image, m_Mask);
                    this.m_dstPanel.m_ProjectionImageMatrix += __image;
                    __image.Dispose();

                }
                else
                {
                    _image.CopyTo(this.m_dstPanel.m_ProjectionImageMatrix, m_Mask);
                }
                this.m_dstPanel.UpdateImage(this);
                _image.Dispose();
            }
            //thumb操作時
            else
            {
                this.m_dstPanel.InitImageByThumb(image);
                var _image = image.WarpPerspective(this.WarpMatrix, this.m_dstPanel.m_ProjectionImageMatrix.Size());

                if (this.m_AdditionMode == AdditionMode.Add)
                {
                    var __image = _image.Clone();
                    __image.SetTo(new Scalar(0, 0, 0));
                    _image.CopyTo(__image, m_Mask);//残す
                    this.m_dstPanel.m_ProjectionImageMatrix += __image;
                    __image.Dispose();
                }
                else
                {
                    _image.CopyTo(this.m_dstPanel.m_ProjectionImageMatrix, m_Mask);//残す
                }
                this.m_dstPanel.UpdateImageByThumb();
                _image.Dispose();
            }
        }
Ejemplo n.º 4
0
        private void updateImage()
        {

            var p = this.Dispatcher.BeginInvoke(new Action(() =>
            {
                try
                {
                    //デコード
                    this.jpegDec = new JpegBitmapDecoder(this.m_receivedMemory, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None);
                    this.bitmapsorce = this.jpegDec.Frames[0];

                    //初期化
                    if (m_WritableBitmap == null)
                    {
                        this.m_WritableBitmap = new WriteableBitmap(this.bitmapsorce);
                        this.m_data = new byte[this.bitmapsorce.PixelWidth * this.bitmapsorce.PixelHeight * this.bitmapsorce.Format.BitsPerPixel / 8];
                        this.Image_Main.Source = this.m_WritableBitmap;


                    }

                    //イベント発生・送信
                    this.bitmapsorce.CopyPixels(this.m_data, this.bitmapsorce.PixelWidth * this.bitmapsorce.Format.BitsPerPixel / 8, 0);
                    this.m_mat = new Mat(this.bitmapsorce.PixelHeight, this.bitmapsorce.PixelWidth, MatType.CV_8UC3, this.m_data);
                    var e = new ImageFrameArrivedEventArgs(new Mat[] { this.m_mat });
                    OnImageFrameArrived(e);

                    //画像の更新
                    this.m_WritableBitmap.WritePixels(new Int32Rect(0, 0, this.m_WritableBitmap.PixelWidth, this.m_WritableBitmap.PixelHeight), this.m_data, this.bitmapsorce.PixelWidth * this.bitmapsorce.Format.BitsPerPixel / 8, 0);

                    //最終処理
                    this.bitmapsorce = null;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }));

            p.Wait();
        }