how to find the length and width of connected components

2 次查看(过去 30 天)
hi everyone.
i want to know how to find the length and width of connected components as i already label the connected components using bwlabel and draw the boundries using regionprops and boundry but now the only thing i need to know is how to find the length and width of that drawn boundries(connected components). as i want to seprate those regions that have length and width equall to humans.
  2 个评论
darova
darova 2020-3-25
Can you show something? Hard to suggest something without a picture
QuestionsAccount
QuestionsAccount 2020-3-26
thanx for ur reply i solved that problem.
now i need to know how to "remove/separate the big connected regions from binary image", as i already label the connected components using bwlabel and draw the Bounding Boxes around connected components using regionprops and BoundingBox but the only thing i need to know is how to "remove/separate the big connected regions" as i want to seprate those regions that have length and width equall to humans from big regions.
Note: I don't want to use length and width constraints for doing the above thing neither i want to use area (blobmeasurments.area) for doing this. If you know some kind of algorithm for doing the above mention work then kindly share it will be very helpfull for me thanx. (please don't mention the built in matlab functions, as i need complete method for doing this, so plz give/suggest me an algorithm that i can apply for doing this).

请先登录,再进行评论。

回答(2 个)

darova
darova 2020-3-26
Use regionprops
If you used bwlabel, can't you just separate?
[L,n] = bwlabel(image);
data = regionprops(L,'area');
area = cat(1,data.Area);
[~,ix] = sort(area,'descend');
imshow(L==ix(1)) % show biggest region
pause(1)
imshow(L==ix(2)) % show second biggest region
  7 个评论
QuestionsAccount
QuestionsAccount 2020-4-2
i already used the graythersh in preprocessing steps now the problem which i m facing was abave that i mentioned i know Kmeans algo but using that i m only able to make clusters like connected components but how can i seprate big and small clusters without any thershold or fix value?

请先登录,再进行评论。


Image Analyst
Image Analyst 2020-6-18
Try bwareafilt().

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by