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

WARN:0 global /home//opencv-4.1.1/modules/videoio/src/cap.cpp

系统:

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/

请帮助我或任何建议

提前致谢

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