how to find the length and width of connected components

2 views (last 30 days)
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 Comments
darova
darova on 25 Mar 2020
Can you show something? Hard to suggest something without a picture
QuestionsAccount
QuestionsAccount on 26 Mar 2020
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).

Sign in to comment.

Answers (2)

darova
darova on 26 Mar 2020
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 Comments
QuestionsAccount
QuestionsAccount on 2 Apr 2020
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?

Sign in to comment.


Image Analyst
Image Analyst on 18 Jun 2020
Try bwareafilt().

Community Treasure Hunt

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

Start Hunting!