在 opencv2.2 visual c++ express 2010 中,灰屏显示为输出而不是实际的相机输入。是因为任何 dll 文件吗?
我正在尝试执行一个简单的 opencv 程序来显示捕获的视频源,但得到一个灰色窗口作为输出。
int main(void) {
CvCapture* capture = cvCaptureFromCAM (CV_CAP_ANY);
if( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n");
getchar();
return -1;
}
// create a window in which the capture images will be presented
cvNamedWindow("mywindow", CV_WINDOW_AUTOSIZE);
// show the image captured from the camera in the window and repeat
while (1) {
// get one frame
IplImage* frame = cvQueryFrame (capture);
if (!frame) {
fprintf( stderr, "ERROR: frame is null...\n");
getchar();
break;
}
cvShowImage("mywindow", frame);
// do not release the frame
// terminate
if ((cvWaitKey(10) & 255) == 27) break;
}
// release the capture device
cvReleaseCapture (&capture);
cvDestroyWindow("mywindow");
return EXIT_SUCCESS;
}