Hi all,
I am new to C# and currently writing a program which attempts to capture video from two webcams at exactly the same time. I am using the EmguCv framework which is a wrapper class of the OpenCv framework used in C++. I have the program completed, with the stream from the left and right webcams displayed in their respective image box within the Windows form. Each frame is extracted and stored in a folder corresponding to the webcam which captured it. The capture is set to begin once the start button, added to the window, is pressed with the same button allowing the user to pause and resume the capture.
I am having a problem with the final, and most crucial, element of the program which is that when the program starts the cameras do capture images at the same time. I would welcome any advice available to aid me in this final step.
Below is the code behind my "Start" button which begins the capture.
Thanks in advance
LJ
private void btnStart_Click(object sender, EventArgs e)
{
#region if webcam1 is not created, create it now
if (webcam1 == null && webcam2 == null)
{
try
{
webcam1 = new Capture(0);
webcam2 = new Capture(1);
}
catch (NullReferenceException excep)
{
MessageBox.Show(excep.Message);
FrameNo = 0;
}
}
#endregion
if (webcam1 != null & webcam2 != null)
{
if (captureInProgress)
{
btnStart.Text = "Start";
Application.Idle -= ProcessFrame;
}
else
{
btnStart.Text = "Stop";
Application.Idle += ProcessFrame;
}
captureInProgress = !captureInProgress;
}
}