用opencv从摄像头抓取的视频文件打不开
#includeusingnamespacestd;//#pragmacomment(linker,"/subsystem:\"windows\"/entry:\"mai...
#includeusing namespace std; //#pragma comment(linker,"/subsystem:\"windows\"/entry:\"mainCRTStartup\"") char*outname("D://programming/data/video/myself.avi"); intmain( int argc, char**argv ){ //声明IplImage指针 IplImage* pFrame = NULL; //获取摄像头 CvCapture* pCapture = cvCreateCameraCapture(-1); cvNamedWindow("video",1); //创建视频显示窗口 //double fps = 25; while(1) { pFrame= cvQueryFrame( pCapture ); if(!pFrame) break; cvShowImage("video",pFrame); CvVideoWriter*writer = cvCreateVideoWriter( outname, //-1, CV_FOURCC('P','I','M','1'), 25, cvGetSize(pFrame), 1 ); cvWriteFrame(writer, pFrame); char c=cvWaitKey(33); if(c==27) break; } cvReleaseCapture(&pCapture); cvDestroyWindow("video"); return(0); }想用以上程序从摄像头保存视频,文件是保存下来了,但再用cvCreateFileCapture就打不开了,用暴风影音也打不开,很迷惑,编程环境是WINDOW7平台,opencv2.3.1, vs2008
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询