Friday, 29 April 2016

Histogram of Oriented Gradients (HoG)

1) First apply Gaussian Smoothing Mask on the image.
2) The given image is divided into 16x16 blocks each of 2x2 cell and each cell is 8x8.  Block1 is as shown in the above figure WITH 50% Overlap



If the image is of size 64x128, we get 105 blocks.

3) Compute gradient magnitude and gradient direction for each block.

4) We look at gradient direction and quantize orientation into any of  9 bins (0- 180 degrees) as shown below












5) If direction is not in one of the bins we use interpolation.
6) Concatenate all descriptors i.e, 105 blocks each of 9 dimensions as we have 9 bins.  Hence we get a total of 3780 descriptors .(each block is further divided into 2x2 cells each of size 8 so 2*2 =4 and for each 8x8 , 9 bins and hence 4*9*105=3780)
7)We plot histogram
x-axis of histogram is the bin values say (20 degrees, 40 degrees...as shown in the above figure).
y-axis is the count. We count how strong the gradient direction is using gradient magnitude( vote).

To Learn more about HoG watch the video at the link given below https://www.youtube.com/watch?v=0Zib1YEE4LU
To learn more about descriptors like SIFT etc.. follow the below link
https://gilscvblog.com/2013/08/26/tutorial-on-binary-descriptors-part-1/
https://www.youtube.com/watch?v=4ESLTAd3IOM