Hoja OMR Python Stackoverflow
import cv2
import numpy as np
img=cv2.imread('test.png') #read image
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #turn image to gray
blur = cv2.GaussianBlur(gray,(3,3),0) #add blur
edges = cv2.Canny(blur,50,100) #find edges
contours, hierarchy = cv2.findContours(edges,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) #find contours
cv2.drawContours(img,contours,-1,(0,255,0),2) #draw contours
cv2.imshow('Contours in Green',img) #show contours in green
#Now you need to sort them out.
Happy Herring