## 3 Filters for Feature Extraction: LBP, HOG, and Saliency
### Histogram of Oriented Gradients (HOG)  
The Histogram of Oriented Gradients (HOG) is a feature descriptor used extensively for object detection tasks in images [47]. This method calculates the distribution of intensity gradients in localized regions of an image, focusing on capturing the structure and shape of objects, making it particularly effective in tasks like pedestrian detection, vehicle detection, and facial recognition. HOG works by analyzing the gradient orientations and magnitudes of image regions to understand the overall structure of the object. Unlike methods that focus on texture, HOG captures shapes and edges, providing robust information for object detection, especially when variations in lighting or pose are present. The process of extracting HOG features from an image involves the following six steps:  
* Image Preprocessing: This step involves converting the input image to grayscale \(I_{gray}(x,y)\), as color information is not typically needed for gradient-based techniques. Optionally, contrast enhancement techniques can be applied to improve the image's visibility, especially when dealing with low-quality images. * Gradient Calculation: The gradient at each pixel is calculated in both the horizontal (\(Grad_{x}\)) and vertical (\(Grad_{y}\)) directions. The following equations represent the gradient calculation for the image: \[Grad_{x}(x,y)=I_{gray}(x+1,y)-I_{gray}(x-1,y)\] (1) \[Grad_{y}(x,y)=I_{gray}(x,y+1)-I_{gray}(x,y-1)\] (2) The magnitude of the gradient is then calculated by combining \(Grad_{x}\) and \(Grad_{y}\): \[Magnitude(x,y)=\sqrt{Grad_{x}^{2}(x,y)+Grad_{y}^{2}(x,y)}\] (3)The orientation of the gradient (i.e., the angle at which the gradient occurs) is computed as \[Orientation(x,y)=\arctan\left(\frac{Grad_{y}(x,y)}{Grad_{x}(x,y)}\right)\] (4)
* Gradient Histogram Calculation: The image is divided into smaller regions called cells (typically of size \(8\times 8\) pixels). In each cell, a histogram of the gradient orientations is calculated. These histograms reflect the distribution of edge directions in that region of the image. * Block Normalization: The next step involves normalizing the gradients in blocks of cells (e.g., \(2\times 2\) cells), ensuring that the final feature vector is invariant to changes in illumination and contrast. This normalization reduces the sensitivity to lighting conditions in the image. * Descriptor Formation: The histograms from all the cells are concatenated to form a single feature vector. This vector now represents the HOG descriptor of the entire image, capturing the distribution of gradient orientations across the image. * Feature Vector Output: The final HOG feature vector is used as input to machine learning algorithms for object detection, recognition, or tracking. This descriptor efficiently represents the shape and structural features of objects, making it ideal for detecting objects like pedestrians, vehicles, or other well-defined shapes. HOG is particularly useful for detecting objects that have clear edges or distinct shapes. The method works well in situations where objects in the image are well defined, even if their size, position, or orientation varies. This is because the gradient-based approach captures the overall structure of an object (its outline, shape, and orientation), rather than focusing on local texture details. Therefore, HOG is highly effective in applications such as pedestrian detection, where the human form has a distinctive structure. The primary advantages of HOG include the following:  
* Robustness to lighting changes: Since HOG captures gradient magnitudes and orientations, it is less sensitive to changes in lighting conditions. This is because gradients provide information about edges and structures, which are less dependent on lighting than raw images [48; 49]. * Pose invariance: The technique can be effective in recognizing objects regardless of their pose or orientation, especially when using multi-scale approaches.