image segmentation using K-means
From
Hisoka 2015@21:1/5 to
All on Sun Aug 2 11:04:44 2020
Hello,
I want to do segmentation of iris (graylevel) using K-means algorithm.Here my code:
ab=imread('iris.tiff')
ab = double(ab);
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,1);
nColors=2
%repeat the clustering 3 times to avoid local minima
[cluster_idx, cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', 'Replicates', 3);
pixel_labels = reshape(cluster_idx,nrows,ncols);
pixel_labels=pixel_labels-1
the obtained segmentation image : pixel_labels gives diferrent value in each compilation of code..Can someone help me to resolve this issue?
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)