1 | initial version |
Contours are order in a hierarchy. The python tutorial on contour hierarchy discusses this in quite the detail.
Basically what you have to do is sort your contours based on for example the upper left corner position of the bounding box. You could then use the x and y value of that position to sort out your contours.