Re:Ask HN: Trying to Extract Roll Call Votes of Cambridge Ci...
by dagw on Tuesday October 06, 2015 @03:43PM
(#10341763)
Actually forget OCR. Just find the y and x coordinates of each horizontal and vertical line, and then clip out each box in the grid using those coordinates. Count black pixels and done.
I hacked together something in python (because I had laundry to do :) ) and it seems to work pretty well.
Re:Ask HN: Trying to Extract Roll Call Votes of Cambridge Ci...
by dagw on Tuesday October 06, 2015 @05:14PM
(#10342444)
Quick hack, badly tested, but seems to work:
https://gist.github.com/dwastberg/9faea8a4ceb6dc05b52e
Re:Ask HN: Trying to Extract Roll Call Votes of Cambridge Ci...
by dagw on Wednesday October 07, 2015 @04:40AM
(#10344852)
Of course this code breaks if the scan isn't straight.
Re:Ask HN: Trying to Extract Roll Call Votes of Cambridge Ci...
by semiquaver on Wednesday October 07, 2015 @04:46PM
(#10348969)
You're already using imagemagick's `convert` in that script - there's also `textcleaner -u`[1] which among other things automatically straightens slightly crooked text in scans (less than 5 degrees).
OpenCV should be able to do all these things.