parameters estimation using k-means

1 visualizzazione (ultimi 30 giorni)
thoraya
thoraya il 3 Lug 2012
hi l have an image which is divided in two clusters Co:pixels of objects and Cf pixels of background. l(y|x) is likelihood of observations y conditional on a configuration x. the L(y|x) expression is modeled as a mixture of two Gaussian. i want to estimate the mean mu and the standard deviation sigma of each classes using the k-means algorithm in two clusters. how to code this ? can anyone help me please ?? thanks in advance

Risposte (1)

Ilya
Ilya il 4 Lug 2012
I don't follow. k-means is used for non-parametric clustering of data. If your data are already clustered, you can use functions mean and std to compute the mean and standard deviation. If you need to cluster your data assuming a mixture of Gaussians, you can use gmdistribution from the Statistics Toolbox.
  4 Commenti
thoraya
thoraya il 5 Lug 2012
hi llya i tried to use kmeans function, but it doesn't work. the code is as follows.it was inspired by Color-Based Segmentation Using K-Means Clustering X = imread('cour.png'); nrows = size(X,1); ncols = size(X,2); X = reshape(X,nrows*ncols,1);
nColors = 2; % repeat the clustering 3 times to avoid local minima [cluster_idx cluster_center] = kmeans(X,nColors,'distance','sqEuclidean', ... 'Replicates',2); pixel_labels = reshape(cluster_idx,nrows,ncols); imshow(pixel_labels,[]), title('image labeled by cluster index'); I could not find the problem.
Ilya
Ilya il 5 Lug 2012
No one could find the problem based on the info you posted. Explain clearly what "doesn't work" means. I would also recommend starting a new thread.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by