Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with groupRectangles().

a = [[1,2,3,4],[1,2,3,4],[4,5,6,7],[4,5,6,7]]
cv2.groupRectangles(a,1,0)

This returns 2 rectangles [1,2,3,4] and [4,5,6,7] as expected. However if I add a big rectangle to the list, which covers them all, I get just that big rectangle whereas what I want is each rectangle individually.

a = [[1,2,3,4],[1,2,3,4],[4,5,6,7],[4,5,6,7],[0,0,100,100],[0,0,100,100]]
cv2.groupRectangles(a,1,0)

The result of this is just one rectangle [0,0,100,100]. I want [1,2,3,4],[4,5,6,7] and [0,0,100,100].

PS : This is just example data. The rectangles in the original data don't always have the exact same values.