Exemplo n.º 1
0
        private void BtnRunClick(object sender, EventArgs e)
        {
            Capture cap = null;

            if (_rdCamera.Checked)
            {
                cap  = new Capture(0);
                _run = true;
            }
            else
            {
                if (_rdVideo.Checked)
                {
                    var filePath = _txtPathFile.Text;
                    if (System.IO.File.Exists(filePath))
                    {
                        cap  = new Capture(@"F:/Videos/MV/Crazier.mp4");
                        _run = true;
                    }
                    else
                    {
                        _run = !_run;
                        MessageBox.Show(
                            "File not Found!",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                }
            }

            //vong lap chay vo han lay anh
            while (_run)
            {
                if (cap != null)
                {
                    _imageTemp = cap.QueryFrame();
                }
                _picScreen.Image = _imageTemp.ToBitmap();
                if (_frmTruNen == null || _frmTruNen.IsDisposed)
                {
                    _frmTruNen = new frmTruNen();
                }

                if (_frmChenhLechTamThoi != null)
                {
                    _frmChenhLechTamThoi.Process(_imageTemp);
                }
                if (_frmTruNen != null)
                {
                    _frmTruNen.Process(_imageTemp);
                }
                if (_frmOpticalFlow != null)
                {
                    _frmOpticalFlow.Process(_imageTemp);
                }
                SendKeys.Flush();
            }
        }
Exemplo n.º 2
0
        private void BtnRunClick(object sender, EventArgs e)
        {
            Capture cap = null;
            if (_rdCamera.Checked)
            {
                cap = new Capture(0);
                _run = true;
            }
            else
            {
                if(_rdVideo.Checked)
                {
                    var filePath = _txtPathFile.Text;
                    if(System.IO.File.Exists(filePath))
                    {
                        cap = new Capture(@"F:/Videos/MV/Crazier.mp4");
                        _run = true;
                    }
                    else
                    {
                        _run = !_run;
                        MessageBox.Show(
                            "File not Found!", 
                            "Error", 
                            MessageBoxButtons.OK, 
                            MessageBoxIcon.Error);
                    }
                }
            }

            //vong lap chay vo han lay anh
            while (_run)
            {
                if (cap != null) _imageTemp = cap.QueryFrame();
                _picScreen.Image = _imageTemp.ToBitmap();
                if (_frmTruNen == null || _frmTruNen.IsDisposed)
                {
                    _frmTruNen = new frmTruNen();
                }

                if(_frmChenhLechTamThoi != null)
                {
                    _frmChenhLechTamThoi.Process(_imageTemp);
                }
                if(_frmTruNen != null)
                {
                    _frmTruNen.Process(_imageTemp);
                }
                if(_frmOpticalFlow != null)
                {
                    _frmOpticalFlow.Process(_imageTemp);
                }
                SendKeys.Flush();
            }
        }
Exemplo n.º 3
0
 private void ChkTruNenCheckedChanged(object sender, EventArgs e)
 {
     if (_chkTruNen.Checked)
     {
         if (_frmTruNen == null)
         {
             _frmTruNen = new frmTruNen();
         }
         _frmTruNen.Show();
     }
     else
     {
         _frmTruNen.Close();
         _frmTruNen = null;
     }
 }
Exemplo n.º 4
0
 private void ChkTruNenCheckedChanged(object sender, EventArgs e)
 {
     if(_chkTruNen.Checked)
     {
         if(_frmTruNen == null)
         {
             _frmTruNen = new frmTruNen();
         }
         _frmTruNen.Show();
     }
     else
     {
         _frmTruNen.Close();
         _frmTruNen = null;
     }
 }