OMRChecker
OMRChecker copied to clipboard
[Feature] Support for detecting tick marks or cross marks
Is your feature request related to a problem? Please describe. It'll be good to have support for tick marks/cross marks instead of just fully circled bubbles.
Describe the solution you'd like
-
Traverse each bubble point just like in the current algorithm
-
Instead of calculating the mean pixel value for a bubble, use a different algorithm to accurately detect a cross or a tick mark (open to ideas)
-
The algorithm should be able to differentiate between a slightly shifted bubble boundary(checkbox walls) vs a tick mark (no false positives)
-
Return a fixed value for that detected bubble so that it works with existing algorithm too.
for pt in field_block_bubbles:
# shifted
x, y = (pt.x + field_block.shift, pt.y)
rect = [y, y + box_h, x, x + box_w]
q_strip_vals.append(
# cv2.mean(img[rect[0] : rect[1], rect[2] : rect[3]])[0]
detectCross(img, rect) ? 0 : 255
)
Additional context
- The code comment here is a good starting point (perhaps the solution to this entire problem)
- This stackoverflow discussion
- Can explore cv2. connectedComponentsWithStats