1 | initial version |
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.