Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
opencvpython:cv2.VideoCapture(0).抓取和cv2.VideoCapture(0).读取挂起_Python_Opencv_Ubuntu - Fatal编程技术网

opencvpython:cv2.VideoCapture(0).抓取和cv2.VideoCapture(0).读取挂起

opencvpython:cv2.VideoCapture(0).抓取和cv2.VideoCapture(0).读取挂起,python,opencv,ubuntu,Python,Opencv,Ubuntu,我的操作系统是Ubuntu 14.04 LTS 我正在使用Python 2.7和OpenCV 3.0测试版,我的网络摄像头是Logitech网络摄像头pro 9000 Cheese应用程序运行正常,表明网络摄像头驱动程序没有问题 在调用cv2.VideoCapture0.read或grab时,我在大约10秒后收到错误“select timeout” 我在谷歌上搜索了大量信息,找到了以下解决方案: sudo rmmod uvcvideo sudo modprobe uvcvideo nodrop=

我的操作系统是Ubuntu 14.04 LTS

我正在使用Python 2.7和OpenCV 3.0测试版,我的网络摄像头是Logitech网络摄像头pro 9000

Cheese应用程序运行正常,表明网络摄像头驱动程序没有问题

在调用cv2.VideoCapture0.read或grab时,我在大约10秒后收到错误“select timeout”

我在谷歌上搜索了大量信息,找到了以下解决方案:

sudo rmmod uvcvideo

sudo modprobe uvcvideo nodrop=1超时=5000怪圈=0x80

现在API cv2.VideoCapture0.read或grab挂起

尝试使用cv而不是cv2


尝试使用2.4.0和2.4.10,但仍然看到相同的行为。这不是每次编写此语句时都会调用VideoCapture的构造函数吗?编写cap=cv2.VideoCapture0和cap.read可能不仅仅是为了方便,现在它挂在frame=cv.QueryFramecapture上
import numpy
import cv2.cv as cv
import cv2
capture = cv.CreateCameraCapture(-1)
while True:

    frame = cv.QueryFrame(capture)
    aframe = numpy.asarray(frame[:,:])
    cv2.imshow("w1", aframe)
    c = cv.WaitKey(5)
    if c == 110: #to quit, the 'n' key is pressed
        exit()