使用 OpenCV python 捕获 rtsp 相机 [英] capturing rtsp camera using OpenCV python

查看:64
本文介绍了使用 OpenCV python 捕获 rtsp 相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过 rtsp 协议传输的远程摄像头,我正在尝试使用带有以下代码的 python 在 OpenCV 2.13.1 中访问它.

I have a remote camera streaming through rtsp protocol and am trying to access it in OpenCV 2.13.1 using python with following code.

camera = cv2.VideoCapture("rtsp://admin:<port>@<ip>/xyz/video.smp")

但是,当我这样做时,我收到以下警告

However, when I do that I get the following warning

WARNING: Couldn't read movie file rtsp://admin:<port>@<ip>/xyz/video.smp

我也试过这样做:

camera = cv2.VideoCapture.open("rtsp://admin:<port>@<ip>/xyz/video.smp")

但是当我这样做时,我收到此错误:

but when I do this I get this error:

`AttributeError: 'builtin_function_or_method' object has no attribute` 'open'

我确实对这个问题进行了大量搜索,但没有找到适合我的想法.任何帮助将不胜感激.

I did searched quite a bit about this problem but couldn't get the idea that works for me. Any help would be appreciated.

推荐答案

Credit from RTSP 流和OpenCV(Python):

Credit from RTSP stream and OpenCV (Python):

vcap = cv.VideoCapture("rtsp://192.168.1.2:8080/out.h264")
while(1):
    ret, frame = vcap.read()
    cv.imshow('VIDEO', frame)
    cv.waitKey(1)

这篇关于使用 OpenCV python 捕获 rtsp 相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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