Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

structure of opencv's hog output

I'm extracting the HOG features of a grayscale image using OpenCV's HOG implementation. Assuming that my image matches the default window size, i.e. 128x64, I'm struggling to understand correctly how that feature vector is organised. This is what I know:

  • Every cell outputs a 9 elements histogram quantifying the orientations of the edges lying within that cell (8x8 pixels by default).
  • Each block contains 2x2 cells.
  • By default, an 8x8 block stride is used.

This results in a 7159*4 = 3780 elements feature vector. 7 and 15 are the number of blocks that fit horizontally and vertically when a 50% block overlap is used. All great until here.

If we examine the features of the first block, i.e. the first 9*4 elements, how are they arranged? Do the first 9 bins correspond to the top left cell in the block? what about the next 9? and the next? And which orientation angle does each of the 9 bins represent? Does feature[0] = 0, feature[1] = 20, feature[2] = 40, ... feature[8] = 160. Or is the order different, for instance going from -pi/2 to +pi/2?

structure of opencv's hog output

I'm extracting the HOG features of a grayscale image using OpenCV's HOG implementation. Assuming that my image matches the default window size, i.e. 128x64, I'm struggling to understand correctly how that feature vector is organised. This is what I know:

  • Every cell outputs a 9 elements histogram quantifying the orientations of the edges lying within that cell (8x8 pixels by default).
  • Each block contains 2x2 cells.
  • By default, an 8x8 block stride is used.

This results in a 7159*4 7 * 15 * 9 * 4 = 3780 elements feature vector. 7 and 15 are the number of blocks that fit horizontally and vertically when a 50% block overlap is used. All great until here.

If we examine the features of the first block, i.e. the first 9*4 elements, how are they arranged? Do the first 9 bins correspond to the top left cell in the block? what about the next 9? and the next? And which orientation angle does each of the 9 bins represent? Does feature[0] = 0, feature[1] = 20, feature[2] = 40, ... feature[8] = 160. Or is the order different, for instance going from -pi/2 to +pi/2?

structure of opencv's hog output

I'm extracting the HOG features of a grayscale image using OpenCV's HOG implementation. Assuming that my image matches the default window size, i.e. 128x64, I'm struggling to understand correctly how that feature vector is organised. This is what I know:

  • Every cell outputs a 9 elements histogram quantifying the orientations of the edges lying within that cell (8x8 pixels by default).
  • Each block contains 2x2 cells.
  • By default, an 8x8 block stride is used.

This results in a 7 * 15 * 9 * 4 = 3780 elements feature vector. 7 and 15 are the number of blocks that fit horizontally and vertically when a 50% block overlap is used. All great until here.

If we examine the features of the first block, i.e. the first 9*4 elements, how are they arranged? Do the first 9 bins correspond to the top left cell in the block? what about the next 9? and the next? And which orientation angle does each of the 9 bins represent? Does feature[0] = 0, 0 degrees, feature[1] = 20, 20 degrees, feature[2] = 40, 40 degrees, ... feature[8] = 160. 160 degrees. Or is the order different, for instance going from -pi/2 to +pi/2?

structure of opencv's hog output

I'm extracting the HOG features of a grayscale image using OpenCV's HOG implementation. Assuming that my image matches the default window size, i.e. 128x64, I'm struggling to understand correctly how that feature vector is organised. This is what I know:

  • Every cell outputs a 9 elements histogram quantifying the orientations of the edges lying within that cell (8x8 pixels by default).
  • Each block contains 2x2 cells.
  • By default, an 8x8 block stride is used.

This results in a 7 * 15 * 9 * 4 = 3780 elements feature vector. 7 and 15 are the number of blocks that fit horizontally and vertically when a 50% block overlap is used. All great until here.

If we examine the features of the first block, i.e. the first 9*4 elements, how are they arranged? Do the first 9 bins correspond to the top left cell in the block? what about the next 9? and the next? And which orientation angle does each of the 9 bins represent? Does feature[0] bins[0] = 0 degrees, feature[1] bins[1] = 20 degrees, feature[2] bins[2] = 40 degrees, ... feature[8] bins[8] = 160 degrees. Or is the order different, for instance going from -pi/2 to +pi/2?