How can I process/read checkmarks on a paper form?

I would like to process a large number of scanned paper forms (GUI or command line). I am only interested in reading (custom) checkboxes. The form looks like this:

  • every line has 6 circle-shaped boxes (one is marked)
  • form has has 45+ lines

After processing, I would like to have the checked value (1 … 6) of every line. I assume as there is no Optical Character Recognition involved (but OMR), this should be somewhat easier.

Is there a way to do this from the GUI or the command line? What would be the best approach?

UPDATED: scans come in PDF or JPEG (my choice). Sample scan (380kb JPEG).

Here is an anonymized version of the form:

paper form to be processed


Solution 1:

If you want to avoid OCR, you can use ImageMagick (a CLI image-manipulation super toolset). But you need to be shure all pages are aligned exactly the same. I hacked together this workflow, you need to alter it for your needs and create some loops, but it can help you in the right direction.

Make shure the position of each round is the same on each sheet

Extract each round and save it with the row_circle-nr (like 04_1.png, 04_2.png, etc)

x=$position_of_circle_on_x
y=$position_of_circle_on_y
w=$width_of_circle_area
h=$hight_of_circle_area
input=$input_image
output=$output_row_cirleNr
convert +repage $input -crop $wx$h+$x+$y $output

Calculate the area of red using histograms (I prefer red, but you can also do this for blacks)

RGBO=$( convert $FILE -colorspace HSL -verbose info: | grep mean | awk '{print $2}' )
REDVALUE=$( echo $RGBO | awk '{print $1}'  | cut -d. -f1 )

The largest REDVALUE wins for each row

Well, this is about it.

How to install imagemagick?

The use and installation of ImageMagick can intimidating, but this image manipulation package is the most powerfull I have encountered so far. As the installation from source can be a hassle for native OS X users I advise you to use Homebrew.

To install ImageMagick using Homebrew run this oneliner in your terminal:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Homebrew is now installed, it is wise to follow the installer's suggestions after installation. Now we install ImageMagick using brew.

brew install imagemagick

Now we can use imagemagick and its convert tool as in the examples above.

Solution 2:

I am an open source enthusiast so had a look at ImageMagic to see if it is open source, it is, however the project is based in the US. I want to see if I can help you with a German university open source project base called SDAPS.

SDAPS is specifically an OMR program.

http://sdaps.org/SDAPS

I've downloaded your test page and will try to use it to provide an answer to your question using SDAPS.