ret,frame = video_capture.readValueError:太多值无法解包预期2

问题描述

我想在基于微小脸部检测的项目中使用IP cam代替网络摄像头。

listElement = [ "a",["b","c"],[["d"],["e","f"]] ]

tab = [ [2,1,0],[0] ] # "e" and "a" position

element=""
for i in tab :
    # recuperate the element at the position indicate by i

    element = listElement[i]

解决方法

对于Python

capture= cv2.VideoCapture("rtsp://admin:bilge06@10.374.140.132:554")

if not capture:
    print("Failed")
else:
   ret,frame= capture.read()

它在C ++中 您需要将代码更改为

VideoCapture capture;
Mat ImageMat;
bool op = capture.open("rtsp://admin:bilge06@10.374.140.132:554");
if(op)
{
    capture >> ImageMat;
}

它将从流中读取。要检查流是否正常,可以使用VLC播放器并在网络流中设置IP,它将对其进行验证

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...