コード例 #1
0
        private void _timerReceive_Tick(object sender, EventArgs e)
        {
            lblDeltaR.Content = DateTime.Now.Subtract(dtG).Milliseconds.ToString() + " ms";
            dtG = DateTime.Now;

            //    _timerReceive.Stop();

            if (flagReady & _countRImage == 0)
            {
                TransformMethods.MyArc objA = new MyArc();
                sbyte[,] Z = new sbyte[1024, 256];
                Z          = objA.unArcWithTable(outByte);

                TransformMethods.TransferTo objT = new TransferTo();

                imgRecieveHaar = new WriteableBitmap(objT.convertSByte256ToGrayImg(Z));

                rRecieveHaar.Fill = new ImageBrush()
                {
                    ImageSource = imgRecieveHaar
                };

                TransformMethods.WaveLetHaar  objH = new WaveLetHaar();
                TransformMethods.WaveLetCDF97 objD = new WaveLetCDF97();

                if (rbH.IsChecked == true)
                {
                    objH.Haar2DInverse(ref Z, vHaar, hHaar);
                }
                else
                {
                    objD.CDF2DInverse(ref Z, vHaar, hHaar);
                }

                imgReceive1024x256 = new WriteableBitmap(objT.convertSByte256ToGrayImgReceive(Z));

                rRecieveCombine.Fill = new ImageBrush()
                {
                    ImageSource = imgReceive1024x256
                };

                _imagesReceive = objT.convertGray1024x256ToGrayImgCollection(imgReceive1024x256);

                flagReady = false;
            }

            rReceive.Fill = new ImageBrush()
            {
                ImageSource = _imagesReceive[_countRImage]
            };

            _countRImage += 1;

            if (_countRImage == _intPackImage)
            {
                _countRImage = 0;
            }

            //     _timerReceive.Start();
        }
コード例 #2
0
        private void _timerSend_Tick(object sender, EventArgs e)
        {
            if (_images.Count == 1)
            {
                //    _timerSend.Stop();

                TransformMethods.TransferTo objT = new TransferTo();

                _imagesSend.Add(objT.convertImgAnySizeTo256x256(_images[0]));

                rSend.Fill = new ImageBrush()
                {
                    ImageSource = _imagesSend[_countImage]
                };

                switch (_countImage)
                {
                case 0:
                    rS0.Fill = new ImageBrush()
                    {
                        ImageSource = _imagesSend[_countImage]
                    };
                    break;

                case 1:
                    rS1.Fill = new ImageBrush()
                    {
                        ImageSource = _imagesSend[_countImage]
                    };
                    break;

                case 2:
                    rS2.Fill = new ImageBrush()
                    {
                        ImageSource = _imagesSend[_countImage]
                    };

                    break;

                case 3:
                    rS3.Fill = new ImageBrush()
                    {
                        ImageSource = _imagesSend[_countImage]
                    };

                    break;

                default:;
                    break;
                }
                _countImage += 1;
                _images.Clear();
            }

            TransformMethods.WaveLetHaar  objH = new WaveLetHaar();
            TransformMethods.WaveLetCDF97 objD = new WaveLetCDF97();

            //START NEW CICKLE----------------------------------------------------------------------------------------------------------------------

            if (_countImage == _intPackImage)
            {
                DateTime dt0 = DateTime.Now;

                TransformMethods.TransferTo objT = new TransferTo();
                imgOut1024x256 = objT.convertGrayImgToGray1024x256(_imagesSend);

                rSendCombine.Fill = new ImageBrush()
                {
                    ImageSource = imgOut1024x256
                };
                //========================================================================
                sbyte[,] sbHaar;
                sbHaar = objT.convertGrayImgToSByte256(imgOut1024x256);

                if (rbH.IsChecked == true)
                {
                    objH.Haar2DByteForward(ref sbHaar, bLoss, vHaar, hHaar);
                }
                else
                {
                    objD.CDF2DForward(ref sbHaar, bLoss, vHaar, hHaar);
                }

                rSendHaar.Fill = new ImageBrush()
                {
                    ImageSource = objT.convertSByte256ToGrayImg(sbHaar)
                };

                TransformMethods.MyArc objA  = new MyArc();
                List <byte>            outBt = objA.archiveWithTable(sbHaar);

                lblSize.Content = outBt.Count.ToString() + " bytes ... (" + (256 * 256 * 4).ToString() + ")";

                outByte = new List <byte>(outBt);

                flagReady = true;

                DateTime dt1 = DateTime.Now;
                lblDelta.Content = dt1.Subtract(dt0).Milliseconds.ToString() + " ms";

                _countImage = 0;
                _imagesSend.Clear();
            }

            if (_captureSource.State == System.Windows.Media.CaptureState.Started)
            {
                _captureSource.CaptureImageAsync();    // Start Image Async...

                //    _timerSend.Start();                     // Start Timer
            }

            //START NEW CICKLE----------------------------------------------------------------------------------------------------------------------
        }