Week Two
Back to Journal
Week Two: Learning About OCR
After getting acquainted with the Android platform, I spent this week learning about optical character recognition (OCR), the intermediate step between taking a picture with a phonecam and translating its text content. OCR has been around for awhile, particularly for use in generating an editable version of a printed, scanned document, but OCR for text in photographs is a newer, more difficult nut to crack. Since computers can't "see" images - they can't recognize patterns amidst input colors of light, unlike humans - the process of recognizing alphabet-like patterns within a large, complex image is rather involved. While tesseract, the OCR engine I found last week, already does this to some extent, it is streamlined for analyzing scanned documents, so to make tesseract work with phonecam photos I have to do a bit of preprocessing to reduce the rotation and skew introduced by human (often novice) photographers.
The first step in my preprocessing is detecting where text is, so I can rotate and reduce skew on that specific region. There are lots of approaches to text detection, many of which involve either edge detection or connected components analysis. I was more attracted to the connected components approach, which involves finding regions of similar color that are adjacent, simply because I didn't already have the background mathematical knowledge it takes to implement edge detection. I decided to implement a text-detection algorithm, as described in
this paper with a morphological approach to finding connected components. Since MATLAB has an image processing toolkit that includes morphological operators, I dusted off my pidgin MATLAB skills to write a MATLAB script that will select a bounding box around the largest column of text within an image, using a slightly simplified version of Hasan and Karam's algorithm.
For fun this week I've been going to run and do yoga classes at a gym I joined in Princeton. I've been meaning to start working out - though I may look like I'm in shape, I haven't exercised regularly since... maybe never... and have no cardio health or flexibility - and was glad to find a really great place while "gym shopping" this past weekend. My favorite summer TV show, So You Think You Can Dance, also just started, and it has been fun to introduce my housemates to it and watch them become as attached to it as I am.