使用Emgu CV的Capture = New Capture()连接到IP摄像机 [英] Connect to IP Camera Using Emgu CV's Capture = New Capture()

查看:601
本文介绍了使用Emgu CV的Capture = New Capture()连接到IP摄像机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Basic 2008和Emgu CV,可以在PC上捕获网络摄像头的流。 我要做的是使用Capture = New Capture()连接到IP摄像机,知道其URL。

Using Visual Basic 2008 and Emgu CV, I can capture the stream of a webcam on my PC. What I want to do is connect to an IP camera, knowing its URL, using Capture = New Capture().

这里是代码我有:

Imports Emgu.CV
Imports Emgu.CV.Util
Imports Emgu.CV.Structure

Public Class Form1

Dim capturez As Capture = New Capture("rtsp://[IP Address]/mpeg4/media.amp")

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    Dim imagez As Image(Of Bgr, Byte) = capturez.QueryFrame()
    PictureBox1.Image = imagez.ToBitmap()

End Sub

End Class

我收到以下错误:无法从rtsp:// [IP地址] /mpeg4/media.amp

是否可以使用Capture = New Capture来做到这一点?如果不是,还有其他方法吗?

Is it possible to do this using Capture = New Capture? If not, is their any other method?

谢谢。

推荐答案

这是我最后使用的解决方案。它仅适用于JPEG网络摄像头(不适用于MJPEG),不需要EmguCV

This is the solution I used in the end. It only works with JPEG webcams (not MJPEG) and does not require EmguCV

'Connect To Webcam ----------------------------------------------------------------------
    Dim NumberFrames As Integer = 1
    Dim imgNum = Convert.ToString(FrameNumber)
    Dim sourceURL As String = ("http://91.142.238.200/record/current.jpg?rand=" + imgNum)
    'create HTTP request
    Dim req As HttpWebRequest = HttpWebRequest.Create(sourceURL)
    'get response
    Dim res As HttpWebResponse = req.GetResponse
    'get response stream
    Dim reader As New StreamReader(res.GetResponseStream())
    'read data from stream
    Dim img As Image = Image.FromStream(res.GetResponseStream())
    'get bitmap
    PictureBox1.Image = img
    'Increment frame
    FrameNumber = FrameNumber + 1
    '-----------------------------------------------------------------------------------------

这篇关于使用Emgu CV的Capture = New Capture()连接到IP摄像机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆