Hi Pawel,

I would recommend scikit-image for these types of analysis. Here's a start:

---

from skimage import io, measure
import numpy as np

image = io.imread('disc.png')
thresholded = image > 10
labels = measure.label(image)
regions = measure.regionprops(labels)
regions_small = [r for r in regions if r.area < 100000]

mu = np.mean([r.area for r in regions_small])
M = np.max([r.area for r in regions_small])
print(f"Mean area: {mu}")
print(f"Max area: {M}")

---

That's a pretty crude way of rejecting the background areas, and can be 
improved in various ways.  Feel free to also post to the scikit-image user 
forum at https://forum.image.sc/tag/scikit-image

Best regards,
Stéfan

On Sat, Jan 22, 2022, at 10:45, pawel.dar...@gmail.com wrote:
> Hello,
>
> I am not sure that this is correct group for my problem but I hope 
> someone can help me :)
>
> I try to analyze picture with porous material 
> (https://python.neocast.eu/disc.png). I calculate a total quantity of 
> each pores but I would like also calculate a porosity. To make I need a 
> size of sample or total pixels which are in the sample. How to do it ?
>
> thanks in advance
> Pavel
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to