刚入手学习opencv,写了一段打开一个视频的代码,可是读不出来,编解码器安装了还是读不出来,请大神解答一下下,代码如下:
#include <stdafx.h>
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
int main (int argc,char **argv)
{
cvNamedWindow("avi");
CvCapture* capture=cvCreateFileCapture("D:\\4.avi");//结构体
IplImage*frame;//定义一个Iplimage类型的指针
while (1)
{
frame=cvQueryFrame(capture);//读取下一帧
if (!frame)
break;
cvShowImage("avi",frame);
char c=cvWaitKey(33);
if (c==27)
break;
cvReleaseCapture(&capture);
cvDestroyWindow("avi");
return 0;
}
}
#include <stdafx.h>
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
int main (int argc,char **argv)
{
cvNamedWindow("avi");
CvCapture* capture=cvCreateFileCapture("D:\\4.avi");//结构体
IplImage*frame;//定义一个Iplimage类型的指针
while (1)
{
frame=cvQueryFrame(capture);//读取下一帧
if (!frame)
break;
cvShowImage("avi",frame);
char c=cvWaitKey(33);
if (c==27)
break;
cvReleaseCapture(&capture);
cvDestroyWindow("avi");
return 0;
}
}