Hi,
I’m trying to get the hog features at specific keypoints of an image.
I’m resizing the images to size 256x256x3
then, I initialize
hog = cv2.HOGDescriptor(winSize=(256, 256), blockSize=(16,16), blockStride=(8,8), cellSize=(8,8), nbins=9)
hog.compute(image) → this returns a vector of length 34596
if I’m using ‘locations’
hog.compute(image, locations=[points]) it returns a vector of length 34596xnum_points. but for some reason this vector is all 0’s.
call hog.compute(lena, descriptors); 34596 desciptors for [0] is 0.226208031, [10] is 0.163035244 [34595] is 0.0669640526
hog.compute(lena, descriptors,Size(), Size(), pt); 138384 descriptors [0], [10] and [34595] are same and after all values are 0
I appreciate the help, thanks.
My mistake was setting winSize = (256, 256). hence for each keypoint it tried to calculate 31x31x2x2x9 histograms (and returned 0’s because the stride and padding issue).
Once I set winSize = (16, 16), for each keypoint it calculated the correct number of histograms 1x1x2x2x9 in the surrounding of the keypoint.