我想使用GMM(高斯混合模型来聚类二进制图像,并且还想在二进制图像本身上绘制聚类质心).
我使用它作为我的参考:http: //in.mathworks.com/help/stats/gaussian-mixture-models.html
这是我的初始代码
I=im2double(imread('sil10001.pbm'));
K = I(:);
mu=mean(K);
sigma=std(K);
P=normpdf(K, mu, sigma);
Z = norminv(P,mu,sigma);
X = mvnrnd(mu,sigma,1110);
X=reshape(X,111,10);
scatter(X(:,1),X(:,2),10,'ko');
options = statset('Display','final');
gm = fitgmdist(X,2,'Options',options);
idx = cluster(gm,X);
cluster1 = (idx == 1);
cluster2 = (idx == 2);
scatter(X(cluster1,1),X(cluster1,2),10,'r+');
hold on
scatter(X(cluster2,1),X(cluster2,2),10,'bo');
hold off
legend('Cluster 1','Cluster 2','Location','NW')
P = posterior(gm,X);
scatter(X(cluster1,1),X(cluster1,2),10,P(cluster1,1),'+')
hold on
scatter(X(cluster2,1),X(cluster2,2),10,P(cluster2,1),'o')
hold off
legend('Cluster 1','Cluster 2','Location','NW')
clrmap = jet(80); colormap(clrmap(9:72,:))
ylabel(colorbar,'Component 1 Posterior Probability')
Run Code Online (Sandbox Code Playgroud)
但问题是我无法在主二进制图像中绘制从GMM接收的聚类质心.我该怎么做?
**现在假设我有一个序列中的10个这样的图像我想将它们的平均位置的信息存储在两个单元格数组中然后我该怎么做.这是我的代码我的新问题**
images=load('gait2go.mat');%load the matrix file
for i=1:10
I{i}=images.result{i}; …
Run Code Online (Sandbox Code Playgroud) matlab classification cluster-analysis machine-learning mixture-model