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

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

資源簡介

基于VIBE的運動目標檢測,其根據隨機采樣原理進行背景建模,檢測速度快,準確率高。

資源截圖

代碼片段和文件信息

#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的鄰居點
static?int?c_yoff[9]?=?{-1??0??1?-1?1?-1?0?1?0};//y的鄰居點

float?samples[1024][1024][defaultNbSamples+1];//保存每個像素點的樣本值


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

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

//對每個像素樣本進行初始化
for(int?y=0;yameMat->rows;y++){//Height
for(int?x=0;xameMat->cols;x++){//Width
for(int?k=0;k //隨機獲取像素樣本值
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; //列
//存儲像素樣本值
samples[y][x][k]=CV_MAT_ELEM(*pframeMatfloatrc);
}
samples[y][x][defaultNbSamples]=0;
}
}
}


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

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

//用于判斷一個點是否是背景點index記錄已比較的樣本個數,count表示匹配的樣本個數
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){

//判斷為背景像素只有背景點才能被用來傳播和更新存儲樣本值
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);
}
}
}

}
}

}

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

?????文件???????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


評論

共有 條評論