Пример #1
0
        private void ReopenCapture()
        {
            if (cap != null)
            {
                cap.Release();
            }

            if (videoFile == null)
            {
                cap = new CVCapture();
            }
            else
            {
                cap = new CVCapture(videoFile);
            }
        }
Пример #2
0
        private void openVideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Title = "Select Video File";
            if (openFile.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            CVCapture cap = new CVCapture(openFile.FileName);

            image = cap.QueryFrame();
            cap.Dispose();

            UpdateHistogram();
        }
Пример #3
0
        /// <summary>
        /// Opens a video file.
        /// </summary>
        /// <param name="path"></param>
        public void Open(string path)
        {
            CVCapture newCapture = new CVCapture(path);

            if (Opening != null)
            {
                OpeningEventArgs oea = new OpeningEventArgs();
                oea.CurrentCapture = capture;
                oea.NewCapture     = newCapture;
                oea.Cancel         = false;
                Opening(this, oea);

                if (oea.Cancel)
                {
                    newCapture.Dispose();
                    return;
                }
            }

            videoTimer.Enabled  = false;
            capture             = newCapture;
            videoTimer.Interval = 1000 / capture.FramesPerSecond;
        }
Пример #4
0
 private static void TestCVCapture()
 {
     CVCapture cap = new CVCapture();
 }