Using the method outlined in this website to isolate the circular contours: https://www.authentise.com/post/detecting-circular-shapes-using-contours, I was able to achieve the following contours outlined in blue in the photo. However, the method is not able to differentiate perfectly between the letters/numbers and circular shapes. Does anybody know of a foolproof solution?
This is my code snippet
cnts, hiearchy = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)
contour_list = []
for contour in cnts:
approx = cv2.approxPolyDP(contour,0.01*cv2.arcLength(contour,True),True)
area = cv2.contourArea(contour)
if ((len(approx) > 8) & (len(approx) < 23) & (area > 30) ):
contour_list.append(contour)
mcq = cv2.drawContours(paper, contour_list, -1, (255,0,0), 1)
cv2.imshow("Image",thresh)
cv2.imshow("mcq",mcq)
Original images: https://i.stack.imgur.com/lxBU5.jpg
