资源简介
混合高斯模型的背景减除法和相邻帧差法相结合进行目标检测的程序,内附视频
(The background of the gaussian mixture model reduction division and adjacent frame differential method for target detection with the program, enclosing video)
代码片段和文件信息
% This m-file implements the mixture of Gaussians algorithm for background
% subtraction. It may be used free of charge for any purpose (commercial
% or otherwise) as long as the author (Seth Benton) is acknowledged.
clear all
% source = aviread(‘C:\Video\Source\traffic\san_fran_traffic_30sec_QVGA‘);
source = aviread(‘SampleVideo.avi‘);
% ----------------------- frame size variables -----------------------
fr = source(1).cdata; % read in 1st frame as background frame
fr_bw = rgb2gray(fr); % convert background to greyscale
fr_size = size(fr);
width = fr_size(2);
height = fr_size(1);
fg = zeros(height width);
bg_bw = zeros(height width);
% --------------------- mog variables -----------------------------------
C = 3; % number of gaussian components (typically 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)
thresh = 0.25; % foreground threshold (0.25 or 0.75 in paper)
sd_init = 6; % initial standard deviation (for new components) var = 36 in paper
w = zeros(heightwidthC); % initialize weights array
mean = zeros(heightwidthC); % pixel means
sd = zeros(heightwidthC); % pixel standard deviations
u_diff = zeros(heightwidthC); % difference of each pixel from mean
p = alpha/(1/C); % initial p variable (used to update mean and sd)
rank = zeros(1C); % rank of components (w/sd)
% --------------------- initialize component 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:C
mean(ijk) = rand*pixel_range; % means random (0-255)
w(ijk) = 1/C; % weights uniformly dist
sd(ijk) = sd_init; % initialize to sd_init
end
end
end
%--------------------- process frames -----------------------------------
for n = 1:length(source)
fr = source(n).cdata; % read in frame
fr_bw = rgb2gray(fr); % convert frame to grayscale
% calculate difference of pixel values from mean
for m=1:C
u_diff(::m) = abs(double(fr_bw) - double(mean(::m)));
end
% update gaussian components for each pixel
for i=1:height
for j=1:width
match = 0;
for k=1:C
if (abs(u_diff(ijk)) <= D*sd(ijk)) % pixel matches component
match = 1;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6138 2011-04-18 15:56 mixture_of_gaussians.m
文件 638976 2005-03-14 13:59 SampleVideo.avi
----------- --------- ---------- ----- ----
645114 2
- 上一篇:Xposed框架以及JustTrusetMe安装包
- 下一篇:PPT毕业答辩模板
相关资源
- 基于co-training的手写数字识别Multiple
- 多普勒脉冲雷达回波仿真
- kpca lda mds降维 人脸数据
- 光伏在MPPT下的boost电路
- 随机梯度下降算法
- 基础差分进化算法Rastrigin测试
- ABC带约束优化算法
- 连接二值图像中断开的点
- 车牌倾斜校正
- 卷积编解码,实现了2/33/4删余卷积
- 有源电力滤波器APF
- RBF神经网络预测
- 基于模糊控制和PID结合的倒立摆仿真
- 基本风+阵风+噪声风+渐变风联合仿真
- 瑞利信道下的分集合并技术仿真
- advisor复合电源二次开发过程
- 旅行商问题中国34省会的
- 计量经济学软件eviews6.0建模方法与操
- 机场延误 遗传算法
- MSSIM 图像相似度的计算
- 微电网虚拟同步发电寄控制模型
- flocking concrol.zip
- 蚁狮算法寻优
- 二次曲面拟合实现高程模型建立
- 角点检测Corners代码
- 基于梯度法的模型参考自适应程序
- 基于李雅普诺夫模型参考自适应程序
- D2D-HS算法
- GPS信号捕获仿真
- 产生正态白噪声序列(1) 打印出前
评论
共有 条评论