Reputation: 1856
I'm trying to use cv2.groupRectangles to join the bounding boxes proposed by a neural network.
The problem is, for the following bounding boxes, it is returning [[4]]
as one of the joined areas.
I expected it to output 4 values. x0, y0, x1, y1
>>> import cv2
>>> aa = [[1050, 0, 1260, 144], [1085, 0, 1295, 144], [1015, 23, 1225, 168], [1050, 23, 1260, 168], [280, 782, 490, 960]]
>>> cv2.groupRectangles(aa, 1, 0.7)
(array([[1050, 12, 1260, 156]], dtype=int32), array([[4]], dtype=int32))
>>>
Upvotes: 3
Views: 2968
Reputation: 11
Function cv2.groupRectangles(rectList,groupThreshold,eps) requires 3 parameters and I assumed that you understood about these 3 parameters. Following documentation is useful to better understand each of these parameters.
Such function will return 2 values: rectList and weights. rectList represents a list of rectangles which could be used to represent a group of rectangles that you have provided to the function. In your case, there is only one rectangle, it means, the function were able to produce one rectangle to represent group of 4 given rectangles. The weights value will correlate with how many rectangles are represented by a single rectangle. In your case, there is only one weight since the function only able to form a single rectangle based on 4 neighboring rectangles.
Upvotes: 1