필터 지우기
필터 지우기

How can I find the centroids of closely seperated object?

조회 수: 1 (최근 30일)
Bipul Biswas
Bipul Biswas 2021년 8월 23일
댓글: Bipul Biswas 2021년 8월 23일
In the left pannel, I have four obejct, they are close but separated. I am using the " regionprops( image ,'Area','BoundingBox', 'Centroid') but in return I am getting only one centriods. I need each object's centroids. Can you please help me with it?
  댓글 수: 2
DGM
DGM 2021년 8월 23일
Please attach a copy of the actual image you're using.
Bipul Biswas
Bipul Biswas 2021년 8월 23일
편집: Bipul Biswas 2021년 8월 23일
Thanks for the message.
This is the original image.
Left pannel is the dark part of the partilces and right pannel is the bright part of the partilces (Top Figure). I need the centroids of both dark and black parts of each particles.

댓글을 달려면 로그인하십시오.

채택된 답변

DGM
DGM 2021년 8월 23일
편집: DGM 2021년 8월 23일
I'm going to go out on a limb here and guess that the image you're feeding to regionprops() is a numeric image instead of a logical image. If that's the case, it will assume that it's a label array (as from bwlabel()). From that assumption, it interprets all blobs as having the same label (label 1), treating them all as one object.
inpict = imread('4dot.png');
% if the image is numeric
inpict = im2double(inpict);
S = regionprops(inpict,'centroid');
C = vertcat(S.Centroid)
C = 1×2
204.0885 135.5302
% if the image is logical
inpict = inpict>0.5;
S = regionprops(inpict,'centroid');
C = vertcat(S.Centroid)
C = 4×2
166.3950 106.1014 184.9957 160.6012 232.1303 97.4901 262.4825 160.1700
  댓글 수: 4
DGM
DGM 2021년 8월 23일
Given that OP is dividing the objects into two regions, I was under the impression that the half-object centroids was more important than the centroid of each round object.
Bipul Biswas
Bipul Biswas 2021년 8월 23일
Yes, in this case, half part's centroid is more important.
BTW, Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by