{
CvCapture *capture=cvCaptureFromFile("未命名_0.mp4");
IplImage* frame=cvQueryFrame(capture);
if (!frame)
{
cout<<"can not find video"<<endl;
return -1;
}
//CTimeDiffer tif;
//tif.StartTiming();
//double span = tif.GetElapseTime();
long begin,end,time;
IplImage* gray=cvCreateImage(cvGetSize(frame),8,1);
char filename[100];
int fnum=0;
cvNamedWindow("gray");
while (frame)
{
fnum++;
begin = clock();
sprintf(filename,"image\\result %d.jpg",fnum);
cvCvtColor(frame,gray,CV_RGB2GRAY);
cvShowImage("gray",gray);
cvSaveImage(filename,gray);
end = clock();
time = end - begin;
cout<<time<<endl;
if (cvWaitKey(1)>=0)
{
break;
}
frame=cvQueryFrame(capture);
}
return 0;
}
联系客服