Ask Your Question
0

Histogram of Gradients - Integral Image method

asked 2017-03-07 21:18:22 -0600

Nbb gravatar image

I am trying to extract the histogram of oriented gradients for all the bounding boxes (approximately 1000) that I have in an image. This will be a very simplified version with only a single block per sub-image. I was wondering if anyone can comment on whether my implementation below can be sped up.

My current plan is to compute the magnitude and angle of the edge map dx and dy.

//compute magnitude and angle
cv::Mat mag, angle;
cv::cartToPolar(dx, dy, mag, angle, true);

Then I will create a vector of 9 matrices where each will store the magnitude for a range of angles eg. 0 - 20, 20 - 40, all the way up till 140 - 160. I will then run the integral image operation on these set of matrices and from there on, I can easily compute the histogram of oriented gradients. Is this too time consuming ? Are there any faster implementations ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2017-03-07 22:49:08 -0600

Tetragramm gravatar image

If there are lots of overlaps between your bounding boxes, that's a good idea. Otherwise there's no reason to bother with the integral image.

I would use the inRange function to make a a mask out of angle for each bin. The mask would then be an input of mag.copyTo(bin[x], mask);

As a bonus, if you need to, you could divide your boxes into more blocks with only a little more computation.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-07 21:18:22 -0600

Seen: 584 times

Last updated: Mar 07 '17