On approximately 2/6/2010 3:10 PM, came the following characters from 
the keyboard of Jan Öhman:
> Interesting problem.
>
> - Long ago, I did this by using an OCR software that we bought to our 
> company.
>
> I have searched for an "updated" free OCR software,
> but have not found something easily to install and use.
> (have also looked at some "cheap" OCR software but not had time to 
> evaluate them yet).
>
> It's not an easy problem.
> Imagine that the copies in "poor countries" is not as sharp and good 
> as in other countries.

Actually, if the printed forms were faint, that wouldn't hurt the 
detection of the marks, just the students' ability to find the bubbles 
to mark.

> Have they always access to these "special pens" that you write about?
> (what happen if they don't have it)?
> and choosing a specific type of pen did the (indian ink / color / red) 
> to get the contrast is probably not easy either.

I know that IBM even had their own pencils (generally, pencils are used 
for testing, so students can make corrections), that were super black, 
and soft lead so easy to fill in the bubbles.  Testing pencils, 
fortunately, are not large nor particularly heavy, and could be carried 
in, if necessary.  If used only for testing, they would last a long 
time, with locally available pencils used the rest of the time.  I don't 
think this will be an issue (but it does make my list of things to 
mention to the teacher than asked).


> I ponder if it's possible to make the holes in the paper with a 
> pen/knife or something to get the contrast.
> Whichever method you use, it is a probably a requirement that the 
> alternatives or the questions are not so close together.

Yes, most forms of that sort have the bubbles spaced apart.

> I also believe that the preprinted dark stripe or two would be good 
> for alignment?
>
> A program language I would look on is "AutoHotkey" and the "pixelsearch"
> - But I have only use this command on screen. (and I can't use 
> "ImageMaker" as good as I want).

Hmm. Pixelsearch seems to be a command in AutoHotkey, which I am 
somewhat familiar with.  Seems limited to on-screen stuff, and similar 
to the ImageMagick/PerlMagic $image->Get("pixel[$x,$y]")  function.  The 
latter lets you operate on an image that is not on-screen, however, so 
seems AutoHotkey/pixelsearch doesn't add value, only complexity, for 
this particular case.

You got me thinking though, if there is a vertical stripe down the left 
edge and across top edge of the scoring sheet, one could choose a couple 
spots, an inch or so from the top and bottom of the page, and detect the 
first black pixel from the left.  Then calculate the rotation angle.  A 
similar calculation could be done at the top (the rotation angles should 
be the same, measured either way).  After rotation, redetect the black, 
top and side, and use that as a crop location.  Then the positions of 
the bubbles would be findable.

If the scanner is equipped with a white background, and the paper 
sufficiently smaller than the maximum scan area, then there would be 
lots of room for the paper to be tossed on the scanner at nearly any 
angle, and still rotated and cropped, to find the field of bubbles.


> There was not much help, but anyway :-)

It'd be nice to find a canned application that already does it, of 
course, so more responses are welcome, but just the discussion helps me 
better understand how I might do the rotation and cropping.


> Good luck!
> //Jan
>
> Glenn Linderman skrev:
>> Someone posed the question to me, if they could use their scanner for 
>> grading multiple choice tests.  This is for someone in a volunteer 
>> teaching position in one of the less advanced, poor countries, but 
>> they do have an image scanner available.  So I'm not a real expert in 
>> graphics manipulation and analysis, most of what I do in the way of 
>> graphics is generating print images for books, so I mostly use 
>> ImageMagick to help with some of the manipulations, but they are 
>> simple... crops, resizings, adding margins, and the like.
>>
>> In thinking about the problem I see several steps, and several 
>> possibly applicable uses of ImageMagick.
>>
>> Scan the answer sheet, which would be a bunch of pencil filled dots. 
>> The locations of the dots would be known.  Perhaps a preprinted dark 
>> stripe or two would be good for alignment?  Or even a surrounding 
>> box? Is there a way to detect, and then rotate and translate known 
>> objects to a fixed position, to compensate for misalignment of the 
>> papers in the scanner?  This seems to be the hardest thing, maybe 
>> because it is the part I know least about.
>>
>> The scan could be done in color or greyscale, and then thresholded to 
>> eliminate erasures... the use of soft, very black pencils is the norm 
>> in those testing environments.
>>
>> Then, knowing where the answer dots would be, one would check for the 
>> overall darkness of the enclosing region, and if it exceeds some 
>> threshold it is considered marked.
>>
>> Once the set of marked boxes is known, the actual scoring, or 
>> grading, is straightforward logic.  The test creator would simply 
>> supply a list of "correct answer" boxes, possibly a weighting for 
>> certain "partially correct answer" boxes, and others would be assumed 
>> "incorrect answer" boxes.  Some rules about whether or not multiple 
>> boxes are allowed or required to be a "correct answer".  Multiple 
>> choice doesn't only mean one choice, always.  So the grading rules 
>> might be complex, but that is orthogonal to the "marked box 
>> detection", which is the part I'm concerned with here.
>>
>> Does anyone have advice, or sample code, on how to approach the first 
>> part, the alignment? I think I understand enough to do the remaining 
>> parts, as well as understanding how to generate the form that would 
>> be printed to be the answer sheet.
>>
>> Or maybe this is a solved problem, that I have missed in my 
>> searches.  I found lots of paid solutions to this sort of thing, but 
>> didn't find a freeware, or low-cost shareware, but maybe there was 
>> one hidden in the noise.  I'm not averse to using something besides 
>> ImageMagick if it exists as a canned solution, but if I need to 
>> create my own, then ImageMagick seems like a good starting point 
>> overall, and if I can figure out how to do the scan alignment.


_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to