The HOG feature extraction visualization

asked 2016-06-23 02:21:34 -0500

cytathon gravatar image

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

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 !

edit retag flag offensive close merge delete



also have a look at this visualization .

could you highlight, why you think, it matters ? (apart from "convention", i guess)

berak gravatar imageberak ( 2016-06-23 02:32:07 -0500 )edit
cytathon gravatar imagecytathon ( 2016-06-23 20:49:06 -0500 )edit

The adapted interface provided below his code, which is more general, is still working over here. Could you try running that version and report back the errors that it might throw in your case?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-06-30 07:19:42 -0500 )edit