Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how can I set VideoCapture attributes with set?

I am trying to adjust the gain in a simple camera function

void imgGet(){

    cv::VideoCapture cap(0);
    double k=0.99;
    cv::VideoCapture::set(CV_CAP_PROP_GAIN, k ); //value from 0 to 1
    Mat frame;
    cap >> frame;
    string fileName = getFName();
    imwrite(fileName, frame);
    }

Ive tried a variety of things, but the error I get is:

capture.cpp:34:47: error: cannot call member function ‘virtual bool cv::VideoCapture::set(int, double)’ without object

I don't know what that means, how am I supposed to set the VideoCapture::set object? I have seen the videocapture documentation

but I didnt understand it in a useful way.

how can I set VideoCapture attributes with set?

I am trying to adjust the gain in a simple camera function

void imgGet(){

    cv::VideoCapture cap(0);
    double k=0.99;
    cv::VideoCapture::set(CV_CAP_PROP_GAIN, cap.set(CV_CAP_PROP_GAIN, k ); //value from 0 to 1
     Mat frame;
    cap >> frame;
    string fileName = getFName();
    imwrite(fileName, frame);
    }

Ive tried a variety of things, but the error I get is:

capture.cpp:34:47: error: cannot call member function ‘virtual bool cv::VideoCapture::set(int, double)’ without objectVIDIOC_S_CTRL: Invalid argument

I don't know what that means, how am I supposed to set the VideoCapture::set object? I have seen the videocapture documentation

but I didnt understand it in a useful way.way. I am on a Linux PC. despite the error, an image is still taken, but the image quality is unchanged.

how can I set VideoCapture attributes with set?

I am trying to adjust the gain in a simple camera function

void imgGet(){

    cv::VideoCapture cap(0);
    double k=0.99;
    cap.set(CV_CAP_PROP_GAIN, k ); cap.set(CAP_PROP_EXPOSURE,1); 
    Mat frame;
    cap >> frame;
    string fileName = getFName();
    imwrite(fileName, frame);
    }

Ive tried a variety of things, but the error I get is:

VIDIOC_S_CTRL: Invalid argument

I don't know what that means, how am I supposed to set the VideoCapture::set object? I have seen the videocapture documentation

but I didnt understand it in a useful way. I am on a Linux PC. despite the error, an image is still taken, but the image quality is unchanged.