17

I use the HOGDescriptor of the OpenCV C++ Lib to compute the feature vectors of an images. I would like to visualize the features in the source image. Can anyone help me?

3
  • For anyone who wants to work on this, here is a link to the HOG details which seems to include all the definitions you would need to figure out some visualization. Commented Jun 2, 2012 at 13:20
  • Excellent HOG description, but it dosnt help me to visualize the features in C++ with OpenCV. Commented Jun 2, 2012 at 13:26
  • Are you serious? Without those definitions, there is no context for the values in the descriptors. Are you saying that you already understand everything about HOG, but you just don't know how to make a graph / GUI in C++? Commented Jun 2, 2012 at 13:36

3 Answers 3

13

HOGgles¹ is a method developed for HOG visualization, published on ICCV 2013. Here is an example:

What does HOG sees?

This visualization tool may be more useful than plotting the gradient vectors of HOG because one can see better why HOG failed for a given sample.

More information can be found here: http://web.mit.edu/vondrick/ihog/


¹C. Vondrick, A. Khosla, T. Malisiewicz, A. Torralba. "HOGgles: Visualizing Object Detection Features" International Conference on Computer Vision (ICCV), Sydney, Australia, December 2013.

Sign up to request clarification or add additional context in comments.

1 Comment

Are you aware of any python implementation of HOGgles?
2

This opencv group discussion leads to a library written at Brown University.

In HOGpicture.m you should be able to get an idea how to visualize the descriptors. Here is the relevant (matlab) code. Is it enough for you to make something for yourself?

(below code is released under an MIT license)

function im = HOGpicture(w, bs) % HOGpicture(w, bs) % Make picture of positive HOG weights. % construct a "glyph" for each orientation bim1 = zeros(bs, bs); bim1(:,round(bs/2):round(bs/2)+1) = 1; bim = zeros([size(bim1) 9]); bim(:,:,1) = bim1; for i = 2:9, bim(:,:,i) = imrotate(bim1, -(i-1)*20, 'crop'); end % make pictures of positive weights bs adding up weighted glyphs s = size(w); w(w < 0) = 0; im = zeros(bs*s(1), bs*s(2)); for i = 1:s(1), iis = (i-1)*bs+1:i*bs; for j = 1:s(2), jjs = (j-1)*bs+1:j*bs; for k = 1:9, im(iis,jjs) = im(iis,jjs) + bim(:,:,k) * w(i,j,k); end end end 

5 Comments

Thx. It's hard for me to read Matlap Syntax. I can partially follow the computation, but dont see how it helps me to visualize features. Is there any description to the code?
I haven't used Matlab for many many years, so it's not immediately obvious to me either. If I get some time, I'll add my own notes to the code that I can understand. Assuming you have a clear description of what to put in each pixel of an image, will you be able to handle it from there? Or are you asking for both the HOG visualization technique and how to display the image with a GUI? Please clarify your question.
I asking for the HOG visualization technique.
Can you tell me what 1 feature of the feature vector represented? For example. I have an imgage (64x128) with 8x8 px per Cell and a block (105 blocks per image) of 2x2 cells with 9 bins per HOG (Dalal-triggs). This results in 3780 (= 105x2x2x9) features. How i visualize the features?
Or how can i represent 1 of the 3780 features in the image source?
2

I reimplement HOGImage for any blockSize and cellSize, which is based on Jürgen Brauer's. See https://github.com/zhouzq-thu/HOGImage.

1 Comment

Welcome to Stack Overflow! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.