for c in filter_cnts:
(x, y, w, h) = cv2.boundingRect(c)
ar = w / float(h)
if w >= 9 and h >= 9 and ar >= 0.7 and ar <= 1.2:
# change this!!!!!!!!!!!!!!!!1
box = [(x//5)*5, round(y/20.0)]
questions.append([c, box])
cv2.rectangle(paper, (x, y), (x+w, y+h), (0, 255, 0), 1)
Problem is with calculation of box for sorting in top to bottom.
Change this logic.
box = [(x//5)*5, round(y/20.0)]
Problem is with calculation of box for sorting in top to bottom. Change this logic.
box = [(x//5)*5, round(y/20.0)]