91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

用VS2010和OPENCV編寫的關于視頻煙霧檢測的程序,運行效果很好。

資源截圖

代碼片段和文件信息

/****************************************************
*?smoke?detection
*
******************************************************/
#include?
#include?
#include?
#include?


int?main(int?argcchar**?argv)
{
IplImage*?pframe=NULL;
IplImage*?pFrImg=NULL;
IplImage*?pBkImg=NULL;

CvMat*?pframeMat=NULL;
CvMat*?pFrMat=NULL;
CvMat*?pBkMat=NULL;

CvCapture*?pCapture=NULL;

int?nFrmNum=0;

cvNamedWindow(“video“1);
cvNamedWindow(“background“1);
cvNamedWindow(“foreground“1);

cvMoveWindow(“video“300);
cvMoveWindow(“background“3600);
cvMoveWindow(“foreground“6900);

if(argc>2)
{
fprintf(stderr“Usage:bkgrd?[video_file_name]\n“);
return?-1;
}

if(argc==1)
{
if(!(pCapture=cvCaptureFromCAM(-1)))
{
fprintf(stderr“Can?not?open?camera.\n“);
return?-2;
}
}
if(argc==2)
{
if(!(pCapture=cvCaptureFromFile(argv[1])))
{
fprintf(stderr“Can?not?open?video?file?%s\n“argv[1]);
return?-2;
}
}
while(pframe=cvQueryframe(pCapture))
{
nFrmNum++;
if(nFrmNum==1)
{
pBkImg?=?cvCreateImage(cvSize(pframe->width?pframe->height)??IPL_DEPTH_8U1);
pFrImg?=?cvCreateImage(cvSize(pframe->width?pframe->height)??IPL_DEPTH_8U1);
pBkMat?=?cvCreateMat(pframe->height?pframe->width?CV_32FC1);
pFrMat?=?cvCreateMat(pframe->height?pframe->width?CV_32FC1);
pframeMat?=?cvCreateMat(pframe->height?pframe->width?CV_32FC1);
//轉化成單通道圖像再處理
cvCvtColor(pframe?pBkImg?CV_BGR2GRAY);
cvCvtColor(pframe?pFrImg?CV_BGR2GRAY);
cvConvert(pFrImg?pframeMat); ??
cvConvert(pFrImg?pFrMat); ??
cvConvert(pFrImg?pBkMat);
}
else
{
cvCvtColor(pframe?pFrImg?CV_BGR2GRAY);
cvConvert(pFrImg?pframeMat);
//高斯濾波先,以平滑圖像
cvSmooth(pframeMat?pframeMat?CV_GAUSSIAN?3?0?0);
//當前幀跟背景圖相減
cvAbsDiff(pframeMat?pBkMat?pFrMat);
//二值化前景圖 ?
cvThreshold(pFrMat?pFrImg?12?255.0?CV_THRESH_BINARY);

//進行形態學濾波,去掉噪音??
cvErode(pFrImg?pFrImg?0?1);
//cvDilate(pFrImg?pFrImg?0?1);

//更新背景 ?
cvRunningAvg(pframeMat?pBkMat?0.01?0);
//將背景轉化為圖像格式,用以顯示 ?
cvConvert(pBkMat?pBkImg);


//把圖像正過來?????????
pBkImg->origin=1;?????????
pFrImg->origin=1;?

//顯示圖像
cvShowImage(“video“?pframe);
cvShowImage(“background“?pBkImg);
cvShowImage(“foreground“?pFrImg);
//如果有按鍵事件,則跳出循環
//此等待也為cvShowImage函數提供時間完成顯示 ?
//等待時間可以根據CPU速度調整 ?
if(?cvWaitKey(2)?>=?0?) ????
break;
}
}
//銷毀窗口??
cvDestroyWindow(“video“);?
cvDestroyWindow(“background“);?
cvDestroyWindow(“foreground“);
//釋放圖像和矩陣??
cvReleaseImage(&pFrImg);??
cvReleaseImage(&pBkImg);
cvReleaseMat(&pframeMat);?
cvReleaseMat(&pFrMat);??
cvReleaseMat(&pBkMat);???
cvReleaseCapture(&pCapture);??
return?0;
}


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2997??2009-03-27?14:09??smokedetection\bkgrd.cpp

?????文件???????3342??2013-08-07?14:52??smokedetection\connected_component.cpp

?????文件???????1113??2013-08-07?14:52??smokedetection\connected_component.h

?????文件???????7875??2009-05-06?16:30??smokedetection\gmm.cpp

?????文件????1266476??2012-11-24?18:03??smokedetection\jie001.avi

?????文件??????11410??2013-08-14?09:32??smokedetection\smoke?detection.cpp

?????文件???????8764??2009-05-06?16:26??smokedetection\smoke?detection1.cpp

?????文件??????10673??2009-05-06?16:35??smokedetection\smoke?detection2.cpp

?????文件???????4753??2013-05-27?22:49??smokedetection\smokedetection.dsp

?????文件????????553??2009-03-26?14:43??smokedetection\smokedetection.dsw

?????文件??????66560??2013-05-27?22:49??smokedetection\smokedetection.ncb

?????文件??????50688??2013-05-27?22:49??smokedetection\smokedetection.opt

?????文件????????262??2013-05-27?22:48??smokedetection\smokedetection.plg

?????文件????????894??2013-08-17?20:27??smokedetection\smokedetection.sln

????..A..H.?????14336??2013-08-17?20:29??smokedetection\smokedetection.suo

?????文件???????7196??2013-08-17?20:27??smokedetection\smokedetection.vcxproj

?????文件???????1340??2013-08-07?14:48??smokedetection\smokedetection.vcxproj.filters

?????文件????????378??2013-08-07?15:13??smokedetection\smokedetection.vcxproj.user

?????文件???????3360??2013-08-14?09:31??smokedetection\swavelet.cpp

?????文件????????181??2009-03-30?11:40??smokedetection\swavelet.h

?????文件???????3866??2013-08-17?20:27??smokedetection\Debug\cl.command.1.tlog

?????文件?????157220??2013-08-17?20:27??smokedetection\Debug\CL.read.1.tlog

?????文件???????2424??2013-08-17?20:27??smokedetection\Debug\CL.write.1.tlog

?????文件??????????2??2013-08-17?20:28??smokedetection\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2013-08-17?20:28??smokedetection\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2013-08-17?20:28??smokedetection\Debug\link.5616-cvtres.read.1.tlog

?????文件??????????2??2013-08-17?20:28??smokedetection\Debug\link.5616-cvtres.write.1.tlog

?????文件??????????2??2013-08-17?20:28??smokedetection\Debug\link.5616.read.1.tlog

?????文件??????????2??2013-08-17?20:28??smokedetection\Debug\link.5616.write.1.tlog

?????文件???????4480??2013-08-17?20:28??smokedetection\Debug\link.command.1.tlog

............此處省略33個文件信息

評論

共有 條評論