Ask Your Question

AndresCalvo's profile - activity

2014-06-08 06:13:55 -0600 received badge  Famous Question (source)
2013-12-12 10:59:55 -0600 received badge  Notable Question (source)
2013-10-02 07:06:02 -0600 received badge  Popular Question (source)
2013-01-31 04:13:32 -0600 received badge  Student (source)
2013-01-30 14:02:22 -0600 asked a question How to set or get VideoCapture properties?

I'm trying to modify the properties of a 720p HD Logitech usb webcam, in order to change their fps or image format, size.

But opencv generates the following error:

HIGHGUI ERROR: V4L2: Unable to get property <Unknown string> property (5) - Invalid argument.

The code:

# include <iostream>
# include <opencv2/core/core.hpp>
# include <opencv2/highgui/highgui.hpp>
# include <opencv2/imgproc/imgproc.hpp>    
using namespace std;

int main () {    
cv :: VideoCapture cap (0); // open the default camera

if (! cap.isOpened ()) // check if we succeeded
return -1;

cv :: Mat edges;
cv :: namedWindow ("edges", 1);

for (;;)
{
 cv :: Mat frame;
 cap >> frame; // get a new frame from camera

// This function generate error

cap.get double val = (CV_CAP_PROP_FPS);
cout << val << endl;

cv :: cvtColor (frame, edges, CV_BGR2GRAY);
cv :: GaussianBlur (edges, edges, cv :: Size (7,7), 1.5, 1.5);
cv :: Canny (edges, edges, 0, 30, 3);
cv :: imshow ("edges", edges);

if (cv :: waitKey (30)> = 0) break;
}

return 0;
}

I would appreciate some help.