# Efficient and Accurate Hemorrhages Detection in Retinal Fundus Images Using Smart Window Features
## 2 Materials and Methods
### Brightness and Contrast Enhancement
#### 2.2.2 Segmentation Stage  
Hand-Crafted Image  
A common procedure to achieve good accuracy for segmentation tasks is to extract the region of interest (ROI) before segmentation. The black background is unnecessary because the hemorrhages appear at the vitreous humour of the retina. The background is illuminated to reduce the search space and achieves automation. This retinal mask is constructed by binarizing the median filter applied on the green channel of the image. The eroded mask is subtracted from the retinal mask to obtain the boundary of the retina. The image with illuminated background (Figure 4b) is used for feature extraction in subsequent steps. Seed Points of the Hemorrhage Candidates  
To extract the seed points, the Gray Level Co-Occurrence Matrix (GLCM) based local cross-entropy thresholding [29] eliminates the low response of the matched filter [31]. Then, the morphological operation isolates the objects from the blood vessels, thereby producing the seed points. Blood vessels and hemorrhages share intensity information because of their similar appearance (they look darker in comparison with the surrounded regions). Their edges are sharp when compared with other retinal structures. These features are useful for creating a matched filter that enhances the edges of the retinal structures (for details about matched filters, see [32]). The method proposed by [PERSON] et al. [29] excellently suppresses the weak response of the matched filter. Sample results of matched filter and GLCM based local cross-entropy are shown in Figure 5a,b. Figure 4: Image sharpening (**a**) non-linear unsharp masking, (**b**) hand-crafted image for feature extraction. We use mathematical morphology to analyze spatial structures. The morphological opening, erosion followed by dilation, is used to eliminate redundant objects and to break retinal structures larger than the structuring element. The size of the structuring element used in this experiment is \(11\times 11\). A sample result of morphology operation is shown in Figure 5c. The output points acted as seed/initial points for the automatic segmentation of hemorrhages. Smart Window-Based Adaptive Thresholding for Segmentation (SWAT)  
The major factor of segmentation algorithms is to locate the precise contour of an object. This task becomes easy when the region to be segmented is simplified. There should be a significant dissimilarity between surrounded regions and objects. Since hemorrhages share intensity information with other retinal structures and can be located anywhere in the retinal region, a novel smart window-based adaptive thresholding (SWAT) is proposed to segment hemorrhages. Hemorrhage inhibiting at the rim of the retina sometimes blends with a darkish background. Detecting hemorrhage that belongs to this category is a challenging task. The proposed segmentation method (SWAT algorithm) is automated with the help of a bounding box of the retinal mask (binary mask is achieved in the previous section). Then the bounding box is stretched 80 pixels wide towards each direction to achieve a sufficient search space for hemorrhage segmentation (see Figure 5d). The white portion of the image corresponds to the search region and is surrounded by the black region. In addition, we segment those hemorrhages that are attached to blood vessels. The segmentation of such hemorrhages is complicated due to the homogeneity between the two retinal  
Figure 5: Illustration of candidate extraction, (**a**) results of matched filter, (**b**) result of minimum local cross-entropy thresholding, (**c**) result of morphological opening, (**d**) search region for hemorrhages. structures. This problem is resolved by using the effectiveness value method. The higher the effectiveness value yields, the higher the degree of segmentation from its surroundings. The appropriate selection of threshold levels \(N\) imparts maximum value of effectiveness that could better segment the retinal structures from each other.