有谁知道为什么我不断收到空帧?我尝试跳过前五个,但仍然为空。
int _tmain(int argc, char** argv)
{
CvCapture *capture = cvCaptureFromFile(argv[1]);
int fps = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
IplImage* frame;
cvNamedWindow("video", CV_WINDOW_AUTOSIZE);
while(1)
{
frame = cvQueryFrame(capture);
if(!frame)
break;
cvShowImage("video", frame);
char c = cvWaitKey(1000/fps);
if(c == 33)
break;
}
cvReleaseCapture( &capture);
cvDestroyWindow( "video" );
return 0;
}