## 3 Materials and Methods
### Methods Used  
To precisely assess porosity using digital rock volume measurements, it is crucial to optimize existing methods and identify the most resilient approach that aligns with our specific dataset. The image processing and segmentation algorithms used in this paper are described below. Figure 4: Set 2 of the rock samples. Figure 5: The samples used for low- and high-resolution scanning. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Reservoir Type** & **Reservoir Name** & **Sample Name** & **Porosity (\%)** & **Permeability (mD)** \\ \hline Deep saline & Syderial & S3 & 16 & 246 \\ aquifer & Vaskai & V4 & 22 & 1309 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Petrophysical properties of the rock samples of set 2. _Contrast Adjustment:_ Image quality was enhanced through contrast adjustments using the Contrast Limited Adaptive Histogram Equalization (CLAHE) method. This technique divides the image into small, overlapping tiles and applies histogram equalization independently within each tile. CLAHE's adaptive nature ensures localized contrast enhancements, preserving relative contrasts across different image regions. To prevent noise amplification in low-contrast areas, CLAHE employs a contrast limiting parameter, restricting the maximum enhancement per tile. Pixels exceeding this limit are redistributed to prevent excessive amplification. After equalization, tiles are merged to produce the final enhanced image [31; 32]. _Image Segmentation:_ After contrast adjustment, segmentation was performed to segregate the pore space from grains. The k-means unsupervised machine learning algorithm is used to segment the images into different elements and has proven to be an efficient method for image segmentation [25; 33; 34]. K-means is a clustering algorithm that assumes 'k' number of clusters based on the objective and initializes 'k' centroids, assigning one centroid to each cluster. It then groups elements into different clusters on the basis of their proximity to the nearest centroid. This distance is calculated using the Euclidean distance, defined in Equation (1) [35]. \[Z=\sum\
olimits_{i=1}^{n}\sum\
olimits_{j=1}^{k}\|x^{(i)}-C_{j}\|^{2} \tag{1}\]  
where \(\|x^{(i)}-C_{j}\|^{2}\) is the Euclidean distance between the data point \(x^{(i)}\). K-means is an iterative procedure, where the centroids are recalculated as the mean of the elements in their respective clusters during each iteration, defined in Equation (2) [35]. This process continues until the element stops moving from one cluster to another or until a predefined convergence criteria is met. \[C_{j}=\frac{1}{n}\sum\
olimits_{i=1}^{n}x_{j}^{(i)} \tag{2}\]  
where \(n\) is the number of data points in the _jth_ cluster, and \(x_{j}^{(i)}\) is the _ith_ data point. _Flow Simulations:_ The open-source Parallel Lattice Boltzmann Solver (Palabos) software ([[https://palabos.unige.ch/](https://palabos.unige.ch/)]([https://palabos.unige.ch/](https://palabos.unige.ch/)), accessed on 12 January 2023) [36], based on the Lattice Boltzmann method (LBM), was used to perform single-phase flow simulations and to determine the permeability of the samples. When performing LBM simulations using segmented rock images, the image is divided into a regular grid or lattice of cells. Each cell in the lattice corresponds to a pixel of the image, and a node is created at the center of every pixel. Within each cell, there are discrete velocity directions or vectors that are defined. These velocities represent the possible particle motion directions within the fluid. The number of discrete velocities and their specific directions depend on the chosen LBM variant. In this paper, the D3Q19 (three dimensions with 19 velocities) lattice arrangement (Figure 6) is used [37]. At each lattice node, there are distribution functions '\(f(x,t)\)' (also known as particle distribution functions at position '\(x\)'andtime '\(t\)') associated with each velocity direction.