Exemple #1
0
        private void frame_Click(object sender, EventArgs e)
        {
            int vS;

            int.TryParse(videoSource.Text, out vS);

            int width;
            int height;

            int.TryParse(widthText.Text, out width);
            int.TryParse(heightText.Text, out height);

            try {
                cfs = new CaptureFrameSource(new VideoCapture(vS));
                Mat nextFrame = cfs.NextFrame();
                source              = nextFrame.ToImage <Bgr, byte>().Resize(width, height, Inter.Nearest);
                original            = source.Copy();
                imageOriginal.Image = source.Bitmap;
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
            }
        }
Exemple #2
0
        private void updateFrames(object source, ElapsedEventArgs e)
        {
            MethodInvoker mi = delegate() {
                int vS;
                int.TryParse(videoSource.Text, out vS);

                int width;
                int height;
                int.TryParse(widthText.Text, out width);
                int.TryParse(heightText.Text, out height);

                try {
                    cfs = new CaptureFrameSource(new VideoCapture(vS));
                    Mat nextFrame          = cfs.NextFrame();
                    Image <Bgr, byte> temp = nextFrame.ToImage <Bgr, byte>().Resize(width, height, Inter.Nearest);
                    imageOriginal.Image = temp.Bitmap;
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                }
            };

            this.Invoke(mi);
        }