• PUDN用户
    了解作者
  • Visual C++
    开发工具
  • 1.3MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 68
    下载次数
  • 2009-11-24 16:09
    上传日期
利用opencv编的一个小程序:启动摄像头并把读取的数据保存为avi格式的视频
AVICapture.rar
  • AVICapture
  • Debug
  • main.obj
    15.4KB
  • AVICapture.ilk
    187KB
  • vc60.pdb
    92KB
  • AVICapture.pch
    3.9MB
  • vc60.idb
    153KB
  • AVICapture.exe
    168.1KB
  • AVICapture.pdb
    425KB
  • AVICapture.dsw
    545B
  • AVICapture.opt
    52.5KB
  • main.cpp
    1.3KB
  • AVICapture.dsp
    4.1KB
  • AVICapture.plg
    1.2KB
  • AVICapture.ncb
    41KB
内容介绍
#include <cv.h> #include <highgui.h> #include <stdio.h> #include <windows.h> int main() { CvCapture *capture; IplImage *frame; // capture=cvCreateCameraCapture(0); capture = cvCaptureFromCAM(0); cvQueryFrame(capture); cvNamedWindow("Webcam",0); CvVideoWriter *writer; char AviFileName[]="c:\\Output.avi"; int AviForamt = -1; int FPS = 25; int i=0; // CvSize AviSize = cvSize(640,480); int AviColor = 1; int nFrames=90; int frameH=(int)cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT); int frameW=(int)cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH); writer=cvCreateVideoWriter(AviFileName,/*AviForamt*/CV_FOURCC('X', 'V', 'I', 'D'), FPS,cvSize(frameW,frameH),AviColor); while(true) { frame = cvQueryFrame(capture); cvWriteFrame(writer,frame); cvShowImage("Webcam",frame); printf("%d\n",i); if(cvWaitKey(20)>0) break; i++; } /* for ( i = 0; i < nFrames; i++) { cvGrabFrame(capture); frame = cvRetrieveFrame(capture); cvShowImage("Webcam",frame); cvWaitKey(20); cvWriteFrame(writer,frame); } */ cvReleaseCapture(&capture); cvReleaseVideoWriter(&writer); cvDestroyWindow("Webcam"); return 1; }
评论
    相关推荐