Ask Your Question

error setting resolution of video capture device

asked 2014-03-17 04:04:12 -0500

kbarni gravatar image

updated 2014-03-17 04:08:23 -0500


I have problems setting the resolution of the video capture devices I'm using.

I have two webcams (HP HD webcam (built-in) and Mercury USB webcam (external)) and they all use only the default resolution defined by the DEFAULT_V4L_HEIGHT/WIDTH variables in the cap-v4l.cpp file; changing the resolution won't work:

capturedevice.set(CAP_PROP_FRAME_WIDTH, W);
capturedevice.set(CAP_PROP_FRAME_HEIGHT, H);

The resolutions I try to set are supported by the webcam and the return value of the set function is 0 (success). Changing the resolution in other programs works.

[Edit:] I also get the "HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP" message in terminal.

Do you have any idea why does only the initial set resolution call work? Any possible solutions for the problem?

I'm using the latest version of OpenCV compiled from source on Ubuntu 13.10 64bit.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-03-19 12:12:59 -0500

kbarni gravatar image

updated 2014-03-19 12:18:58 -0500

After a lot of fiddling, I finally found the answer.

I compiled OpenCV without installing the development package for V4L. After I installed the missing library, everything works!

P.S. Note to the developers: you could add a sanity check for libv4l-dev if compiling with V4L.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-03-17 04:04:12 -0500

Seen: 5,462 times

Last updated: Mar 19 '14