## 2 Preprocessing Method
### Histogram Equalization  
Histogram equalization (HE) is used to obtain contrast-enhanced images by generating a mapping function using the histogram probability distribution of the input images and the cumulative distribution generated on this basis. HE can be performed appropriately only if the distribution of the pixel intensity is identical over the entire image by performing the redistribution of pixel intensity using one histogram. If a part of the image has a different distribution from the other regions, the image to which HE is applied would be distorted. In contrast to HE, which can be applied only if the distribution of pixel intensity is identical in the entire image, adaptive histogram equalization (AHE) [10] divides an image into multiple parts using a grid and applies HE to each sub-image. Therefore, this method is suitable for adjusting the local contrast of an image because the image contrast within a given grid is improved. However, AHE has the disadvantage of generating a large peak (that is, an amplified noise), even if there is a noise that shows an extremely small difference from the other regions when the pixel intensities in a random grid are concentrated in an extremely small region because the pixel intensities in that region are spread to a large region. CLAHE is a variant of AHE that applies limitations to contrast to solve the noise amplification problem of AHE [11]. It redistributes pixels above a specific height by applying a limitation to the histogram height before calculating the cumulative distribution  
The nonlocal means (NLM) algorithm [14] reduces noise by performing a weighted average of pixel values. Images are defined over a discrete regular grid \(\Omega\) of dimension \(d\) and cardinality \(|\Omega|\). \(v\) denotes the original image, the value of the restored image \(u\) at a site \(s\in\Omega\) is defined as the convex combination  
\[u(s)=\frac{1}{Z(s)}\sum\limits_{t\in\mathcal{N}(s)}w(s,\ t)v(t) \tag{1}\]  
where \(w(\,\ )\) are non-negative weights, \(Z(s)\) is a normalization constant such that for any site \(s\) we have \(Z(s)=\sum\limits_{t\in\mathcal{N}(s)}w(s,\ t)\), and \(\mathcal{N}(s)\) corresponds to a set of neighboring sites of \(s\). \(w(s,\ t)\) is the weight for each region, at sites \(s\) and \(t\). The weight for each region can be expressed as follows [14,15]:  
\[w(s,\ t)=g_{h}\Bigg{(}\sum\limits_{\delta\in\Delta}G_{\sigma}(\delta)(v(s+ \delta)-v(t+\delta))^{2}\Bigg{)} \tag{2}\]  
In Equation (2), \(G_{\sigma}\) represents a Gaussian distribution in the \(\sigma^{2}\) size, \(g_{h}:\mathbb{R}^{+}\rightarrow\mathbb{R}^{+}\) is a continuous non-increasing function with \(g_{h}(x)=e^{-\frac{x^{2}}{h^{2}}}\), and \(\Delta\) represents the discrete patch region containing the neighboring sites \(\delta\). \(h\) is used to control the amount of filtering. Thus, NLM algorithm restores an image by performing a weighted average of pixel values taking into account spatial and intensity similarities between pixels. The NLM algorithm is highly effective for denoising but takes a considerable amount of time because it involves several calculations. Hence, several researchers have attempted to reduce the time taken by this algorithm through acceleration using a GPU and improving the algorithm. Therefore, the process of calculating the weight \(w(s,\ t)\), which requires a considerable amount of time in the NLM algorithm, was changed from 2D to 1D, and the calculation was performed with a precalculated value. Given a translation vector \(d_{x}\), a new image \(S_{d_{x}}\) can be expressed as follows [15]:  
\[S_{d_{x}}(p)=\sum\limits_{k=0}^{p}(v(k)-v(k+d_{x}))^{2},\ \ \ p\in\Omega \tag{3}\]  
\(S_{d_{x}}\) corresponds to the discrete integration of the squared difference of the image \(v\) and its translation by \(d_{x}\). Under 1D assumption \(\Omega\) is \(\Omega=[0,\ n-1]\), an image with \(n\) pixels. In 1D, patches of the form \(\Delta=[-P,\ P]\)are used to compute the weight for two pixels \(s\) and \(t\).