Borrar filtros
Borrar filtros

Clustering coordinates on image

1 visualización (últimos 30 días)
jg
jg el 17 de Abr. de 2020
Comentada: jg el 19 de Abr. de 2020
How would i cluster these points so that i am left wth 4 sets of coordinates in a 4 by 2 matrix currently it returns a 13 by 2.
This is the returned matrix.
centers =
16.5000 9.0000
8.5000 29.0000
423.0000 29.0000
18.5000 33.0000
30.0000 35.0000
448.5000 35.0000
431.5000 36.5000
37.5000 45.5000
456.5000 435.0000
43.5000 450.0000
426.5000 450.0000
445.0000 457.5000
439.5000 469.0000

Respuesta aceptada

Image Analyst
Image Analyst el 17 de Abr. de 2020
Try this:
centers =[...
16.5000 9.0000
8.5000 29.0000
423.0000 29.0000
18.5000 33.0000
30.0000 35.0000
448.5000 35.0000
431.5000 36.5000
37.5000 45.5000
456.5000 435.0000
43.5000 450.0000
426.5000 450.0000
445.0000 457.5000
439.5000 469.0000];
subplot(1, 2, 1);
plot(centers(:, 2), centers(:, 1), 'r+', 'MarkerSize', 9, 'LineWidth', 2);
[indexes, centroids] = kmeans(centers, 4)
axis ij; % Flip axis direction.
grid on;
subplot(1, 2, 2);
gscatter(centers(:, 2), centers(:, 1), indexes);
axis ij; % Flip axis direction.
grid on;
% Put a big circle at the centroid
hold on;
plot(centroids(:, 2), centroids(:, 1), 'bo', 'MarkerSize', 30, 'LineWidth', 2);
You now have 4 clusters.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by