Learn how to use scikit-image library to extract Histogram of Oriented Gradient (HOG) features from images in Python.

The Histogram of Oriented Gradients (HOG) is a feature descriptor used in computer vision and image processing applications for the purpose of the object detection. It is a technique that counts events of gradient orientation in a specific portion of an image or region of interest.

In 2005, Dalal and Triggs published a research paper named Histograms of Oriented Gradients for Human Detection. After the release of this paper, HOG is used in a lot of object detection applications.

Here are the most important aspects of HOG:

  • HOG focuses on the structure of the object. It extracts the information of the edges magnitude as well as the orientation of the edges.
  • It uses a detection window of 64x128 pixels, so the image is first converted into (64, 128) shape.
  • The image is then further divided into small parts, and then the gradient and orientation of each part is calculated. It is divided into 8x16 cells into blocks with 50% overlap, so there are going to be 7x15 = 105 blocks in total, and each block consists of 2x2 cells with 8x8 pixels.
  • We take the 64 gradient vectors of each block (8x8 pixel cell) and put them into a 9-bin histogram.

#python

How to Apply HOG Feature Extraction in Python
5.15 GEEK