## 3 Materials and Methods
### Feature Selection
#### 3.2.3 HOG Features  
The third group of features is extracted using a histogram of orientation gradient (HOG) as a feature descriptor [43]. The basic idea of the HOG descriptor is that features within an image can be investigated through intensity derivative distribution by observing the occurrence of gradient orientation in a local image pattern. In this work, and as in [44], the RGB retinal fundus images are cropped using the central pixel coordinate and the \begin{table}
\begin{tabular}{l l l l l l l l l l} \hline \hline FOS2R & FOS2G & FOS1B & FOS2B & FOS4B & & & & \\ HOS3 Ra & HOS4 Ra & HOS5 Ga & HOS6 Ga & HOS11 Ga & HOS13 Ga & HOS6 Ba & HOS8 Ba & HOS11 Ba & HOS6 Rb \\ HOS11 Rb & HOS13 Rb & HOS14 Rb & HOS56 Sb & HOS7 Gb & HOS86 Sb & HOS10 Gb & HOS14 Ga & HOS4 Ba & HOS9 Ba \\ HOS11 Ba & HOS12 Ba & HOS3 Rc & HOS7 Rc & HOS9 Rc & HOS66c & HOS7 Gc & HOS9 Gc & HOS10 Gc \\ HOS11 Gc & HOS12 Gc & HOS1 Bc & HOS2 Bc & HOS10 Bc & HOS5 Bc & HOS1 Rd & HOS4 Rd & HOS5 Rd & HOS10 Rd \\ HOS1 Gd & HOS3 Gd & HOS5 Gd & HOS13 Gd & HOS14 Cd & HOS2 Bd & HOS7 Bd & HOS88e & HOS9 Re & HOS10 Re \\ HOS5 Ge & HOS6 Ge & HOS7 Ge & HOS8 Ge & HOS14 Ge & HOS1 Be & HOS2 Be & HOS6 Be & HOS7 Be & HOS11 Be \\ HOS1 Rf & HOS8 Rf & HOS14 Rf & HOS16f & HOS1 Bf & HOS3 Bf & HOS5 Bf & HOS1 Bf & HOS12 Bf & HOS4 Rg \\ HOS3 Bg & HOS7 Bg & HOS88B & HOS9 Bg & HOS10 Bg & HOS11 Bg & HOS12 Bg & HOS14 Bg & HOS1 Rh & HOS5 Rh \\ HOS9 Gh & HOS13 Gh & HOS1 Bf & HOS5 Bf & HOS88 Bf & & & & & \\ HOG111 & HOS112 & HOS134 & HOS135 & HOS139 & HOS146 & HOG147 & HOG149 & HOG154 & HOG155 \\ HOG161 & HOG163 & HOG165 & HOG181 & HOG182 & & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 3: A listing of the 105 features selected by GA from the original 429 features (See Section 4 for feature codes). radius size of the OD for every image to localize the region of the optic disc, OD, a region of size \(200\times 200\), from the RGB retinal image, and the cropped image is pictured in Figure 5.  
The cropped retinal fundus image is divided into smaller patterns called cells; a histogram of gradient directions for each cell is compiled separately for its entry pixels, then all histograms are concatenated for the descriptor. In more detail, the cropped RGB retinal fundus image is transformed to a gray-scale image; then, the cell size is indented using a window of size \(3\times 3\). Experimentally, filter kernels \([-1,0,1]\) and \([-1,0,1]^{T}\) are used to calculate the magnitude of the gradient orientation horizontally and vertically for each pixel within cells in the image. Let \(I(x,y)\) represents the intensity of the gray value of a pixel at a given location in image \(I\), then the horizontal gradient, \(G_{x}\), vertical gradient, \(G_{y}\), and the total magnitude of gradient \(M\), for that pixel are obtained as follows. \[G_{x}(x,y) = I(x+1,y)-I(x-1,y),\] \[G_{y}(x,y) = I(x,y+1)-I(x,y-1),\] \[M(G_{x}(x,y),G_{y}(x,y)) = \big{(}(G_{x}(x,y))^{2}+(G_{y}(x,y))^{2}\big{)}^{0.5}.\]  
On the other hand, the angle \(\theta\), representing the orientation, is given by  
\[\theta=\tan^{-1}\bigg{(}\frac{G_{y}(x,y)}{G_{x}(x,y)}\bigg{)}.\]  
The magnitude and orientation values for each pixel in the image are used to construct the histogram. A weighted vote for each pixel in the cell is computed for the orientation, Herein, 9 histogram bins are used where the histogram channel is ultimately expanded over degrees from \(0^{\circ}\) to \(180^{\circ}\). Spatially, cells are grouped as connected patches or blocks. Afterwards, normalization using the L2 norm is carried out. To illustrate, let \(\mathbf{v}\) be a non-normalized vector for all histograms in a given block, and let \(||\mathbf{v}||_{i}\) be the \(i\)-norm, for \(i=1,2\), and \(\epsilon\) be some small constant. Then the normalized vector, \(\vartheta\), is given by  
\[\vartheta=\frac{\mathbf{v}}{(\left\lVert\mathbf{v}\right\rVert_{2}^{2}+\epsilon^{2}) ^{0.5}}. \tag{21}\]  
Finally, vectors for all normalized blocks are concatenated together, forming a HOG as a feature descriptor.