I've been trying to use OpenCV to control my webcam (Logitech c910) through python. I 've managed to capture images through .read() but they are 640 x 480 and I haven't managed to set the resolution to the max which is 2592 x 1944.

I used to have opencv 2.4.8 but now I have 3.0.0-dev

Here is the code I try and the outputs:

In [1]: import cv2
In [2]: cap = cv2.VideoCapture(1)
In [3]: cap.open(1)
HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Out[3]: True
In [4]: r,f = cap.read()
VIDIOC_STREAMON: Bad file descriptor
In [5]: r
Out[5]: False

I installed 3.0.0-dev following the instructions from this other question I posted. How to install opencv 2.9 for python?

The reason I went with the dev version is because in this post someone said that resolved their problem. http://answers.opencv.org/question/2061/how-to-set-resolution-of-video-capture-in-python/

  • Have you tried building OpenCV from source with -D WITH_V4L=ON and -D WITH_LIBV4L=ON? – zardosht Jul 14 '19 at 12:34

Since you're building opencv from sources, try to follow the build process used by the debian packaging to ensure the compatibility with linux. I'm thinking about the V4L2 support for example:

  • thanks for your answer, but how do I use the link you provided? or the flag? Sorry for the ignorance – evan54 Apr 15 '14 at 16:36
  • 1
    Having the same issue and I am curious on how to debug this as well. I am a newbie with building on ubuntu so it would be appreciated. – Goddard Jun 29 '14 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.