
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

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.darlak@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

Le samedi 22 janvier 2022, pawel.darlak@gmail.com a écrit :
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 ?
Hi, you should give scikit-image (https://scikit-image.org/) a try! It has many features for objects detection and labelling, see for instance the following examples Label Image regions : https://scikit-image.org/docs/dev/auto_examples/segmentation/plot_label.html... Blob detection : https://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob... Measure region properties : https://scikit-image.org/docs/dev/auto_examples/segmentation/plot_regionprop... Fabrice
participants (3)
-
Fabrice Silva
-
pawel.darlak@gmail.com
-
Stefan van der Walt