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

  • Do you have any solution at all for this problem currently (besides checking visually)? – nohillside Oct 5 '13 at 13:20
  • No, I don't have a solution right now. – myhd Oct 5 '13 at 13:23
  • 1
    So maybe restricting it to the command line might prevent solutions which have a GUI and can still be automated from within the application. Do you want to broaden the scope a bit to look for any application solving the problem? – nohillside Oct 5 '13 at 14:03
  • @patrix Done!!! – myhd Oct 5 '13 at 21:14
  • What format are the scanned documents? – Ruskes Oct 8 '13 at 18:31

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)

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.


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.


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

  • This project looks promising, I am looking forward to your answer... – CousinCocaine Oct 15 '13 at 9:13
  • Don't think I will finish my answer before the bounty expires but there you go, work comes first. – Deesbek Oct 15 '13 at 13:27
  • Yeah, that's a bummer. But this piece of software might do a better job than my hack. – CousinCocaine Oct 15 '13 at 13:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .