[email protected] global D: a opencv python o...">

当前位置:网站首页>yolov5调用ip摄像头时出现的问题

yolov5调用ip摄像头时出现的问题

2022-08-02 03:21:00 woshicaiji12138

今天尝试使用yolov5-5.0做实时目标检测,但是当输入指令:

python detect.py --source http://192.168.xx.xx:xx/video --weights yolov5s.pt

(xx表示我自己的ip)
总会出现以下问题:
[ERROR:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap.cpp (166) cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV
exception:

OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can’t find starting numb
er (in the name of file): http://192.168.3.100:8001/video in function ‘cv::icvExtractPattern’

Traceback (most recent call last):
File “detect.py”, line 178, in
detect()
File “detect.py”, line 51, in detect
dataset = LoadStreams(source, img_size=imgsz, stride=stride)
File “D:\yolov5\yolov5-5.0\yolov5-5.0\utils\datasets.py”, line 284, in init
assert cap.isOpened(), f’Failed to open {s}’
AssertionError: Failed to open http://192.168.3.100:8081/video
在这里插入图片描述
在网上查阅了诸多资料也没能解决,直到在一篇博客中看到别人的指令是这样的

python detect.py --source http://admin:[email protected].x.x.x:x

突然想起来自己在pycharm的terminal直接点击ip摄像头的连接地址时会出现这样的弹窗:
在这里插入图片描述
在这里插入图片描述
这才发现自己的错误多么低级:没有ip摄像头的输入账号和密码。
于是在terminal重新输入:

python detect.py --source http://admin:[email protected]192.168.x.x:x --weights yolov5s.pt

在这里插入图片描述
成功!
在这里插入图片描述

原网站

版权声明
本文为[woshicaiji12138]所创,转载请带上原文链接,感谢
https://blog.csdn.net/woshicaiji12138/article/details/126053012