You could use some heuristic to sort the contours. The following example uses the minimum x coordinate of each contour to sort them:
import cv2
import numpy as np
img = cv2.imread('BB7eu.png')
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_, contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
contours.sort(key=lambda c: np.min(c[:,:,0]))
for i in range(len(contours)):
cur = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
cv2.drawContours(cur, contours, i, (0,0,255), -1)
cv2.putText(cur, "i=%d" % i, (140,90), cv2.FONT_HERSHEY_PLAIN, 1, (0,255,255), 1)
cv2.imshow("img", cur)
cv2.waitKey()
You'll see that the contours are highlighted "in order": B,e,r.
findContours
is the hierarchy. You cannot depend on which blob will be detected first. – zindarodfindContours
function provides. The OP was assuming that just because the B character was positioned first, it would be detected first, which it may or may not. – zindarod