网络摄像头捕捉
问题描述:
答
您的代码看起来有问题,请查看EMGU提供的Cameracapture示例我现在不在这里获取CaptureType.ANY从但你的代码应该是
Capture capture = new Capture();
viewer.Image = capture.QueryFrame();
虽然链接是否有效是陈旧过时的(2009年)。
下面是来自例子稍微编辑的代码,你将需要:如果你有
private Capture _capture;
public YOUR_PROJECT()
{
InitializeComponent();
try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
if (_capture != null)
{
Application.Idle += ProcessFrame;
}
}
private void ProcessFrame(object sender, EventArgs arg)
{
Image<Bgr, Byte> frame = _capture.QueryFrame();
Picturebox1.Image = frame.ToBitmap(); //Display image in standard Picture Box
}
你只需要一个变量添加到捕捉捕捉=新的捕捉()方法调用多个摄像头,或者如果从视频文件中
//For example if I had two video Cameras
Capture capture = new Capture(0); //CAM1
Capture capture = new Capture(1); //CAM2
//For a Video File
Capture capture = new Capture(@"C:/..../Myvideofile.avi");
我希望这可以帮助你,如果不与USB摄像头尽量保证它不与EMGU(OpenCV的)冲突不是AB的阅读le访问设备。
干杯,
克里斯
答
试试这个:
_capture = new Capture(Emgu.CV.CvEnum.CaptureType.DSHOW);
这对我的伟大工程。
你是什么意思“它死了”?是否存在抛出的运行时错误?如果是这样,错误是什么? – 2011-11-22 03:23:22