Understanding HoG output

Brian Holt bdholt1 at gmail.com
Fri Feb 10 08:45:12 EST 2012


Hi Michael,

Hi, new to group, new to image processing starting to explore HoG.
Looking for a python implementation and discovered
skimage.feature.hog().


Glad to hear someone's using HoGs!

My plan to run skimage.features.hog over some positive/negative images
and use this to train a svm classifier from scikits-learn.   I am
trying to understand the output hog before I proceed further.    When
I run skimag.feature.hog() it over a region of interest  it appears to
returns an array.  How do I interpret this array?

My best suggestion would be that you take a look at the comments written in
`hog.py`.  Each part quotes the relevant section from the Dalal Triggs
paper and then under that implements the code required to do the job.
 Others on this list may have different views, but I'd be reluctant to try
to 'interpret' the flattened descriptor.


 Is there a way to reshape the array to see what it was like before it was
flattened or that doesn't make any sense?  Can I plot the descriptor
returned in
any meaningful way?


Yes, you can reshape the array (but that can be a bit tricky), or you could
modify the hog function to return the unraveled descriptor and ravel it
yourself later if you need it.

Also when I choose to visualise the HoG often where I expected to see
vertical line dominate, say on the edge of builds, the line drawn
often appears to be more dominant at the 45 deg.  Is this expected as
the line drawn is really just the sum of all surrounding orientations
for the "cell"?


A line is drawn for each gradient bin with an intensity proportional to the
magnitude of that gradient.  So, the 'star' shape you see for each cell is
just the superimposition of all of these lines. You should expect to see
dominant lines perpendicular to lines in the image (parallel to the
gradient). Also remember that the default is to use 9 bins, so it may be
that the 45degree dominant line you see is the closest approximation to
horizontal.  You can test this out by trying 8 bins instead of 9.

I hope it helps, feel free to ask any more questions.

Regards
Brian

On 9 February 2012 06:37, bricklemacho <bricklemacho at gmail.com> wrote:

>
>
>
>
>
>
> Thanks in advance,
>
> Michael.
> --




-- 
He is no fool who gives what he cannot keep to gain what he cannot lose.
 - Jim Elliot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20120210/eac2c9d5/attachment.html>


More information about the scikit-image mailing list