I'm trying to sort the list of bounding boxes obtained after object detection from right to left and top to down. Below are the bounding box locations
bbox = [(637, 207, 681, 207), (679, 99, 726, 99), (747, 497, 798, 497), (829, 124, 892, 124), (1002, 131, 1059, 131), (1010, 656, 1071, 656)]
I sorted this list based on xmin value as below
sorted(bbox,key=lambda x:x[2][0])
I ended up getting bounding box arrangement as shown in the below image [![sample image][1]][1]
the sequence is not in order , the sequence should start from left to right and top to bottom as shown in below image [![sample2][2]][2]
any suggestion or guide to achieve this will be highly appreciated