Ejemplo n.º 1
0
        public static List <Mat> LoadVideo()
        {
            Emgu.CV.VideoCapture videoCapture;
            List <Mat>           framesFromVideo = new List <Mat>();

            FileOp.LoadFromFile((s, path) =>
            {
                videoCapture = new Emgu.CV.VideoCapture(path);
                while (true)
                {
                    Mat mat = new Mat();
                    videoCapture.Read(mat);
                    if (mat == null || mat.Rows == 0)
                    {
                        return;
                    }

                    framesFromVideo.Add(mat);

                    for (int p = 0; p < 4; p++)
                    {
                        videoCapture.Read(mat);
                    }
                }
            });
            return(framesFromVideo);
        }
Ejemplo n.º 2
0
        public void CallBack()
        {
            while (_enable)
            {
                _enable = _camera.Read(_frameImage);

                if (_setImage != null)
                {
                    try
                    {
                        _setImage.DynamicInvoke(_frameImage.ToBitmap());
                    }
                    catch { }
                }
                else
                {
                    if (!_imageBox.InvokeRequired)
                    {
                        _imageBox.Image = _frameImage.ToBitmap();
                    }
                    else
                    {
                        _imageBox.Invoke(_refreshMethodInvoker);
                    }
                }
                Thread.Sleep(Interval);
            }
        }