i have a code which identifies contours after applying filters on video frames. Now in my case i get 3 contours and i show them by drawing rectangles around them, what i want to
Using numpy:
boxes = [] for c in cnts: (x, y, w, h) = cv2.boundingRect(c) boxes.append([x,y, x+w,y+h]) boxes = np.asarray(boxes) left, top = np.min(boxes, axis=0)[:2] right, bottom = np.max(boxes, axis=0)[2:] cv2.rectangle(frame, (left,top), (right,bottom), (255, 0, 0), 2)