# Block normalization of histogram of oriented gradient

I am a beginner in image processing. I have some questions regarding HOG.

https://www.learnopencv.com/histogram-of-oriented-gradients/

From this website, it mentioned that each element inside the HOG descriptor will be divided by the sum of all elements in a block. However, how to do block normalization if overlapping the blocks? I do not understand because some elements in the vector will be elements of more than one blocks.

Picture of block normalization

For example, if we have a histogram [v11 v12 v13 v14...v19] ,[v21 v22 v23 v24...v29], [v31 v32 v33 v34 v35...v39] and [v41 v42 v43 v44..v49] in the red block, we can normalize the first element of the first vector like this: v11/(v11+v12+...+v21+v22+v23+..+v31+v32+...+v41+v42...+v49)

However, how can I normalize the vectors in the red block and yellow block?

Thank you very much.

## 1 Answer

I stucked at this question too, because overlapped blocks will be divided twice, right?

and so I found these :

1 http://www.geocities.ws/talh_davidc/#cst_extract

2 https://stackoverflow.com/questions/32417531/hog-what-is-done-in-the-contrast-normalization-step

to verify my answer, I done this:
on 1, they using image size HOG126x63(), block size is 18x18, with 50% overlapping blocks means it had 9px stride.
126/9, 63/9 = (13, 6) blocks.

they mentioned that final vector would be 6318 = 78*81 == 78*9*9 (78*number_of_cells_in_one_block*number_of_bins)
turns out, 13*6 = 78, so final vector is
(blocks_in_image_col *blocks_in_image_row *number_of_cells_in_one_block *number_of_bins)

conclusion is, one block is counted as one set vectors (2*2*9 as in image) , moving the blocks will produce one set of vectors again. there won't be cells normalized twice (it will make the histogram spike at first and flat on remaining due to recursive dividings)