フィルターのクリア

how to merge centroids?

2 ビュー (過去 30 日間)
Keane Athallah
Keane Athallah 2022 年 5 月 25 日
コメント済み: Keane Athallah 2022 年 5 月 26 日
how can i merge centroid on top right corner?
if the centroids of any pair are closer than a certain amount
  3 件のコメント
Keane Athallah
Keane Athallah 2022 年 5 月 26 日
stats = regionprops(bw2);
s = regionprops(bw2, 'centroid');
C = cat(1, s.Centroid);
hold on
plot(C(:,1), C(:,2), 'b*')
hold off
D = pdist2(C(:,1),C(:,2),'euclidean','Smallest',2)
figure; imshow(P); hold on;
for i = 1 : length(stats)
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)
end
title(sprintf('Jumlah Tumbuhan %d', length(stats)));
Keane Athallah
Keane Athallah 2022 年 5 月 26 日
that is my code for finding the centroid, i dont know how to combine the 2 centroid if they were close enough.

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2022 年 5 月 26 日
You have the coordinates of centroid, you can use knnsearch to get the nearest neighbors.
  1 件のコメント
Keane Athallah
Keane Athallah 2022 年 5 月 26 日
can you please explain it?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by