Hi, new to group, new to image processing starting to explore HoG.Looking for a python implementation and discoveredskimage.feature.hog().
My plan to run skimage.features.hog over some positive/negative imagesand use this to train a svm classifier from scikits-learn. I amtrying to understand the output hog before I proceed further. WhenI run skimag.feature.hog() it over a region of interest it appears toreturns an array. How do I interpret this array?
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 inany meaningful way?
Also when I choose to visualise the HoG often where I expected to seevertical line dominate, say on the edge of builds, the line drawnoften appears to be more dominant at the 45 deg. Is this expected asthe line drawn is really just the sum of all surrounding orientationsfor the "cell"?
thanks a lot for the explanations! I must say that when I had a look at
the HoG function following Michael's post, I had quite a hard time
understanding how this function was working. Your explanations do help;
do you think it would be possible to write a meaningful example using
HoGs for the example gallery? That might give a good starting point in
order to use this function. If you don't have the time to write the
example yourself, any hints on the possible contents would also help.
Cheers,
Emmanuelle
And Brian obliged...
http://scikits-image.org/docs/dev/auto_examples/plot_hog.html
Stéfan
Emmanuelle
On Feb 10, 9:45 pm, Brian Holt <bdho...@gmail.com> wrote:
<snip>
> 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.
Okay, I am still having problems understanding visualisation of the
HoG. When I plot the visualisation it seem to make sense. It is
still not clear why I don't see vertical/perpendicular lines. If you
look at http://tinypic.com/r/dy0fud/5 I would expect to see the pole
of the street light to show dominant perpendicular lines, but they
appear to be more horizontal than vertical. Similar stuff happens if
I use buildings, the "edge" of the building, clearly visable in the
gradient images, ends up as either tending towards the 45deg (or
135deg). The parameters used for the picture were: Orientations 9,
Pixesl Per Cell16x16, Cells per Block 3x3.
>
> I don't actually understand HoG that well, but this result, I believe, is expect. Assuming HoG does what the name suggests, you should expect the lines to align with the direction with the largest gradient. So, if the pole of the street light is a dark gray, and the background is white, then the lines should be perpendicular to the pole since this is the direction of the highest gradient.
>
Tony's answer is spot on here. Perhaps you expect that the HoG image
should look like the gradient image? Instead, what the descriptor is
really aiming to capture is the direction (that's the 'oriented'
part), that the gradients go. So assuming an image where the left half
is black and the right half white, there would be a vertical of
horizontal (or as close as possible, depending on the number of bins)
lines in the HoG image.
> I would expect to see the pole of the street light to show dominant perpendicular lines, but they appear to be more horizontal than vertical.
This is what I was referring to when I talked about the number of
bins. If you look carefully at the HoG image, you'll notice that
there are vertical lines in some places (like at the black billboard),
but there are no perfectly horizontal lines. The closest
approximation to horizontal is maybe a 20deg line. That's because
there are 9 bins. If you tried this with 8 bins, you should see some
horizontal lines.
Hope it helps
Brian