mythrex / OMR-Scanner

This project uses open cv to evaluate OMR sheets. We are trying to make this system as reliable as possible.
49 stars 23 forks source link

Need new function and algorithm to sort contours. #9

Closed mythrex closed 6 years ago

mythrex commented 6 years ago
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)] issue 2