## 2 Materials and Methods--Porosity Classification and Fracture Identification
### Dataset Specification and Pre-Processing  
In this study, we focus on image analysis of the rock images samples to automatically arrive at a conclusion on the type of pores or fractures instead of the quantitative petrophysical method. Thus, we will not work on overall petrography analysis but only its segment related to image analysis. The pore/fracture space component classification is based on a microscopic study from peninsular Malaysia in Kinta Valley, Perak. The pore types include mouldic, intraparticle,interparticle, fractured and vuggy porosity. The initial observation indicated that the pore system is isolated in nature. From the perspective of visual image analysis, in most cases, the shape and size of the micro-pores and fractures were highly irregular in shape. In contrast, our techniques showed fractures to be near linear (i.e., length is bigger than width). They were also found to be well cemented. Fractures were found to be enlarged by solution activity or can be healed by secondary calcite or sparite. Based on the previous experience, in general, we found the lengths of the fractures are much greater than their widths. The shape variations of a fracture from that of the circles and ellipses of same perimeter are found much greater than that of the pores. On the contrary, as expected the shapes of the pores were found to be spherical or near-spherical, and in general, their sizes are relatively smaller than those of the fractures but still irregular in shape from the computer vision context. Further, the image data generated in the current work shows limited divergence among most of the samples, i.e., the visual quality of most of the samples is found to be very similar. Low divergence samples have been identified as a major problem for the existing deep learning methodologies in the presence of a small number of grayscale image samples with low divergence, especially in the case of the current image samples. Optical thin section and Scanning Electron Microscopy (SEM) images were used to characterize and describe the different components and structures within the carbonate rock. Before diving into details of the proposed algorithm, we would like to discuss the specification of the rock image samples used in the current study to understand its utility more clearly. We used the CT-scan images of a carbonate rock slab of length 256 mm, breadth 1 mm, and width 1 mm taken at every 1 mm height in all _xy_, _yz_ and _zx_ planes (see Figure 2). We call every image a micro-image. Hence, the image data set contains a total of 256 \(\times\) 3 number of micro-images of varying numbers of pixels, which are then resized to fixed 1280 \(\times\) 1064 square pixels, where each pixel area is approximately limited to 4.4 \(\upmu\)m\({}^{2}\), and one micro-image creates a field view of 1 \(\times\) 1 mm. The spectral noise of the collected CT-scan image samples was reduced using a median filter, and the contrast between features was enhanced with a linear contrast stretch. Most of the individual sample micro-images look very similar (see Figure 2). This observed high visual similarity among various sample micro-images is due to the small size of the sample carbonate rock slab (256 mm) considered during CT-scan imaging. High visual variations among the sample micro-images can be experienced if the chosen size of the rock sample is larger (at least around a couple of meters). Further qualitative analysis of each 3 arbitrary planes (_xy_, _yz_ and _zx_ ) shows that some of the individual pores are large and isolated. All the images are in grayscale with an average pixel intensity of 101/image. Each pixel in a grayscale image represents only the amount of light or the intensity information. Grayscale images are a kind of black-and-white or gray monochrome that is composed exclusively of shades of gray. The subsequent values are respectively calculated as 50, 120 and 255 (see Section 2.1). Based on the computed values, we classify every individual pixel using Algorithm 1.