Ask Your Question
0

HOGDescriptor::compute parameters

asked 2015-08-11 05:51:10 -0600

krips891 gravatar image

My usecase is simple. Given an image I want to find hog descriptors of a particular window (that is I just want to compute HOG features in a window). It seems that I should use HOGDescriptor::compute. But I am not understanding what are the different parameters:

virtual void cv::HOGDescriptor::compute (   InputArray  img,
std::vector< float > &  descriptors,
Size    winStride = Size(),
Size    padding = Size(),
const std::vector< Point > &    locations = std::vector< Point >() 
)

The parameter locations makes sense which I assume tells it where to find the descriptors. The descriptors returned would I have a dimension as computed by the the parameters specified by HOGDescriptor constructor:

(_winSize,
Size    _blockSize,
Size    _blockStride,
Size    _cellSize,
int     _nbins ...)

What I don't understand are the parameters winStride, padding. I understand these parameters are used the way a detection window moves for exhaustive detection. But what are they doing in this function compute. Or it is doing something else?! I do not want to compute descriptors in all possible windows, but in a particular window, so that I can feed the descriptor in my custom svm. Thanks in advance.

edit retag flag offensive close merge delete

Comments

maybe you have something with this link try to understand what they do with other variables, but I think you will understand: http://scikit-image.org/docs/dev/auto...

martijnvwezel gravatar imagemartijnvwezel ( 2015-08-12 01:05:22 -0600 )edit

I am interested in knowing padding and winstride in the function compute. I do not understand their need in getting descriptor for one single particular window. It has nothing to do with the hog literature in general, it is to do with this very particular function of opencv.

krips891 gravatar imagekrips891 ( 2015-08-12 09:31:52 -0600 )edit

I really never understood the parameters in this functions either, but I guess it has to do with some old implementation or something. Anyway, you can easily achieve what you want (descriptors for a particular window) if you just input that particular window as the img parameter and leave the other default values (and obviously, you will have your result in descriptors. Just make sure your window has the same size as the window of the HOGDescriptor object (this function does not perfom scaling).

LorenaGdL gravatar imageLorenaGdL ( 2015-08-14 02:59:40 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-08-12 11:29:30 -0600

'winStride' = argument (default 8x8)- controls how the window is slide across the input window'. 'padding' = adds a certain amount of extra pixels on each side of the input image. That way the detection window is placed a bit outside the input image. It's because of that padding that HOG can detect people who are very close to the edge of the input image. Setting it to (0,0) add no extra pixels on each side of the input image.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-08-11 05:51:10 -0600

Seen: 6,296 times

Last updated: Aug 12 '15