zoukankan      html  css  js  c++  java
  • 实验2014051901:opencv操作摄像头

    实验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 }
  • 相关阅读:
    (转)C# BackgroundWorker组件的原理分析
    (转)App.Config详解及读写操作
    (转)C# 控制蜂鸣器发声
    存储过程小例子
    DB通用类:MySQL通用类
    poj 1936 All in All
    Bone Collector 01背包问题
    sdut1359 求最大和子矩阵
    求最大值
    后缀式求值
  • 原文地址:https://www.cnblogs.com/experiments-of-ORLAN/p/3737452.html
Copyright © 2011-2022 走看看