OpenCV学习笔记【6】:从摄像机读入数据

来源:互联网 发布:非凡软件站 编辑:程序博客网 时间:2024/04/29 13:00

从摄像设备读入数据。

// example_p30.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "cv.h"#include "highgui.h"int _tmain(int argc, _TCHAR* argv[]){CvCapture* capture;if( argc ==1 )capture = cvCreateCameraCapture(0);elsecapture = cvCreateFileCapture( "1.avi" );IplImage* frame;cvNamedWindow("Example6", CV_WINDOW_AUTOSIZE);while(1){frame = cvQueryFrame( capture );if(!frame)break;cvShowImage("Example6", frame );char c = cvWaitKey(33);if(c == 27 )break;}assert( capture!=NULL );return 0;}

效果如下图:


0 0
原创粉丝点击