how to find the length and width of connected components
古いコメントを表示
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
2020 年 3 月 25 日
Can you show something? Hard to suggest something without a picture
QuestionsAccount
2020 年 3 月 26 日
回答 (2 件)
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
2020 年 3 月 27 日
QuestionsAccount
2020 年 3 月 27 日
darova
2020 年 3 月 27 日
- 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
2020 年 3 月 29 日
darova
2020 年 3 月 29 日
- 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
2020 年 4 月 2 日
darova
2020 年 4 月 2 日
have no idea :(
Image Analyst
2020 年 6 月 18 日
0 投票
Try bwareafilt().
カテゴリ
ヘルプ センター および File Exchange で Labeling, Segmentation, and Detection についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!