Apologize for the following simple question. What exactly does the sigma data mean from the example given? The first Sigma (1,1) is the sigma for the first estimated cluster and the second sigma (2,2) is for the first estimated cluster on the second row ??

Could you please clarify? Thanks.

>> model.Sigma

ans(:,:,1) =

0.7227 0.8439
0.8439 1.8252

ans(:,:,2) =

0.2629 -0.1116
-0.1116 0.2411

ans(:,:,3) =

0.4209 -0.0600
-0.0600 0.0967

21 Sep 2010

EM_GM
An expectation maximization algorithm for learning a multi-dimensional Gaussian mixture.
Author: Patrick Tsui

When i run I get this error, Is there something else that i need to do before running this. Am running matlab 7.8.0 R2009a

>> X = zeros(600,2);
>> X(1:200,:) = normrnd(0,1,200,2);
>> X(201:400,:) = normrnd(0,2,200,2);
X(401:600,:) = normrnd(0,3,200,2);
>> [W,M,V,L] = EM_GM(X,3,[],[],1,[])
??? Cell contents reference from a non-cell array object.

Error in ==> getdim at 13
d = getdim(carray{i});

Error in ==> rand at 12
d = getdim(c);

Error in ==> randsample at 95
x(ceil(n * rand(1,k-sumx))) = 1; % sample w/replacement

Error in ==> kmeans at 321
Xsubset = X(randsample(n,floor(.1*n)),:);

Error in ==> EM_GM>Init_EM at 261
[Ci,C] = kmeans(X,k,'Start','cluster', ...

Error in ==> EM_GM at 74
[W,M,V] = Init_EM(X,k); L = 0;

Greetings Prof., Very nice .. could you please let me know what exactly does the mask variable store ? As what i see it classifies each pixel that falls within each class . Am i correct in that assumption?

Some people want to know how to view the segmented image. For example suppose you have two classes ie k=2; us the following code to view it
[row col] = size(ima);
final_img = zeros(row,col);
for i=1:row
for j=1:col
if mask(i,j)==1
final_img(i,j)=1;
else
final_img(i,j)=255;
end
end
end
imshow(final_img/255);
This is a naive way of viewing it .. you may have to change somethings if k>2. Anywayz hope it helps. The mask basically stores the segmented image.