## 2 Materials and Methods
### Digital Processing of the Metallographic Image Using the Phase Congruency Method  
Digital image processing involves a set of computer algorithms that is applied to digital images with the aim of processing, visualizing, and improving their quality. By applying digital image processing methods, it is possible to extract key features describing the texture of an image for further processing [24]. According to [25; 26], phase congruence in terms of Fourier series provides an efficient characterization of digital images through the application of different filters and is expressed as shown in Equation (1). \[PC(x)=max_{\overline{\varphi}(x)e[0,2\pi]}\frac{\sum_{n}A_{n}cos\big{(}\phi_{n} (x)-\overline{\phi}(x)\big{)}}{\Sigma_{n}A_{n}} \tag{1}\]  
where \(A_{n}\) represents the amplitude of the \(n\) Fourier component. \(\phi_{n}(x)\) is the local phase of the Fourier component at position \(x\). \(\overline{\phi}(x)\) represents the angle-weighted average amplitude of the local phase of all Fourier terms; see Figure 2. On the other hand, the local energy function is defined in Equation (2):  
\[E(x)=\sqrt{F(x)^{2}+H(x)^{2}} \tag{2}\]  
where F(x) is the luminance signal I(x) with its congruency difference component removed, and H(x) is the transform of F(x), with a phase increment of 90 degrees. In [27; 28; 29], it shown that employing logarithmic Gabor filters are extremely useful for image rendering. In the present study, the logarithmic filter functions are employed using a Gaussian transfer function, as suggested by [30]. Therefore, the response vector for each of the filter pairs is determined through Equation (3). As mentioned above, \(I(x)\) represents the luminance signal, and \(M_{n}^{\sigma}\) and \(M_{n}^{\sigma}\) symbolize the even (cosine) and odd (sine) symmetric wavelets at scale n, respectively; therefore, the results of each quadrature filter pair constitute a response vector. The wavelet amplitude transforms at a given scale for each component \(n\) and is defined in Equation (3). \[A_{n}(x)=\sqrt{\left(I(x)*\ M_{n}^{\sigma}\right)^{2}+\left(I(x)*\ M_{n}^{ \sigma}\right)^{2}} \tag{3}\]  
The phase is determined by Equation (4). \[\phi_{n}(x)=atan2(I(x)*\ M_{n}^{\sigma},\ I(x)*\ M_{n}^{\sigma}) \tag{4}\]  
At each point \(x\) of any signal, a matrix of response vectors generates one vector for each filter scale. These response vectors form the localized representation of the signal and are used in the same way as the Fourier components to estimate the phase congruency. The construction of the wavelet filter bank should ensure that the transfer function of each filter overlaps sufficiently with its neighbors so that the sum of all the transfer functions forms a uniform coverage of the spectrum. Care should be taken to preserve a wide range of frequencies in the signal, because phase congruency is only significant when it occurs over a wide range of frequencies. On the other hand, \(F(x)\) can be estimated by summing the convolutions of the even filters using Equation (5). Similarly, \(H(x)\) can calculated from the convolutions of the odd filters using Equation (6). \[F(x)=\sum_{n}I(x)*\ M_{n}^{\sigma} \tag{5}\]  
\[H(x)=\sum_{n}I(x)*\ M_{n}^{\sigma} \tag{6}\]  
The sum of the amplitudes of the frequency components in F(x) is determined using Equation (7). \[\sum_{m}A_{n}(x)=\sum_{m}\sqrt{\left(I(x)*\ M_{n}^{\sigma}\right)^{2}+\left(I( x)*\ M_{n}^{\sigma}\right)^{2}} \tag{7}\]  
It is of vital importance to consider that phase congruency can compromised due to noise present in the input signal. The incidence of noise in the calculation of \(E(x)\)  
Figure 2: Polar diagram of the components of Fourier series at a point in a signal. can be deduced under the following conditions: the image noise is additive; the noise power spectrum is constant; and the features originate only in isolated areas of an image. The energy is the magnitude of a vector sum. If the noise exhibits Gaussian behavior with random phase, each vector of this sum will consist of two normally distributed independent variables.