如何使用网络摄像头捕获图像?

时间:2012-12-17 06:05:53

标签: c#

我想用网络摄像头捕捉图像。

我使用WebCam_Capture.dll。我在表单中添加WebCamCapture控件。

表单加载时:

private void Form1_Load(object sender, EventArgs e)
{
    this.WebCamCapture.TimeToCapture_milliseconds = 1;
    WebCamCapture.Start(0);
}

并在ImageCaptured事件中:

private void WebCamCapture_ImageCaptured(object source, 
                                         WebCam_Capture.WebcamEventArgs e)
{
    this.pictureBox1.Image = e.WebCamImage;
}

但是当我跑步时,我得到错误:

  

捕获视频图像时出现错误。视频捕获现在将被终止。

     

对象引用未设置为对象的实例。

1 个答案:

答案 0 :(得分:0)

我建议您使用OpenCV Library。 它是一个开源库,用于从intel开发的intel处理图像。 但是,它有.net的包装,你可以从this link

下载这个包装器