#include "stdafx.h" #include "opencv/cv.h" #include <opencv/cxcore.h> #include <opencv/highgui.h> #ifdef DEBUG #pragma comment(lib, "opencv_highgui244d.lib") #else #pragma comment(lib, "opencv_highgui244.lib") #endif int _tmain(int argc, _TCHAR* argv[]) { IplImage *pFrame = NULL; //获取摄像头 CvCapture *pCapture = cvCreateCameraCapture(-1); while(1) { //获取一帧 pFrame = cvQueryFrame(pCapture); if (!pFrame){ break; } cvShowImage("videoShow", pFrame); char c = cvWaitKey(33); if (c == 27) { break; } } cvReleaseCapture(&pCapture); cvDestroyWindow("video"); return 0; }
库文件:opencv_core244.dll 、opencv_highgui244.dll