On Mon, May 21, 2012 at 11:54 AM, Richard <legalize at xmission.com> wrote:
Is there something similar for punched cards as well?
I started to write one years ago (beginning with scanning the punch
cards with a colored background to make the holes stand out) and did
get edge and orientation detection working, but the per-card handling
time on the scanner lead me to drop work on the project. If you were
scanning a short stack of cards, it wasn't so bad, but a 3 foot deck?
You'd spend a lot of time just getting the cards in and out of the
scanner.
My code wasn't anything magical - it used Tom Boutell's GD library to
imported a monochrome GIF of a scan of the *back* of the card (to
eliminate "noise" from the printing on most cards) then did a fairly
uninspired search for the outer boundaries, then did an estimation of
where the holes ought to be (based on the discovered dimensions of the
edges) and did a simple (3x3) kernel sum of the targeted coordinate
and if it was mostly "white", it was a zero, mostly black, a one. You
couldn't skew the cards 45 degrees and expect it to work, but it was
resilient enough to work with a little skew.
-ethan