Optimizing image in a OMR preprocessor
I have an OMR (Optic Marker Recognition) algorithm and would like to improve its accuracy by preprocessing the input image. The pictures taken by the users are of response sheets of a test, in which the students mark the correct alternativa by filling a bubble in this sheet.
This is my input image:
edit: I cant post two images for being a new user, but picture that image with a shadow of a hand above the markers!
And this is the desired outcome, obtained using the grayscale filter from the Adobe Scan app:
I already tried a variety of techniques, such as morphologic operations (to remove shadows, but they ended up removing the marked choices as well) or adaptive threshold. Any input from you guys would be of huge help!
Trying to post the input image:
to deal with variable lighting (the shadow), do this:
- grayscale dilation estimates illumination
- then divide the picture by the grayscale dilation
(this assumes a linear color space. usually nobody cares though.)
that gives you a picture with normalized illumination.
you can then grab an area containing each bubble, blindly, relative to the fiducials.
for each such region, you can then assess how filled in it is (sum of pixel values).
Thanks, I will be trying that!
@crackwitz After applying your tips I obtained a similar result, but although the shadow does indeed disappear, the marked bubbles get dimmed as well
This is the image after a few processing steps:
dilation needs a larger radius/more iterations