新聞中心
這篇文章將為大家詳細(xì)講解有關(guān)使用opencv怎么實(shí)現(xiàn)定時(shí)錄像功能,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。

創(chuàng)新互聯(lián)公司是專業(yè)的虹口網(wǎng)站建設(shè)公司,虹口接單;提供網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行虹口網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
#include "cv.h" #include "cxcore.h" #include "highgui.h" #include#include #include #include #include "stdio.h" int timea=100000; using namespace std; /*void times() { SYSTEMTIME sys_time; //將變量值設(shè)置為本地時(shí)間 GetLocalTime( &sys_time ); //輸出時(shí)間 printf( "%4d/%02d/%02d %02d:%02d:%02d.%03d 星期%1d\n",sys_time.wYear, sys_time.wMonth, sys_time.wDay, sys_time.wHour, sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds, sys_time.wDayOfWeek); // system("time"); // // system("pause"); return 0; } */ int main() { CvCapture* capture=cvCaptureFromCAM(0); CvVideoWriter* video=NULL; IplImage* frame=NULL; int n; if(!capture) //如果不能打開(kāi)攝像頭給出警告 { cout<<"Can not open the camera."< width,frame->height)); //創(chuàng)建CvVideoWriter對(duì)象并分配空間 //保存的文件名為camera.avi,編碼要在運(yùn)行程序時(shí)選擇,大小就是攝像頭視頻的大小,幀頻率是32 if(video) //如果能創(chuàng)建CvVideoWriter對(duì)象則表明成功 { cout<<"VideoWriter has created."< >timea; int ti=timea*25; cvNamedWindow("Camera Video",1); //新建一個(gè)窗口 int i = 0; while(i <= ti) // 讓它循環(huán)ti次自動(dòng)停止錄取 { frame=cvQueryFrame(capture); //從CvCapture中獲得一幀 if(!frame) { cout<<"Can not get frame from the capture."< 0) break; //有其他鍵盤響應(yīng),則退出 } cvReleaseVideoWriter(&video); //如果不釋放則春不上 cvReleaseCapture(&capture); cvDestroyWindow("Camera Video"); } return 0; }
關(guān)于使用opencv怎么實(shí)現(xiàn)定時(shí)錄像功能就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。
當(dāng)前名稱:使用opencv怎么實(shí)現(xiàn)定時(shí)錄像功能
當(dāng)前URL:http://www.dlmjj.cn/article/ghgsig.html


咨詢
建站咨詢
