private void Options_Load(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Select Input Video File (Cancel for Camera)"; if (ofd.ShowDialog() != DialogResult.OK) { videoFile = null; } else { videoFile = ofd.FileName; } ReopenCapture(); SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Select Output Video File (Cancel for no output)"; if (sfd.ShowDialog() == DialogResult.OK) { this.vw = new CVVideoWriter(sfd.FileName, cap.Width, cap.Height); } this.avg = new MovingAverage(cap.Width, cap.Height, Alpha); this.worker = new Thread(new ThreadStart(Work)); this.worker.Start(); }
/// <summary> /// Called when the button is clicked to open the video/image. /// </summary> private void button1_Click(object sender, EventArgs e) { // show file dialog, and continue only if OK was chosen. OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() != DialogResult.OK) return; // open and play the file (errors are not handled nicely here). videoPlayer1.Open(dialog.FileName); // open the video writer (close previously opened writer). if (writer != null) writer.Release(); writer = videoPlayer1.CreateVideoWriter("c:\\myoutput.avi"); // start the video. videoPlayer1.Play(); }
/// <summary> /// Called when the button is clicked to open the video/image. /// </summary> private void button1_Click(object sender, EventArgs e) { // show file dialog, and continue only if OK was chosen. OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() != DialogResult.OK) { return; } // open and play the file (errors are not handled nicely here). videoPlayer1.Open(dialog.FileName); // open the video writer (close previously opened writer). if (writer != null) { writer.Release(); } writer = videoPlayer1.CreateVideoWriter("c:\\myoutput.avi"); // start the video. videoPlayer1.Play(); }