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

資源簡介

基于opencv+vs2008的視頻前景檢測,對于視頻監控領域是很好的小demo

資源截圖

代碼片段和文件信息

/************************************************************************
*?Copyright(c)?2011??Yang?Xian
*?All?rights?reserved.
*
*?File: extractForeground.cpp
*?Brief:?提取視頻中的前景物體
*?Version:?1.0
*?Author:?Yang?Xian
*?Email:?xyang2011@sinano.ac.cn
*?Date: 2011/11/19
*?History:
************************************************************************/
#include?
#include?
#include?

#include?
#include?

using?namespace?std;
using?namespace?cv;

void?processing(Mat?&frame?Mat?&output);

string?windowResult?=?“Extracting?foreground?object“;
string?windowSource?=??“Original?Video“;
Mat?gray; //?當前灰度圖片
Mat?background; //?累積背景
Mat?backImage; //?背景圖片
Mat?foreground; //?前景圖片
double?learningRate?=?0.01; //?控制背景累積學習的速率
int?nThreshold?=?30; //?前景提取的閾值

int?main()
{
Mat?frame;
Mat?result;

//? CvCapture*?capture?=?cvCaptureFromCAM(?-1?); //?攝像頭讀取文件開關
VideoCapture?capture(“bike.avi“);

if(capture.isOpened()/*capture*/) //?攝像頭讀取文件開關
{
while(true)
{
//? frame?=?cvQueryframe(?capture?); //?攝像頭讀取文件開關
capture?>>?frame;

if(!frame.empty())
{?
processing(frame?result);
}
else
{?
printf(“?--(!)?No?captured?frame?--?Break!“);
break;
}

int?c?=?waitKey(100);
if(?(char)c?==?27?)
{
break;?
}?
}
}
return?0;
}

void?processing(Mat?&frame?Mat?&output)
{
cvtColor(frame?gray?CV_BGR2GRAY);
//?對于第一幀,初始化背景
if?(background.empty())
{
gray.convertTo(background?CV_32F);
}
background.convertTo(backImage?CV_8U);
//?計算當前圖片和背景的差別
absdiff(backImage?gray?foreground);
//?對得到的前景進行閾值選取,去掉偽前景
threshold(foreground?output?nThreshold?255?THRESH_BINARY_INV);
//?實時更新背景
accumulateWeighted(gray?background?learningRate?output);

imshow(windowSource?frame);
imshow(windowResult?output);
}

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

?????文件?????446600??2011-02-16?14:14??ExtractForeground\Debug\bike.avi

?????文件??????46080??2011-11-19?16:00??ExtractForeground\Debug\ExtractForeground.exe

?????文件?????368952??2011-11-19?16:00??ExtractForeground\Debug\ExtractForeground.ilk

?????文件?????797696??2011-11-19?16:00??ExtractForeground\Debug\ExtractForeground.pdb

?????文件?????446600??2011-02-16?14:14??ExtractForeground\ExtractForeground\bike.avi

?????文件???????6374??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug\BuildLog.htm

?????文件????????621??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug\ExtractForeground.exe.intermediate.manifest

?????文件??????70290??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug\extractForeground.obj

?????文件?????????67??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug\mt.dep

?????文件?????330752??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug\vc90.idb

?????文件?????495616??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug\vc90.pdb

?????文件???????2060??2011-11-19?16:21??ExtractForeground\ExtractForeground\extractForeground.cpp

?????文件???????3769??2011-11-19?15:41??ExtractForeground\ExtractForeground\ExtractForeground.vcproj

?????文件???????1423??2011-11-19?16:22??ExtractForeground\ExtractForeground\ExtractForeground.vcproj.HP98402794308.Administrator.user

?????文件????2878464??2011-11-19?16:22??ExtractForeground\ExtractForeground.ncb

?????文件????????917??2011-11-19?15:26??ExtractForeground\ExtractForeground.sln

????..A..H.??????9216??2011-11-19?16:22??ExtractForeground\ExtractForeground.suo

?????目錄??????????0??2011-11-19?16:00??ExtractForeground\ExtractForeground\Debug

?????目錄??????????0??2011-11-19?16:00??ExtractForeground\Debug

?????目錄??????????0??2011-11-19?16:21??ExtractForeground\ExtractForeground

?????目錄??????????0??2011-11-19?15:43??ExtractForeground

-----------?---------??----------?-----??----

??????????????5905497????????????????????21


評論

共有 條評論