0

OS

Ubuntu 20.04

OPENCV Version

4.4.0

Language

Python 3.8.5

Code and prob description:

I am trying to learn and play with OPENCV, but I am encountering a weird problem. I can not use web cam with opencv. Web cam is working with Cheese Application. I have tried multiple solutions from this answer, but none work.

I inspected code line by line, and got that error is on cv2.VideoCapture(index)

In [1]: import cv2

In [2]: cv2.VideoCapture(0)
[ WARN:0] global /tmp/pip-req-build-a3np7pha/opencv/modules/videoio/src/cap_v4l.cpp (893) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Out[2]: <VideoCapture 0x7f1773353550>

In [3]: cv2.VideoCapture(-1)
[ WARN:0] global /tmp/pip-req-build-a3np7pha/opencv/modules/videoio/src/cap_v4l.cpp (893) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Out[3]: <VideoCapture 0x7f1773304990>

In [4]: cv2.VideoCapture(1)
[ WARN:0] global /tmp/pip-req-build-a3np7pha/opencv/modules/videoio/src/cap_v4l.cpp (893) open VIDEOIO(V4L2:/dev/video1): can't open camera by index
Out[4]: <VideoCapture 0x7f17733048b0>
Ahmad Anis
  • 2,322
  • 4
  • 25
  • 54

0 Answers0