OCR and Swift

Hello,


I want to learn how to create a relatively simple app that will use OCR to identify typed (not handwritten) text. It will need to read text from a url on a computer screen taken from a picture on a phone, and copy that information to a clipboard for pasting.

The last time I coded was HTML 5-6 years ago in high school, although I did slighly dabble in java last year at college. My question is, before I start learning how to use swift, will I be able to incorporate OCR using Swift? What type of code can I start off learning that is able to be implemented as an iOS iPhone app, and can support OCR in the way I want? Again, I'm not looking for something to understand handwritten text as I know that is where things get very complicated. I'm looking to keep things simple yet still produce the OCR app I want.


After a wiki search, it looks like the technique "matrix matching" seems to be the most simple to achieve this, where the program compairs an image to a stored glyph on a pixel-by-pixel basis. What code can be used to do this for a beginner?

Writing image matching functionality all by yourself is not an easy thing even for super-experienced iOS programmers. (Simple pixel-by-pixel matching does not work in almost all cases.)

It's the same even if you restrict the functionality only for typed text. If you can spend a few years to study image processing in a high-level computer science college, you'll get to be able to do it, which you may not intend.


You'd better find a framework which supports OCR. Unfortunately there are no Apple's frameworks for OCR, so you need to find some third-party libraries.

One (and the only one) famous framework is called tesseract and you can find many articles searching with "tesseract ios swift".


Using tesseract may not be so simple as you expect, but if you really want to include OCR functionality in your app, you need to learn it.

Hi OOPer,


With iOS12 still not having framework for OCR? if not, is the Tesseract sill the only option?


Thank you for your help.

João Fontes

As far as I know, still no is the answer for the first question.

You can find a few alternatives than Tesseract, but according to the articles I have found till now, each of them has some flaws in practical use. (Sorry, I have not tested them myself.)


Usually, you can get more chance to get an Answer from Apple's engineers if you post a question to the appropriate area like Vision Computer vision framework.

But seems Vision team members are too busy to respond to questions in the forums. Hope they are developing an Apple-made OCR feature.


You can write a feature request to Apple.

OCR and Swift
 
 
Q