# Revision history [back]

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

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