Ask Your Question
2

How to change contrast/brightness of a CAM using OpenCV 2.4.2

asked 2012-08-29 06:43:12 -0600

Gaurang gravatar image

Hey,

Please let me know how to change the brightness and contrast of a cam using OpenCV 2.4.2. I wrote a code, but there is no impact of using this code. Please let me know how to write the code.

I used like this.

    CvCapture *capture = cvCaptureFromCAM(CV_CAP_DSHOW);
if(!cvSetCaptureProperty(capture,CV_CAP_PROP_CONTRAST,0.7))
    AfxMessageBox("Not done.");
    while ( 1 ) 
{
         IplImage* frame = cvQueryFrame( capture );
         int c;
     cvNamedWindow("Image Display", CV_WINDOW_AUTOSIZE);
     while(1)
     {
    frame=cvQueryFrame(capture);
    cvShowImage("Image Display", frame );
         }
    }

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-08-29 08:23:00 -0600

sammy gravatar image

Those properties only work for a number of cameras. If it doesn't work, the solution is to find another camera or to use an external library that can control those params for the camera you're using. Note that many webcams simply do not have any mechanism to control these parameters - they are cheap devices, without any capture tuning abilities.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-08-29 06:43:12 -0600

Seen: 2,917 times

Last updated: Aug 29 '12