## 3 Materials and Methods
### Preprocessing
#### 3.2.2 Histogram-Based  
A histogram is a graphical representation that shows the frequency with which a certain intensity appears in an image, i.e., it represents the number of pixels of each intensity in an image. On the X-axis is usually placed the intensity of the pixels while on the Y-axis the frequency with which the pixels appear. The intensity level usually ranges from 0 to 255. For a grayscale image, there is only one histogram, while an RGB color image will have three histograms, one for each color. The methods in this section are based on applying a transformation on the image, so that the histograms acquire a uniform distribution. This type of transformation is used to improve the contrast of the images [55]. 1. **Histogram Equalization (HE). ** Histogram equalization is one of the most common ways to enhance the contrast of an image. This is because it is easy to implement and does not require too many computational resources. It is performed by mapping the gray levels of the image based on the probability distribution of the input gray levels. The detailed procedure can be found at [56]. However, one of the main problems it presents is that it tends to change the brightness of the image significantly and therefore causes the output image to be saturated with very bright or dark intensity values. 2. **Constrast Limited Histogram Equalization (CLAHE). ** Conventional histogram equalization considers the overall contrast of the image. In many cases, it is not a good idea because when the histogram presents a distribution that is concentrated in a range, it does not work properly [57]. To solve this problem, adaptive histogram equalization is used, which is carried out as follows. First, the image is divided into small blocks of a predefined size. Then, each of these blocks is histogram equalized as in the previous section. So in an area, the histogram will be limited to a small region unless there is noise in which case it will be amplified. To avoid this behavior of the algorithm, contrast limiting is applied. If any bin in the histogram is above a certain contrast threshold, those pixels are clipped and evenly distributed to other bins before equalization is applied. Then, to remove edge artifacts, bilinear interpolation is applied. The default parameters offered by the OpenCV library for this method have been used, namely: clipLimit = 2.0, tileGridSize = (8,8). \begin{table}
\begin{tabular}{c c c c} \hline \hline Blur & \(\begin{pmatrix}1&1&1&1&1\\ 1&0&0&0&1\\ 1&0&0&0&1\\ 1&0&0&0&1\\ 1&1&1&1&1&1\end{pmatrix}\) \\ \hline Contour & \(\begin{pmatrix}-1&-1&-1\\ -1&8&-1\\ -1&-1&-1\end{pmatrix}\) \\ \hline Detail & \(\begin{pmatrix}0&-1&0\\ -1&10&-1\\ 0&-1&0\end{pmatrix}\) \\ \hline Edge Enhance & \(\begin{pmatrix}-1&-1&-1\\ -1&10&-1\\ -1&-1&-1\end{pmatrix}\) \\ \hline Edge Enhance More & \(\begin{pmatrix}-1&-1&-1\\ -1&9&-1\\ -1&-1&-1\end{pmatrix}\) \\ \hline Sharpen & \(\begin{pmatrix}-2&-2&-2\\ -2&32&-2\\ -2&-2&-2\end{pmatrix}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Convolution Kernel Matrices. 3. **Fuzzy Histogram Equalization (FHE). ** To perform contrast enhancement of the images by means of fuzzy histogram equalization, the gray level intensities of the image are mapped to a fuzzy space using membership functions to enhance the contrast [58]. Then the fuzzy plane is mapped to the gray intensities of the image. This process is intended to obtain an image with better contrast than the original image by giving more importance to the gray levels that are closer to the mean than to those that are farther away. Fuzzy image processing consists of three stages: fuzzification, membership plane operations, and defuzzification. The first stage consists of assigning certain membership values to the images based on some attributes of the images such as brightness, homogeneity, etc. Then, using a fuzzy approach, the membership values assigned in the first stage are modified.