当我调用该方法cvSetCaptureProperty(capture, CV_CAP_PROP_EXPOSURE, 2);
时,它会按应有的方式设置相机的曝光。但是,当我运行我的 Dell Webcam Central 软件、Skype 或其他任何使用我的相机的软件时,曝光会停留在我在 OpenCV 程序代码中设置的最后一次曝光,并且不会像以前那样自动调整之前做过。
如何让我的网络摄像头程序(Dell Webcam Central 和 Skype)再次自动调整曝光?
这是代码:
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY ); //CV_CAP_ANY
if ( !capture )
{
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 640);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 480);
int width = (int)(cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH));
int height = (int)(cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT));
IplImage* image = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3);
IplImage* frame;
char c;
while ( true )
{
frame = cvQueryFrame( capture );
if ( !frame )
{
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}
cvShowImage( "mywindow", frame );
cvSetCaptureProperty(capture, CV_CAP_PROP_EXPOSURE, 2);
c = cvWaitKey(33);
if( (c & 255) == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );
return 0;
}