I am using openCV via python on linux (ubuntu 12.04) and I have a logitech c920 from which I would like to capture images. Cheese is capable of capturing frames to really high resolution, but whenever I try to use openCV, I only get 640x480 images. I tried:
import cv cam = cv.CaptureFromCAM(-1) cv.SetCaptureProperty(cam,cv.CV_CAP_PROP_FRAME_WIDTH,1920) cv.SetCaptureProperty(cam,cv.CV_CAP_PROP_FRAME_WIDTH,1080)
but this gives the result "0" after each of the last two lines, and when I subsequently capture the frame through:
image = cv.QueryFrame(cam)
The resulting image remains 640x480.
I tried to install what looks like related tools through (outside of python):
sudo apt-get install libv4l-dev v4l-utils qv4l2 v4l2ucp
and I can really manipulate the camera settings (again, outside of python) with:
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=1 v4l2-ctl --set-parm=30
and note that:
v4l2-ctl -V
really assumes something has changed:
Format Video Capture: Width/Height : 1920/1080 Pixel Format : 'H264' Field : None Bytes per Line : 3840 Size Image : 4147200 Colorspace : sRGB
But when I enter the python shell, the above code behaves exactly the same as before (print zeros when trying to set properties and get a 640x480 image).
The ability to raise capture resolution is pretty important to me, so I would really appreciate any pointers anyone can provide.
python linux opencv webcam v4l2
Mike Lawrence Jul 17 2018-12-17T00: 00Z
source share