Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The HOG feature extraction visualization

Hi all, I am using the HOGDescriptor class built-in the opencv 3.1 library. I can run the code to extract the descriptor values into the vector<float>.

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

However, I don't know which order the descriptors is stored in this vector "std::vector< float > &descriptors" row-column-bin or anything else. I really need the visualization of HOG descriptors. I also found the sample code here

http://www.juergenwiki.de/work/wiki/doku.php?id=public:hog_descriptor_computation_and_visualization

But it seems that the order of 3 for-loops when he computes the gradient strengths conflict as usuall (we usually loop row then col then bin)

// compute gradient strengths per cell
int descriptorDataIdx = 0;
int cellx = 0;
int celly = 0;

for (int blockx=0; blockx<blocks_in_x_dir; blockx++)
{
    for (int blocky=0; blocky<blocks_in_y_dir; blocky++)
    {
        // 4 cells per block ...
        for (int cellNr=0; cellNr<4; cellNr++)
        {

I am really embarrassed at this point. Hope anyone can help me. Thank you !