# Efficient and Accurate Hemorrhages Detection in Retinal Fundus Images Using Smart Window Features
## 2 Materials and Methods
### Brightness and Contrast Enhancement  
To increase the contrast of color channels, contrast-limited adaptive histogram equalization (CLAHE) [25] is used. A sample of enhanced images is depicted in Figure 3c. Image brightness is adjusted using an adaptive gamma correction technique [26; 27]. Gamma  
Figure 2: Block diagram depicting the proposed method. correction method is obtained by using adaptive parameter \(\gamma\)[28]. The conventional transform-based gamma correction is given by:  
\[V(p)=P_{max}\bigg{(}\frac{p}{P_{max}}\bigg{)}^{\gamma} \tag{1}\]  
where \(P\in\{\ 0,P_{max}\}\), and \(P_{max}\) is the maximum gray-value of the image, \(\gamma\) is the correct parameter. Reference [26] obtained the gamma value based on an improved cumulative density function (CDF). The improved CDF produced a good result; however, images are over-enhanced (which may result in loss of vital information). The gamma in the range \(\gamma<1\) is used to brighten the dark regions. To create an adjustment that can withstand low light images, we obtain gamma value using Sobel operator given by:  
\[\gamma=1-S_{b} \tag{2}\]  
\[S_{b}=\left|R_{x}\right|+\left|R_{y}\right|\dots\text{with an angle of orientation }\theta=\arctan\bigg{(}\frac{R_{y}}{R_{x}}\bigg{)} \tag{3}\]  
where \(R_{x}\) and \(R_{y}\) are gradient in \(x\) and \(y\) directions. The gamma value is applied to the individual color channel, as shown in Figure 3. The graph in Figure 3b explains the brightness correction for different values of gamma. The experiment suggests that images in the green channel provide better quality for the retinal component; hence images in the green channel are adopted for this study [29]. Image sharpening is the inverse method of image blurriness. The blurred image does not contain meaningful texture and edge information, thus show low quality. The purpose of image sharpening is to make objects clear. Linear image sharpening techniques are proven adequate for many applications, but they are more susceptible to noise. The non-linear techniques preserve the edges and image information efficiently. This research used fuzzy logic-based non-linear unsharp masking [30] to refine the blurriness of fundus photographs. The benefit of adopting fuzzy logic is to enhance the edges and sharpen the smooth areas. In addition, it can better deal with noise by controlling the parameter \(\lambda\), due to the physical randomness of the image acquisition system. The method computes the fuzzy relationship between the intensities of the focused pixel and its neighbor in a moving window (W) of size \(3\times 3\). Figure 3: _Cont._  
For each pixel \(u\) in image \(I\), the intensity value \(I(u)\) obtained in Equation (4) is adjusted linearly with a high pass filter \(h(u)\), defined as follows:  
\[P(u)=I(u)\ +\ \lambda V_{1}(u) \tag{4}\]  
where \(\lambda\) is a constant, and  
\[V_{1}(u,\ v)=\frac{1}{N}\sum_{x(r,s)\in W}[x(u,v)-x(r,s)]\mu_{s}((u,v),\ x(r,s)) \tag{5}\]  
\[\mu_{s}(i,\ j)\ =\ \left\{ \begin{array}{c}0,\ |i-j|<a\\ \frac{b(|i-j|-a)}{|i-j|(b-a)},\ a\leq\ |i-j|\ <b\\ \\ 1,\ b\leq\ |i-j|\ <c\\ \\ \frac{c}{|i-j|},\ |i-j|\ \geq c,\\ \end{array} \right. \tag{6}\]  
\(\mu_{s}\) is the parameterized membership function that analyzes the intensity difference between two pixels, \(V_{1}\) is the output of the pseudo-high-pass filter, \(W\) is a set of neighboring pixel \(N\) around \(x(u,v)\), and a, b, c are parameters. In this work, the parameter function \(\mu_{s}\) classifies the intensity difference into four levels through parameters \(a,\ b,\ \text{and}\ c\ (0<a<b<c)\). The intensity difference in the range \(|i-j|\ \leq a\) is considered noise that does not contribute to the membership function. The difference in the range \(a\ \leq\ |i-j|<b\) yields the strong sharpening effect to highlight image details. The sharpening effect is limited when the difference follows the range \(b\ \leq\ |i-j|<c\). Previous experiments suggested that when the values \(a,\ b,\ \text{and}\ c\), are set to 2, 5, and 50, respectively, they provide effective results.