Ask Your Question

Can't set resolution of video capture

asked 2013-05-05 17:56:27 -0500

erobertc gravatar image


I would like to be able to set the resolution of the input from my Logitech C310 webcam. The camera supports up to 1280x960 at 30fps, and I am able to view the video at this resolution in guvcview. But OpenCV always gets the video at only 640x480.

Trying to change the resolution with cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280) and cap.set(CV_CAP_PROP_FRAME_HEIGHT, 960) immediately after the VideoCapture cap is created has no effect; trying to set them immediately before getting every frame causes the program to crash immediately. I cannot reduce the resolution with this method either. I am also getting the error "HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP". I think this may be related, because it appears once when the VideoCapture is created, and once when I try to set the width and height (but, oddly, not if I try to set only one of them).

I am using OpenCV 2.4.5 on Ubuntu 12.04 64-bit. I know I'm not the first to have this problem, but I have yet to find a solution after much Googling and scouring of the internet (among the many things I've already tried to no avail is the answer to this StackOverflow question: Is this a bug in OpenCV? If so, it's a rather glaring one.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-05-06 01:27:20 -0500

efanucar gravatar image

I also had some problems with my logitech webcam and OpenCV capturing. I then used the videoInput Library and could set everything I needed. Give it a try!

edit flag offensive delete link more


Sorry, this is only working on are using Linux as I realised now...

efanucar gravatar imageefanucar ( 2013-05-06 01:29:50 -0500 )edit

Question Tools


Asked: 2013-05-05 17:56:27 -0500

Seen: 5,576 times

Last updated: May 06 '13