Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

HOG:How much to resize image when calculating HOG features?

I am trying to make a function in c++ using opencv(2.4.9) which will be similar to the extractHOGFeatures function of MATLAB.

I need to know whether there is way to compute the HOG features without explicitly resizing the image in OpenCV. If I don't resize the image, I get an error.

Assertion failed ((unsigned)pt.x <= (unsigned)(grad.cols - blockSize.width) && (unsigned)pt.y <= (unsigned)(grad.rows - blockSize.height)) in getBlock, file /build/buildd/opencv-2.4.8+dfsg1/modules/objdetect/src/hog.cpp, line 630 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.4.8+dfsg1/modules/objdetect/src/hog.cpp:630: error: (-215) (unsigned)pt.x <= (unsigned)(grad.cols - blockSize.width) && (unsigned)pt.y <= (unsigned)(grad.rows - blockSize.height) in function getBlock

So I generally resize the image to 64x128.

But I would like to know how MATLAB resizes the image with their function extractHOGFeatures.

Here is my program- https://drive.google.com/open?id=0B3jt6sHgpxO-N2d4NlptMlBXU2s

So two main questions are- 1. How does MATLAB resize the image to compute HOG Features? 2. Is there a way to compute the HOG features without resizing the image in OpenCV?