How to set resolution of video capture in python with Logitech c910 & c920
I have two webcams, Logitech c910 and c920. When I use the python interface to opencv2.4.1 on Ubuntu 12.04, I cannot seem to change the width or height of the capture from either camera. For example, if I run the code:
import cv2
cam = cv2.VideoCapture(-1)
cam.read()
I get a 640x480 image/numpy array. However, if I try to run:
import cv2
cam = cv2.VideoCapture(-1)
cam.set(3,1920)
cam.set(4,1080)
cam.read()
I first get the printout False
after each attempt to set the resolution, and then the console hangs when it gets to cam.read()
.
On the other hand, when I run the above on my mac, everything works fine and I get the expected 1920x1080 image/numpy array.
Getting this working with Ubuntu is really mission critical for me, so any help would be greatly appreciated!