I\'m using OpenCV and want to group together rectangles that have significant overlap. I\'ve tried using groupRectangles
for this, which takes a group threshold
The solution I ended up going with was to duplicate all of the initial rectangles before calling groupRectangles
. That way every input rectangle is guaranteed to be grouped with at least one other rectangle, and will appear in the output:
int size = rects.size();
for( int i = 0; i < size; i++ )
{
rects.push_back(Rect(rects[i]));
}
groupRectangles(rects, 1, 0.2);