Switching between multiple Cameras using Emgu CV

I have a quick question: I need to switch between the two camera on a tablet. Front and Back. By default, the Front camera is always used by Emgu CV.

Thanks.

-------------Problems Reply------------

Ok. There is a different constructor. I was building upon the 7 line demo for Emgu CV.

Using the correct overloaded constructor, this is what did the trick for me:

private Capture _capture;

private void InitCapture(Int32 _camIndex) {
try {
if (_capture != null) {
Application.Idle -= ProcessFrame;
}

_capture = new Capture(_camIndex);
Application.Idle += ProcessFrame;
}
catch (NullReferenceException excpt) {
XtraMessageBox.Show(excpt.Message);
}
}

private void ProcessFrame(object sender, EventArgs arg) {
Image<Bgr, Byte> frame = _capture.QueryFrame();
ImageBoxCapture.Image = frame;
}

private void CharmsBarBase_ButtonTop01Click(object sender, EventArgs e) {
InitCapture(0);
}

private void CharmsBarBase_ButtonTop02Click(object sender, EventArgs e) {
InitCapture(1);
}

Regards.

Category:winforms Views:0 Time:2011-10-02

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.337 (s). 11 q(s)