Figure 1: Pixel value of given input image. Red color means observed pixel

In order to implement this feature descriptor [1], the gradient vector are calculated as follows:

In order to make this method robust with the variance of contrast, the magnitude feature vector needs to be normalized as follows

Dalal and Triggs used resolution 64×128 of input images. Then, to com- pute HoG descriptor a windowing method of 8×8 pixels was developed and    a block of 50% overlapping was applied. These magnitude values are stored  in 9 bins of histogram.

The blocks used [1] were 4 cells in 1 block, 2×2 cells. These blocks have 50% overlapping.  This block normalization is performed by concatenating  the histograms of the four cells within the block into a vector with 36 com- ponents (4 histograms x 9 bins per histograms).

Figure 2: HoG setup used by Dalal and Triggs

Bibliography

[1] N. Dalal and B. Triggs. Histograms of oriented gradients for human detection. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition  (CVPR’05),  volume  1,  pages  886–893 vol. 1, June 2005. doi: 10.1109/CVPR.2005.177.