Problem with cvGetCaptureProperty on opencv

I have a working opencv code that takes a feed from my webcam and displays it. (Code changed from here

The only problem is that when I try to print the value of frame-per-second, like

int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS); printf ("Frames per Second: %d\n",fps); 

-1 is printed.

Another (secondary) problem is that there seem to be some runtime errors / warnings

 VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument select timeout HIGHGUI ERROR: V4L2: Unable to get property <unknown property string>(5) - Invalid argument HIGHGUI ERROR: V4L: Property <unknown property string>(2) not supported by device HIGHGUI ERROR: V4L2: Unable to get property <unknown property string>(1) - Invalid argument HIGHGUI ERROR: V4L: Property <unknown property string>(2) not supported by device 

But the code does what it should do, i.e. display video from a webcam.

Any ideas how to sort out the problems? I am using opencv on Eclipse with CDT on Ubuntu 11.10

Thanks in advance.

+4
source share
2 answers

Judging by the error messages, this sounds like a problem with your webcam driver. Error messages relate to Video4Linux (V4L or V4L2 in error messages), which are part of the Linux kernel that contains the webcam drivers. Receiving a select() error and a “not supported by device” error message probably means that your webcam has not implemented this part of the V4L2 API.

You can verify that this is a problem by testing your code using a camera with a well-known driver. Unfortunately, this is very common in webcam drivers included in the kernel. Many of them have reverse engineering, so this is quite a feat, just access to the video stream.

+2
source

Try this for HIGHGUI ERROR errors:

 export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so 
0
source

Source: https://habr.com/ru/post/1388802/


All Articles