YOLOv7调用摄像头检测报错解决

yolov7detect.py文件调用本地摄像头,把source参数设为0

    parser.add_argument('--source', type=str, default='0', help='source')  # file/folder, 0 for webcam

报错:cv2.error: OpenCV(3.4.2) 一堆地址:The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

我原本的环境里opencv-python版本是4.1.2.30

参考链接:The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support-CSDN博客

我的解决方法,卸载opencv-python

pip uninstall opencv-python

再重新安装

pip install opencv-python
pip install opencv-contrib-python

YOLOv7调用摄像头检测报错解决_第1张图片

就好使了

YOLOv7调用摄像头检测报错解决_第2张图片

你可能感兴趣的:(YOLO)