HOG features visualisation with OpenCV, HOGDescriptor in C++

匿名 (未验证) 提交于 2019-12-03 00:46:02

问题:

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?

回答1:

I had exactly the same problem today. Computing a HOGDescriptor vector for a 64x128 image using OpenCV's HOGDescriptor::compute() function is easy, but there is no built-in functionality to visualize it.

Finally I managed to understand how the gradient orientation magnitudes are stored in the 3870 long HOG descriptor vector.

You can find my C++ code for visualizing the HOGDescriptor here:

http://www.juergenbrauer.org/old_wiki/doku.php?id=public:hog_descriptor_computation_and_visualization

Hope it helps!

Jürgen



回答2:

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/




回答3:

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 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!