Pore size distribution chart
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I need some assistance here...
I would love to know how do you create a distribution chart based on size and number (amount) of the pores.
Thank you!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273352/image.jpeg)
2 commentaires
Réponse acceptée
darova
le 25 Fév 2020
Modifié(e) : darova
le 25 Fév 2020
Use regionprops
I = imread('image.jpeg');
I1 = im2bw(I); % binarize image
cc = bwconncomp(I1); % or 'bwlabel' to separate each region
stats = regionprops(cc, 'Area'); % calculate area of each separate region
area = cat(1,stats.Area);
area(area>500) = []; % filter bigger blobs/regions
hist(area,20) % histogram of 20 groups
xlabel('size')
ylabel('number')
result
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273551/image.png)
7 commentaires
darova
le 25 Fév 2020
Sorry, forgot this line
area = cat(1,stats.Area);
I correct the code. Look
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!