how to find the length and width of connected components
Mostrar comentarios más antiguos
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 comentarios
darova
el 25 de Mzo. de 2020
Can you show something? Hard to suggest something without a picture
QuestionsAccount
el 26 de Mzo. de 2020
Respuestas (2)
darova
el 26 de Mzo. de 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 comentarios
QuestionsAccount
el 27 de Mzo. de 2020
QuestionsAccount
el 27 de Mzo. de 2020
darova
el 27 de Mzo. de 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
el 29 de Mzo. de 2020
darova
el 29 de Mzo. de 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
el 2 de Abr. de 2020
darova
el 2 de Abr. de 2020
have no idea :(
Image Analyst
el 18 de Jun. de 2020
0 votos
Try bwareafilt().
Categorías
Más información sobre Labeling, Segmentation, and Detection en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!