1 | initial version |
I found better solution without iterating through contours - by using numpy concatenate() function:
concat = np.concatenate(contours)
hulls = cv2.convexHull(concat)
Resulting hulls contour can be further approximated by cv2.approxPolyDP() function in order to get bounding rectangle.