资源简介
高斯混合模型提取背景matlab code
代码片段和文件信息
% 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
clc
% source = aviread(‘C:\Video\Source\traffic\san_fran_traffic_30sec_QVGA‘);
%source = aviread(‘..\test_video\san_fran_traffic_30sec_QVGA_Cinepak‘);
aviinfo(‘F:\test\vipmen.avi‘)
source = aviread(‘F:\test\vipmen.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))
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5376 2014-11-06 10:54 mixture_of_gaussians\mixture_of_gaussians.asv
文件 5298 2014-11-06 14:55 mixture_of_gaussians\mixture_of_gaussians.m
文件 5444608 2014-11-06 15:20 mixture_of_gaussians\mixture_of_gaussians_background.avi
文件 5444608 2014-11-06 15:20 mixture_of_gaussians\mixture_of_gaussians_output.avi
目录 0 2014-11-06 15:20 mixture_of_gaussians
----------- --------- ---------- ----- ----
10899890 5
- 上一篇:Matlab 与 Excel数据统计与分析方法
- 下一篇:Access人事管理系统
相关资源
- 基于高斯混合模型GMM的说话人识别实
- 模式识别PCA NMF LDA GMM算法代码
- 高斯混合模型EM算法Matlab代码
- 实现了基于混合高斯模型的背景减除
- EM算法估计GMM
- gmm matlab 代码
- GMM Libraries for Matlab
- GMM-matlab
- 高斯混合模型matlab实现
- 混合高斯建模加meanshift算法matlab代码
- GMM代码用于目标检测
- GMM的matlab实现集合
- GMM模型,用MATlab编写的。可以用来训
- EM算法训练GMM的聚类函数vq_flat看评论
- 高斯混合模型GMM 及高斯混合回归MAT
- matlab写的GMM代码
- GMM 混合高斯背景建模
- 声纹识别
- GMMP SkinColor
- 高斯混合模型(GMM)
- GMM-UBM系统框架的MAP算法
- GMM,HMM的语音识别,说话人识别源码
- GMM GMM的说话人识别系统
- GMM 本代码建立高斯混合模型(高斯多
- MFCC-GMM 基于MFCC的GMM的说话人识别
- speech-emotion-recognition-system gmm模型下的
- GMMsegmation
- GMM 做毕设是用到的gmm的matlab程序
- Voice_Conversion_1 基于GMM模型实现语音转
- clustering 使用K-means
评论
共有 条评论