I'm working on an OCR functionality around checks, specifically around a user taking a photograph of a check, and I'm looking to acquire a data set to quantify the success of our various features.

Does anyone know of such a set already in existence that meets these requirements?

  • Although it may not be an exact match due to content, as you're looking for handwriting samples, the USPS takes pictures of envelopes .... but I don't know if it qualifies as PII, and exempt from FOIA requests. (it's also come out since then that they were imaging all envelopes, not just the hard-to-read ones.)
    – Joe
    Apr 16 '14 at 12:53
  • This is an interesting source. I'm specifically looking at feature detection and isolation around MICR encoding on checks, so PCA isn't really a part of the problem before me. I'll keep this in mind though! Apr 17 '14 at 13:43

This is an interesting question. Here is a non-direct path (assuming you are using Windows).

TL;DR print hard copies with check font, scan/photograph them, use OCR.

I used Python to write the few MICR characters in Unicode. I use the utf-16-le (little endian) encoding with BOM.

import codecs
with open('micr.txt','wb') as output:
    for ichar in xrange(9280,9280+11):
        line = ( u'1'+unichr(ichar)+u'\n').encode('utf-16')
    output.write( (u'0123456789'+u'\n').encode('utf-16') )

The output looks like this (I suggest using Notepad++ or another high-level text editor). It's required to have some character before each of the non-numeric MICR unicode characters, I just chose '1' for simplicity:


These are all the possible unicode characters for MICR. Of course, the font is wrong. (A simpler method would be to copy paste from here)

The MICR font costs money, unfortunately, but there is an open version: GnuMICR. You can download the font directly here: GnuMICR.ttf. To install, just double click and then restart and running programs where you want to use it.

I then took my output text from above, and pasted it into LibreOffice Writer (other MS Word-like programs will work, too). Highlight all the text and change the font to GnuMICR. I've shared the LibreOffice Writer .ODT file here (you must have the GnuMICR font already installed).

The screenshot below shows what my screen looks like.

Screenshot of LibreOffice Writer with the GnuMICR font and unicode characters

From here, you can use the Python code or lots of copy/paste to generate unlimited routing and account numbers. Let me know if you want a python snippet to generate fake routing/account numbers.

To really test the OCR, generate your own MICR documents by physically printing your digital "checks" and then scan/photograph (re-digitize) them. Between printing and scanning you can have some fun by folding, spilling coffee, etc.

You can also digitally damage the images, for example, by using Python Imagine Library (PIL) and methods such as discussed here.

  • 1
    What a great answer! I like this as a concept a lot. I think that deploying this in conjunction with some artificial noising and exposure confluence could give us a really strong data set. Apr 23 '14 at 13:17
  • Glad you like it. I realized half-way that you can skip the coding and just copy-paste.
    – philshem
    Apr 23 '14 at 15:22
  • 1
    Please consider sharing this data set once you've created it.
    – philshem
    Apr 30 '14 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.