Identifying filled circles in a scanned image

Claudio Grondi claudio.grondi at freenet.de
Thu Mar 30 19:54:28 EST 2006


Douglas Douglas wrote:
> First of all. Thanks Claudio and nikie for your fast answers.
> 
> What I want to do is process the forms automatically. Each circle match a
> letter (like in a quiz). So if the user select option A in a row, he fills the
> first circle. If he select option C in the next row, he fills the third circle
> of that row. Get it?
> 
> What I want is to write a script that takes the images and say:
> Form 1:
>   Options Selected: A, B, C, A, B, C, A, D, E, A
> Form 2:
>   Options Selected: B, B, B, A, A, A, C, D, E, A
> ....
> 
> I've read the PIL tutorial. I've processed images before using PIL (basic stuff
> though). I thought about using the difference method of the ImageChops module.
> It almost worked. The problem is that when the scanner takes the pages it
> doesn't put it in the same exact position in its bed. There's not a lot of
> difference, but there's a little.
> 
> I also thought about drawing references in the forms (like a line or an X) I
> could look for.
> 
> I like to hear your comments now that I explained a little more.
The in my eyes simplest solution is already proposed by Paul.

There is a nice object detection (look for .find_objects in numarray 
docu) built-in into the numarray module you can use to search for the 
circles and other elements in your form. Check it out if you want to 
speed up detection of objects in the scan or areas of the scan of the 
form (use PILs .tostring() and numarray .fromstring() to pass the 
picture pixel data from PIL to numarray).

Claudio


> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 



More information about the Python-list mailing list