I got 3 square cluster from 12 (x,y) points. How can I find out which points it is taking for making the clusters?
Mostrar comentarios más antiguos
Hi, I have gotten 12 points from the images. Then I ran the cluster program for those points. My cluster program is below:
X = [112 161;154 166;107 214;149 218;179 277;163 284;188 300;172 307;268 314;241 323;273 340;246 349]
D= pdist(X)
P=squareform (D)
Z= linkage (D)
T = cluster(Z,'maxclust',3)
Q= sprintf('X(i,1),X(i,2)');
axis ([0 700 0 540])
figure
for i=1:12
if T(i)==1
axis ([0 700 0 540])
plot (X(i,1),X(i,2),'Marker','p','Color', ('green'),'MarkerSize',20);
Q= sprintf('X(i,1),X(i,2)');
hold on;
end
if T(i)==2
axis ([0 700 0 540])
plot (X(i,1),X(i,2),'Marker','p','Color', ('red'),'MarkerSize',20);
hold on;
end
if T(i)==3
axis ([0 700 0 540])
plot (X(i,1),X(i,2),'Marker','p','Color', ('blue'),'MarkerSize',20);
hold on;
end
end
disp(Q);
Here X is the 12 points. After doing this it is making perfect 3 squares for every T(i). I gave the instruction to show the every (X(i,1),X(i,2) as Q. By this I could find out the exact 4 points of each and every squares. But unfortunately it is not showing those 4 points of each squares it is taking from X.
Can anyone help me that how can I see the 4 points of the squares it is taking from the 12 points? And how can I named them as square 1, square 2 and square 3?
Thanks in advanced.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Color Segmentation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!