I am following this question:
How can I sort contours from left to right and top to bottom?
to sort contours from left-to-right and top-to-bottom. However, m
It appears the question you linked works not with the raw contours but first obtains a bounding rectangle using cv2.boundingRect
. Only then does it make sense to calculate max_width
and max_height
. The code you posted suggests that you are trying to sort the raw contours, not bounding rectangles. If that is not the case, can you provide a more complete piece of your code, including a list of multiple contours that you are trying to sort?