我正在尝试使用 emgucv 库 v3.1 访问 vb.net 中的网络摄像头。当我运行该程序时,网络摄像头正在启动,但随后会中断并弹出错误
System.Drawing.dil 中发生类型为“System.Access ViolationException”的未处理异常
附加信息:试图读取或写入受保护的内存。这是
通常表明其他内存已损坏。
这是我正在使用的代码
Dim webcam As New Capture
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Timer1.Stop()
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click webcam.Dispose()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
PictureBox1.Image = webcam.QueryFrame.Bitmap
Catch ex As Exception
webcam - New Capture
End Try
End Sub