Enchilada Enchilada - 29 days ago 16
Objective-C Question

OCR (reading text from photos) in Cocoa?

Is there any code out there, that I can use in Cocoa, to recognize text from photos? Let's say I snap a photo with my iPhone of a page of a book. I'd like to capture the text in it.

Answer

There is the Tesseract OCR toolkit that is an open source OCR engine, currently maintained by Google. "Olipion" created a cross compilation tutorial to get in on the iPhone. I would say that this is a good place to start.

However, there are reasons why you might not want to to OCR on the Phone even if you could. Some of these include:

  • Even the new iPhone 4's processor is not that fast and since you app can't really run in the background doing the processing, the user experience might not be optimal.
  • Running OCR on a mobile device would probably be a killer for battery life.
  • Every time you would want to update the OCR engine everybody who installed your app would have to upgrade.

For an always connected mobile device running the OCR on a server somewhere would be probably better. You could upgrade your OCR software easily, you could run much more powerful algorithms then a mobile device could handle and so on.

I am not so sure that you would be able to get good results from photos taken using a mobile camera -- accuracy of OCR systems goes way down with the kind of poorly lit, noisy, distorted images likely to be captured using a phone camera.

As far as commercial products out there, there is Evernote that gives you a OCR capability if you buy their premium service.

As an alternative to machine OCR, there is always Mechanical Turk, where you could pay people small amount to do the OCR for you. Would probably do better at transcription given the image source.