필터 지우기
필터 지우기

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