VIDEOIO ERROR: V4L: can't find camera device

被刻印的时光 ゝ 提交于 2020-01-03 16:54:18

问题


I am using ubuntu16.04 and trying to run opencv script. when i use:

video_capture = cv2.VideoCapture(-1)

it gives me error VIDEOIO ERROR: V4L: can't find camera device No video window opens But when i run

video_capture = cv2.VideoCapture('test.jpg')

It opens window shows the picture and close the window. Please tell me why it is not streaming video directly from camera.


回答1:


The suggestion api55 gave in his comment

video_capture = cv2.VideoCapture(0)

is what I would try first.

Generally, you can list the available cameras with ls /dev/video* or v4l2-ctl --list-devices. Here sample output:

NZXT-U:rt-trx> v4l2-ctl --list-devices
Microsoft® LifeCam Cinema(TM): (usb-0000:00:14.0-1):
    /dev/video1

Microsoft® LifeCam Cinema(TM): (usb-0000:00:1a.0-1.3):
    /dev/video0

/dev/video0 corresponds to device id 0, etc.

PS: v4l2-ctl is quite useful for solving camera issues and can do much more than --list-devices. I installed it via packagev4l-utils on a 16.04 machine.



来源:https://stackoverflow.com/questions/53007924/videoio-error-v4l-cant-find-camera-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!