📄 initmixture.m
字号:
function mixture = initMixture(pixels, K)
% Initialize the parameters for each class and the mixing parameters cluster(k).pb
[N M] = size(pixels);
mixture.K=K;
mixture.M=M;
R = (N-1)*cov(pixels)/N;
mixture.Rmin = mean(diag(R))/1e5;
cluster(1).N=0;
cluster(1).pb = 1/K;
cluster(1).mu = pixels(1,:)';
cluster(1).R=R+mixture.Rmin*eye(mixture.M);
if K>1
period = (N-1)/(K-1);
for k=2:K
cluster(k).N=0;
cluster(k).pb = 1/K;
cluster(k).mu = pixels(floor((k-1)*period+1),:)';
cluster(k).R=R+mixture.Rmin*eye(mixture.M);
end
end
mixture.cluster = cluster;
mixture = ClusterNormalize(mixture);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -