【发布时间】:2020-09-21 13:26:51
【问题描述】:
外部摄像头正在http://localhost:3000/index.html 上输出视频流。
我想将此流提供给我,用于 opencv 人脸检测和其他算法。
到目前为止我所尝试的:
import cv2
import warnings
warnings.filterwarnings('ignore')
cap = cv2.VideoCapture("http://localhost:3000/index.html")
while True:
ret, frame = cap.read()
cv2.imshow('video', frame)
k = cv2.waitKey(30) & 0xff
if k == 27: # press 'ESC' to quit
break
这会返回以下错误:
[ERROR:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap.cpp (116) cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://localhost:3000/ in function 'cv::icvExtractPattern'
Traceback (most recent call last):
File "C:/Users/void_/PycharmProjects/AIML/Computer Vision/app3.py", line 18, in <module>
cv2.imshow('video', frame)
cv2.error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
我已经在我的系统上安装了 FFMpeg。如何继续使用来自本地服务器的视频流 - http://localhost:3000/index.html ?
下图显示了部分实时提要和正在运行流的终端窗口。
【问题讨论】:
-
它正在尝试读取
index.html文件,就好像它是视频文件或图像序列一样。 -
是的,我明白这一点。我怎样才能从那里访问视频捕获?
标签: python opencv computer-vision video-capture dronekit-python