I have a binary image which is composed of black grains and white porosity. I have been using a macro which divides the image into grids and calculates the porosity in each grid by obtaining the number of black (= 0) and white (= 255) pixels in each grid. I am trying to analyse how porosity changes across the image.

I have encountered a fundamental issue which I can’t seem to find the answer to, which is what grid size should I use to sample the image? I need the grid to be small enough to be able to construct a high-resolution porosity map of the image later in Matlab but not so small so that the grid is sampling only black grains or white porosity and therefore the squares are not representative of the overall sample porosity.

I have looked at using the Nyquist Sampling Theorem but this is not really applicable to what I’m trying to do. I was wondering if there is any quantitative way of determining the most appropriate grid size to use, whereby I can get an good idea of how the porosity varies across the sample, without the grids being too small meaning that each one is unrepresentative of the overall sample porosity, but also not too big so that resolution is lost.

Any help or ideas would be greatly appreciated.