警告:0 全局 /home//opencv-4.1.1/modules/videoio/src/cap.cpp

Posted

技术标签:

【中文标题】警告:0 全局 /home//opencv-4.1.1/modules/videoio/src/cap.cpp【英文标题】:WARN:0 global /home//opencv-4.1.1/modules/videoio/src/cap.cpp 【发布时间】:2019-08-31 15:06:12 【问题描述】:

系统:

OpenCV =4.1.1

Ubuntu =16.04

python =2.7.12

我的代码:

#!/usr/bin/env python
import numpy as np
import cv2

cap = cv2.VideoCapture(0)
#print(cv2.getBuildInformation())
print('cap.isOpened')
if cap.isOpened():
    print ('cap is opened')
    while(True):
        re,img=cap.read()
        cv2.imshow("video output", img)
        k = cv2.waitKey(1)& 0xFF
        if k==27:
            break
cap.release()
cv2.destroyAllWindows()

工作正常,但收到此警告:

[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap.cpp (163) open VIDEOIO(GSTREAMER): trying capture cameraNum=0 ...
libv4l2: error got 4 consecutive frame decode errors, last error: v4l-convert: libjpeg error: End Of Image
[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate a buffer
[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap.cpp (183) open VIDEOIO(GSTREAMER): can't create capture
[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap.cpp (163) open VIDEOIO(V4L2): trying capture cameraNum=0 ...
[ WARN:0] global /home/redhwan/opencv-4.1.1/modules/videoio/src/cap.cpp (175) open VIDEOIO(V4L2): created, isOpened=1

当我安装 OpenCV 时,我关注了这个https://www.pyimagesearch.com/2016/07/11/compiling-opencv-with-cuda-support/

请帮助我或任何建议

提前谢谢你

【问题讨论】:

【参考方案1】:

为我修复,我更改了版本并安装了 OpenCV=3.3.1

【讨论】:

以上是关于警告:0 全局 /home//opencv-4.1.1/modules/videoio/src/cap.cpp的主要内容,如果未能解决你的问题,请参考以下文章

“语法警告:名称 'our_mongo' 在全局声明之前使用”

通过(全局)shell脚本启动节点时如何禁用警告

使用全局变量作为数据源的 PHP 会话副作用警告

使用全局axios拦截器时如何防止出现多次401错误警告

为啥当我在函数中声明一个名称为全局数组的局部数组时,bash 会引发未绑定变量警告?

解决推力/CUDA 警告“无法分辨指针指向的...”