Pergunta

I found here How are HoG features represented graphically? code to visualize HOG features; it is done by 2 files in http://www.cs.berkeley.edu/~rbg/latent/index.html, visualizeHOG.m and HOGpicture.m that is (below code is released under an MIT license)

function im = HOGpicture(w, bs)
% Make picture of positive HOG weights.
%   im = HOGpicture(w, bs)

% 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

I don't undestand what is the bs parameter and what means..anycan can help me?

Foi útil?

Solução 2

If you want to visualize HOG features, then use VLFeat (there is a option called render which allows you to do this). The ICCV paper mentioned in the answer below reconstructs HOG features into an image. It tries to show you, "what computers would have seen"? Both are different, you may want to try both.

bs stands for bin size. Usually 8x8 (therefore, bs=8) is used but you should know what was the value of the bin size because that is a necessary parameter in computing HOG itself.

Outras dicas

If you looking for visualizing HOG, you can have a look here, http://web.mit.edu/vondrick/ihog/#code

It was recently published in iccv 2013

The extractHOGFeatures function in the Computer Vision System Toolbox for MATLAB optionally returns a visualization object that lets you visualize the features.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top