进口AForge.Video
进口AForge.Video.VFW
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim Stream As AForge.Video.MJPEGStream = New AForge.Video.MJPEGStream("http://192.168.1.250/mjpeg.cgi")
Stream.Login = ("admin")
Stream.Password = ("admin")
Stream.Start()
Dim st As String = ""
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.OkOnly, "Error")
Exit Sub
End Try
End Sub
结束班
这就是我到目前为止所做的...来开始流... 知道我想知道。 如何在图片框中显示此流?以及如何从这个流中获取图像。
答案 0 :(得分:0)
MJEGStream包含事件。在类级别将您的Stream
对象声明为
Private WithEvents Stream As AForge.Video.MJPEGStream
然后使用类似
的子句向MJPEGStream.NewFrame
事件添加事件处理程序
Private Sub Handle_NewFrame(sender as Object, e as AForge.Video.NewFrameEventArgs)
Picturebox1.Image = e.Frame
End Sub
像在代码中一样启动流。
别忘了初始化Source对象。
Source = New AForge.Video.MJPEGStream("http://192.168.1.250/mjpeg.cgi")
eventargs变量包含新帧作为图像,然后您可以在图片框中显示。 我和AForge合作已经有一段时间了,但它应该没问题。