Python opencv sorting contours

前端 未结 3 1572
梦谈多话
梦谈多话 2020-12-08 02:56

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

3条回答
  •  执笔经年
    2020-12-08 03:51

    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?

提交回复
热议问题