xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 4KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-28
  • 語言: 其他
  • 標(biāo)簽: VIBE??背景建模??

資源簡介

基于VIBE的運(yùn)動(dòng)目標(biāo)檢測,其根據(jù)隨機(jī)采樣原理進(jìn)行背景建模,檢測速度快,準(zhǔn)確率高。

資源截圖

代碼片段和文件信息

#include?“stdafx.h“
#include?“hanshu.h“
#include?
#include?“highgui.h“
#include?
#include?

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

static?int?c_xoff[9]?=?{-1??0??1?-1?1?-1?0?1?0};//x的鄰居點(diǎn)
static?int?c_yoff[9]?=?{-1??0??1?-1?1?-1?0?1?0};//y的鄰居點(diǎn)

float?samples[1024][1024][defaultNbSamples+1];//保存每個(gè)像素點(diǎn)的樣本值


//初始化
void?Initialize(CvMat*?pframeMatRNG?rng){

//記錄隨機(jī)生成的?行(r)?和?列(c)
int?randrc;

//對(duì)每個(gè)像素樣本進(jìn)行初始化
for(int?y=0;yameMat->rows;y++){//Height
for(int?x=0;xameMat->cols;x++){//Width
for(int?k=0;k //隨機(jī)獲取像素樣本值
rand=rng.uniform(?0?9?);
r=y+c_yoff[rand];?if(r<0)?r=0;?if(r>=pframeMat->rows)?r=pframeMat->rows-1; //行
c=x+c_xoff[rand];?if(c<0)?c=0;?if(c>=pframeMat->cols)?c=pframeMat->cols-1; //列
//存儲(chǔ)像素樣本值
samples[y][x][k]=CV_MAT_ELEM(*pframeMatfloatrc);
}
samples[y][x][defaultNbSamples]=0;
}
}
}


//更新函數(shù)
void?update(CvMat*?pframeMatCvMat*?segMatRNG?rngint?nFrmNum){

for(int?y=0;yameMat->rows;y++){ //Height
for(int?x=0;xameMat->cols;x++){ //Width

//用于判斷一個(gè)點(diǎn)是否是背景點(diǎn)index記錄已比較的樣本個(gè)數(shù),count表示匹配的樣本個(gè)數(shù)
int?count=0index=0;float?dist=0;
//
while((count dist=CV_MAT_ELEM(*pframeMatfloatyx)-samples[y][x][index];
if(dist<0)?dist=-dist;
if(dist index++;
}
if(count>=defaultReqMatches){

//判斷為背景像素只有背景點(diǎn)才能被用來傳播和更新存儲(chǔ)樣本值
samples[y][x][defaultNbSamples]=0;

*((float?*)CV_MAT_ELEM_PTR(*segMatyx))=background;

int?rand=rng.uniform(0defaultSubsamplingFactor);
if(rand==0){
rand=rng.uniform(0defaultNbSamples);
samples[y][x][rand]=CV_MAT_ELEM(*pframeMatfloatyx);
}
rand=rng.uniform(0defaultSubsamplingFactor);
if(rand==0){
int?xNyN;
rand=rng.uniform(09);yN=y+c_yoff[rand];if(yN<0)?yN=0;?if(yN>=pframeMat->rows)?yN=pframeMat->rows-1;
rand=rng.uniform(09);xN=x+c_xoff[rand];if(xN<0)?xN=0;?if(xN>=pframeMat->cols)?xN=pframeMat->cols-1;
rand=rng.uniform(0defaultNbSamples);
samples[yN][xN][rand]=CV_MAT_ELEM(*pframeMatfloatyx);
}?
}
else?{
//判斷為前景像素
*((float?*)CV_MAT_ELEM_PTR(*segMatyx))=foreground;

samples[y][x][defaultNbSamples]++;
if(samples[y][x][defaultNbSamples]>50){
int?rand=rng.uniform(0defaultNbSamples);
if(rand==0){
rand=rng.uniform(0defaultNbSamples);
samples[y][x][rand]=CV_MAT_ELEM(*pframeMatfloatyx);
}
}
}

}
}

}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????2753??2012-12-05?15:21??ViBeCode\hanshu.cpp

?????文件????????521??2011-07-23?19:02??ViBeCode\hanshu.h

?????文件????????291??2011-07-20?12:04??ViBeCode\stdafx.cpp

?????文件????????320??2011-07-20?12:04??ViBeCode\stdafx.h

?????文件????????314??2011-07-20?12:04??ViBeCode\targetver.h

?????文件???????4001??2013-04-09?17:03??ViBeCode\vibe.cpp

?????目錄??????????0??2013-04-09?17:18??ViBeCode

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

?????????????????8200????????????????????7


評(píng)論

共有 條評(píng)論

相關(guān)資源