Identifying filled circles in a scanned image

D

Douglas Douglas

Hi everybody.

I have a paper form that I scan into an image. My user fills some circles in
this paper form using black ink. Every form has ten rows with five circles each
and the user fills only one circle for each row.

I was wondering if I could use the Python Imaging Library to process these
forms. I know the Image class is really powerful, but I can't think of a way of
how to locate wich circle was filled.

Could anybody please give me an advice on this?

Thanks.

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

Claudio Grondi

Douglas said:
Hi everybody.

I have a paper form that I scan into an image. My user fills some circles in
this paper form using black ink. Every form has ten rows with five circles each
and the user fills only one circle for each row.

I was wondering if I could use the Python Imaging Library to process these
forms. I know the Image class is really powerful, but I can't think of a way of
how to locate wich circle was filled.

Could anybody please give me an advice on this?
If you know the position of the circles in the picture (if you scanned
properly you know it), you can test the mean darkness of the pixels
within the circle (dark pixels: filled circle, bright pixels: not filled
one). PIL allows access to any single pixel value (e.g. triple of values
in case of RGB) in the picture, so, that you can test it against
self-chosen threshold values.

It could be helpful to try to be a bit more specific about your problem
(you have read the PIL tutorial, right?) if this above is not what you
are looking for.

Claudio
 
N

nikie

Douglas said:
Hi everybody.

I have a paper form that I scan into an image. My user fills some circles in
this paper form using black ink. Every form has ten rows with five circles each
and the user fills only one circle for each row.

I was wondering if I could use the Python Imaging Library to process these
forms. I know the Image class is really powerful, but I can't think of a way of
how to locate wich circle was filled.

Could anybody please give me an advice on this?

Depends on how much time you have... Google for "Hough Transformation",
or look it up in a text book on image processing. That's a very general
method for finding lines and circles. If you know where the circles
are, comparing the average grey value inside the circle with the
average of the environment should tell you if it's filled or not.
 
P

Paul McGuire

Douglas said:
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.

Your forms should have some reference registration marks or targets in
opposite corners. Find these first, then you should be able to
interpolate pixel positions from there, using a 2D trans/rotational
transform.

-- Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top