Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is this expected HOG outcome?

Hi, HOGDescriptor::compute() somehow does not behave as expected for me. It generates different output for the same window(see code). Is there a explanation for?

Mat imgRaw = imread("...", 1);

//Cut two areas of imgRaw that:
    //sliding window fits once
Mat singleWindow = Mat(imgRaw, Rect(1, 0, 48, 96)).clone();

    //sliding window  fits twice and the secound fit is equal to the singleWindow
Mat doubleWindow = Mat(imgRaw, Rect(0, 0, 49, 96)).clone();

vector<float> singleDescri, doubleDescri;

//standard HOG: block(16,16), bStride(8,8), cell(8,8), 9 bins
HOGDescriptor d(Size(48,96), Size(16,16), Size(8,8), Size(8,8), 9);

//using a winStride of one. No padding.
d.compute(singleWindow, singleDescri, Size(1, 1));
d.compute(doubleWindow, doubleDescri, Size(1, 1));

//SINGLE vector contains 1980 values - ((96/8)-1) * ((48/8-1)) * 4 * 9
//DOUBLE vector contains 3960 values
//secound half of DOUBLE should be equal SINGLE
//appeares that the first 396 vales are different, little but different
//as the HOG vector is calculated col by col this is exactly the first col of the window - ((96/8)-1) * 4 * 9