Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

HOG descriptor output

I am figuring out the structure of the HOGDescriptor.execute in Python using the following code:

import cv2

win_size = (64, 128)

img = cv2.imread("test.png")

img = cv2.resize(img, win_size)

img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)

d = cv2.HOGDescriptor()

hog = d.compute(img)

print hog.shape

The output is (3780, 1), so it is a 3780-element list. Why? I thought it should be: the number of cells in the image (64*128)/(8*8) = 128 multiplied by the number of bins per cell, i.e. 128*9 = 1152.

HOG descriptor output

I am figuring out the structure of the HOGDescriptor.execute in Python using the following code:

 import cv2

cv2 win_size = (64, 128)

128) img = cv2.imread("test.png")

cv2.imread("test.png") img = cv2.resize(img, win_size)

win_size) img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)

cv2.COLOR_RGB2GRAY) d = cv2.HOGDescriptor()

cv2.HOGDescriptor() hog = d.compute(img)

d.compute(img) print hog.shape

The output is (3780, 1), so it is a 3780-element list. Why? I thought it should be: the number of cells in the image (64*128)/(8*8) = 128 multiplied by the number of bins per cell, i.e. 128*9 = 1152.