I'm finding the contours for an image with digits and characters, for OCR. So, I need the contours to be sorted left to right, while going line to line, i.e. top to bottom. Right now, the contours aren't sorted that way.

For example, the contours for the above image is sorted as 1,4,0,9,5,8,3,2,6,4,1,9,8,7,5,3,2,6
What I need is the sorting as 1,2,3,4,5,6,7,8,9,2,4,3,6,1,8,5,9,0
↧