How can I sort contours from left to right and top to bottom?

前端 未结 4 1389
[愿得一人]
[愿得一人] 2020-12-06 07:14

I am trying to build an character recognition program using Python. I am stuck on sorting the contours. I am using this page as a reference.

I managed to find the c

4条回答
  •  感动是毒
    2020-12-06 07:59

    contours.sort(key=lambda r: round( float(r[1] / nearest))) will cause similar effect like (int(nearest * round(float(r[1])/nearest)) * max_width + r[0])

提交回复
热议问题