# LabVIEW

cancel
Showing results for
Did you mean:

Highlighted

## IMAQ HOG feature vector

A quick question about the HOG feature vector output.

I used the default 9 bin. I set the Grid Size to be 50 X 50, and the result vector size is 22500. The image size is 250 X 250.

I have a hard time to understand the structure of the feature vector? If I want map the feature vector to the image, how to parse the gigantic array?

what does the 'Grid Size' refer to? The cell size to calculate histogram of gradient?

Message 1 of 6
(473 Views)

## Re: IMAQ HOG feature vector

Can't be a coincident that 9X50X50=22500... Apparently, you get 9 values for each cell in the 50X50 grid, or one big vector the size of bins X grid.

The manual doesn't mention how the output is organized, but often those kind of things are related to the actual measurement, so anyone familiar to HOG feature extraction (TL;DR) would probably know.

Message 2 of 6
(423 Views)

## Re: IMAQ HOG feature vector

Thanks for help.

It certainly looks that way, 9 X 50 X 50. However, ( I should have done this when I sent the post), if I selected a grid size 40 X 40, the feature vector size is 15129, which is 9 X 41 X 41; for a grid szie 30 X 30, the feature vector size is 8649, 9 X 31 X 31. This is where it got me. The numbers just don't match.

Message 3 of 6
(415 Views)

## Re: IMAQ HOG feature vector

Just a wild guess... Must be some rounding going on. For instance 50X50 fits 250X250 perfectly. 40X40 won't fit, so there will probably be a "left over" cell, the 41th.

You could test this with different image sizes, and\or different cell sizes (125, 25 and 10 should fit 250).

Calculating\predicting this is easy with Quotient & Remainder. 250%50, Q=5, R=0, 250%40 Q=6, R=10. So with 250 over 40, you get 40 cells of 6 pixels, and one of 10 pixels.

Not sure why the help doesn't mention things like this. Might have been be too advanced.

Message 4 of 6
(412 Views)

## Re: IMAQ HOG feature vector

what you said is correct. I just checked the Help document. The Grid Size refers to how to divide the entire image. So 30 X 30 turns out be a 31 X 31 out of a 250 X 250 image.

Now the only question left is how the Feature Vector is structured? Row-based or column-based? In the help document, it only says "

 Feature Vector contains the extracted features in the image

"

Message 5 of 6
(408 Views)

## Re: IMAQ HOG feature vector

It could be one big vector, where all value relate to each other. I've never used HUG feature vectors before.

If there was a one-to-one relation to the grid, I'd expect a 2D array of clustered 1D array values. Then again, that might have been too much work or just unclear to the developer.

Guess you can find out, by changing the image one cell at the time, and see what values change. If it's grid related, once you know the grid size, conversion should be fairly easy with some reshape array\for loop magic.

Message 6 of 6
(401 Views)