2008.01.28 17:43 "[Tiff] OMR bubble detection (Leonardo Serni)", by David Abrames
Thank you for your reply
The most practical approach would be, I think, to employ grayscale images and calculate the minimum white and maximum black threshold... then count the number of "black" pixels in each bubble. Empty and full balloons will sport different blackness averages.
That is a good suggestion. The TIFF images are bitonal and I was planning on simply counting the number of black pixels in the bubble and once I reached 80% then count that has a 'Mark'. If the count was less than 80% but greater than 40% that would be "not sure" and below 40% is not marked.
Things get a bit more complicated if images aren't aligned (but still lay parallel to axes, i.e., you have an offset on X and Y) and may get really hairy if you need to cope with rotations (even if for very small rotation values you might get off by employing shearing).
Very true, I already have despeckel and deskew routines from another project so what I was looking for was a best method for locating the bubbles on the page. I guess I could simply reconstruct the page in memory and then start reading pixels line by line until the page was done and then analyze the data and from that make a determination if a bubble is marked or not marked. This seems like such a brute force method that I figured there might be a better way.
A much more complicated approach would require correlation between a full balloon and an empty one, but this assumes people mark consistently their balloons, which, let's face it, is not a realistic constraint.
Yeah I think I want to stay away from this, at least for now.