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

  • 大小: 2KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-29
  • 語言: Matlab
  • 標簽: matlab??

資源簡介

基于高斯混合模型的視頻移動目標檢測,matlab代碼,喜歡的可以學習一下。

資源截圖

代碼片段和文件信息

clear?all;
close?all;


Video?=?input(‘Enter?the?name?of?the?video?file:‘?‘s‘);
if?isempty(Video)
????error(‘myApp:argChk‘?‘You?did?not?enter?a?video?file!‘)
end
inputVideo?=?aviread(Video);

fr?=?inputVideo(1).cdata;???????????%?read?in?1st?frame?as?background?frame
fr_bw?=?rgb2gray(fr);???????????????%?convert?background?to?greyscale
fr_size?=?size(fr);?????????????????%?get?the?size?of?the?frame
width?=?fr_size(2);?????????????????%?get?the?width?of?the?frame
height?=?fr_size(1);????????????????%?get?the?height?of?the?frame
foreground?=?zeros(height?width);??????????%?initialize?variable?to?store?foreground
background?=?zeros(height?width);???????%?initialize?variable?to?store?background

%?

K?=?3;???????????????????????????????????????????%?number?of?gaussian?components?(can?be?upto?3-5)
M?=?3;???????????????????????????????????????????%?number?of?background?components
D?=?2.5;?????????????????????????????????????????%?positive?deviation?threshold
alpha?=?0.01;????????????????????????????????????%?learning?rate?(between?0?and?1)?(from?paper?0.01)
foregroundThreshold?=?0.25;??????????????????????%?foreground?threshold?(0.25?or?0.75?in?paper)
sd_initial?=?6;??????????????????????????????????%?initial?standard?deviation?(for?new?components)?var?=?36?in?paper
weight?=?zeros(heightwidthK);??????????????????%?initialize?weights?array
mean?=?zeros(heightwidthK);????????????????????%?pixel?means
standardDeviation?=?zeros(heightwidthK);???????%?pixel?standard?deviations
diffFromMean?=?zeros(heightwidthK);????????????%?difference?of?each?pixel?from?mean
learningRate?=?alpha/(1/K);??????????????????????%?initial?p?variable?(used?to?update?mean?and?sd)
rankComponent?=?zeros(1K);??????????????????????%?rank?of?components?(w/sd)


%?initialize?components?for?the??means?and?weights?

pixel_depth?=?8;????????????????????????%?8-bit?resolution
pixel_range?=?2^pixel_depth?-1;?????????%?pixel?range?(#?of?possible?values)

for?i=1:height
????for?j=1:width
????????for?k=1:K
????????????
????????????mean(ijk)?=?rand*pixel_range;??????????%?means?random?(0-255)?it?initialzes?the?mean?to?some?random?value.
????????????weight(ijk)?=?1/K;?????????????????????%?weights?uniformly?dist
????????????standardDeviation(ijk)?=?sd_initial;???%?initialize?to?sd_init
????????????
????????end
????end
end

%?Applying?the?proposed?algorithm?to?the?video

for?n?=?1:length(inputVideo)
????%?reading?the?frames.
????fr?=?inputVideo(n).cdata;??
????%?converting?the?frames?to?grayscale.
????fr_bw?=?rgb2gray(fr);???????
????
????%?calculating?the?difference?of?each?pixel?values?from?mean.
????for?m=1:K
????????diffFromMean(::m)?=?abs(double(fr_bw)?-?double(mean(::m)));
????end
?????
????%?update?gaussian?components?for?each?pixel?values.
????for?i=1:height
????????for?j=1:width
????????????
????????????match?=?0;?%?its?changed?to?1?if?the?component?is?matched
????????????for?k=1:K??
????????????????%?pixel?matches?component
????????????????if?(abs(diffFromMean(ij

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????7375??2018-02-01?20:21??RavdeepJohar.m

評論

共有 條評論