I\'m using cv2 with the following method:
cv2
cnts, hier = cv2.findContours(edges, mode=cv2.RETR_TREE, method=cv2.