操作系统:windows xp

开发工具:VS2008

opencv版本:2.1.0

依赖库:OpenCV2.1\lib\highgui.lib

 #include "cv.h"
#include "highgui.h" int main()
{
cvNamedWindow("VideoTest",CV_WINDOW_AUTOSIZE);
CvCapture* mCapture=NULL;
IplImage* frame;
while()
{
mCapture=cvCreateFileCapture(-);
frame=cvQueryFrame(mCapture);
if (!frame)
{
break;
}
cvShowImage("VideoTest",frame);
char c=cvWaitKey();
if (c==)
{
break;
}
}
cvReleaseCapture(&mCapture);
cvDestroyWindow("VideoTest");
}

插上你的摄像头,就可以显示了,那么短的代码,只能感叹opencv封装得很好!

05-11 11:08