Working with Images in Emacs

Over at Bytopia, Alex has a beautiful post on using Emacs to work with images. Alex is trying to train an OCR classifier to recognize characters from grocery store receipts. He started by scanning 4 or 5 receipts and breaking the characters into individual images. Next he needed to assign the proper character to each image.

That’s where Emacs comes in. First, he uses turn-on-iimage-mode to turn a buffer of a directory of image files into a buffer of the corresponding images. A nice thing about this mode is that when the cursor is on an image you can still read the image file name. That and a bit of Elisp allow Alex to specify the character in each image (or delete the image if it’s garbled) and prepend the character to the file name. With a little more massaging, these images are used to train the classifier.

It’s astounding how little code all this takes. Head on over to Bytopia to see how he does it. Once again, Emacs and just a little Elisp easily solves a problem that would take considerable effort if one where to do it with a script or, worse, as a C application.

This entry was posted in General and tagged . Bookmark the permalink.