标签:des style blog class c code
实验1
实验目的:使用opencv操作摄像头拍摄一张图片
函数:
1 CvCapture* cvCreateCameraCapture( int index ); 2 IplImage* cvQueryFrame( CvCapture* capture );
实验代码:
1 #include"highgui.h" 2 #include"cv.h" 3 int main(){ 4 cvNamedWindow("w",0); 5 IplImage* img; 6 CvCapture* pCapture =cvCreateCameraCapture(0); 7 8 cvWaitKey(); 9 img=cvQueryFrame( pCapture ); 10 cvShowImage("w",img); 11 cvWaitKey(); 12 13 cvReleaseCapture(&pCapture); 14 cvDestroyWindow("w"); 15 return 0; 16 }
实验2
实验目的:使用opencv操作摄像头拍摄视频
实验代码:
1 #include"highgui.h" 2 #include"cv.h" 3 int main(){ 4 cvNamedWindow("w",0); 5 IplImage* img; 6 CvCapture* pCapture =cvCreateCameraCapture(0); 7 8 cvWaitKey(); 9 10 while(1){ 11 img=cvQueryFrame( pCapture ); 12 cvShowImage("w",img); 13 char temp=cvWaitKey(40); 14 if(temp==27)break; 15 } 16 17 cvReleaseCapture(&pCapture); 18 cvDestroyWindow("w"); 19 return 0; 20 }
实验2014051901:opencv操作摄像头,布布扣,bubuko.com
标签:des style blog class c code
原文地址:http://www.cnblogs.com/experiments-of-ORLAN/p/3737452.html