Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV: Compute a single HOG vector for the whole image and get block locations

I work with OpenCV 2.4 in C++.

I have some image, say, 360x240 (but it is not relevant), and I want to compute one HOG vector for the whole image.

  • Is there any short way to do it, or should I initialize an object of gpu::HOGDescriptor with winSize equals to the image size?

  • Is the winSize parameter anyway relevant when you use the getDescriptors() method (or is it relevant only for the detection related methods)?

  • Is there some easy way to tell the coordinates in the image of each block in the vector?

like image 566
SomethingSomething Avatar asked Nov 25 '25 13:11

SomethingSomething


1 Answers

  • Set the winSize is the correct way.
  • This parameter is relevant for the getDescriptors() because it defines the size of your descriptor. The descriptor of size winSize is first devided into cell of size cellSize. For each cell a histogram of oriented gradients is build. The descriptor is further arranged in Blocks. A Block uses blockSize.width * blockSize.height adjecent cells in order to estimate a normalize the histogram out of the blockSize.width * blockSize.height cell histomgrams. blockStride can be use to arange the blocks in an overlapping manner. Finaly all normalized histograms estimated for each Block are concatenated which defines the final descriptor vector length. here you can find a good visualisation. So different sizes can result in various descriptor length.
  • If you mean the locations of the HoG descriptors you can use the locations attribute of the compute function.
like image 128
Tobias Senst Avatar answered Nov 28 '25 15:11

Tobias Senst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!