private void ReopenCapture() { if (cap != null) { cap.Release(); } if (videoFile == null) { cap = new CVCapture(); } else { cap = new CVCapture(videoFile); } }
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(); }
/// <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; }
private static void TestCVCapture() { CVCapture cap = new CVCapture(); }