how to find the length and width of connected components
Afficher commentaires plus anciens
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 commentaires
darova
le 25 Mar 2020
Can you show something? Hard to suggest something without a picture
QuestionsAccount
le 26 Mar 2020
Réponses (2)
darova
le 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 commentaires
QuestionsAccount
le 27 Mar 2020
QuestionsAccount
le 27 Mar 2020
darova
le 27 Mar 2020
- please explain ,me this line [~,ix] = sort(area,'descend');
array area has number of pixels (area) of each region. sort just sorts it in descent order (biggest first, smallest last)
You can remove a few region using for loop
for i = [1 2 4] % regions to remove
L(L==ix(i))=0;
end
- But again my Question was same because i don't want to use area constraints
Can you attach some images and show what are you trying to do?
QuestionsAccount
le 29 Mar 2020
darova
le 29 Mar 2020
- without giving any thershold value for this classification of big and small regions
Do your images differs a lot? You can try graythresh
I1 = im2bw(I,graythresh(I)); % binarization using mean theshold
I also heard something about kmeans (clustering) but dont know how it works
QuestionsAccount
le 2 Avr 2020
darova
le 2 Avr 2020
have no idea :(
Image Analyst
le 18 Juin 2020
0 votes
Try bwareafilt().
Catégories
En savoir plus sur Labeling, Segmentation, and Detection dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!