-
Notifications
You must be signed in to change notification settings - Fork 948
Installation
If you're starting from scratch, the "Template Framework Project" in this repository provides an example of how to use Tesseract in your iOS projects. It's iOS7 and arm64 ready!
Option 1: Using CocoaPods (HIGHLY RECOMMENDED)
Add the following line to your Podfile then run pod update
pod 'TesseractOCRiOS', '3.4.0'
Add the following line to your Podfile then run pod update
pod 'TesseractOCRiOS', :git => 'https://github.com/gali8/Tesseract-OCR-iOS.git'
** WARNING **: This uses the GitHub repository's master branch as the source for the library. This is not based off of any stable Tesseract OCR iOS release.
-
Copy the framework file "TesseractOCR.framework" (you can drag and drop it) from the Products folder in this repo, to your XCode project under the Frameworks folder.
-
Link against the
libstdc++.6.0.9.dylib
library and theCoreImage.framework
framework (Your target => General => Linked Frameworks and Libraries => + => libstdc++.6.0.9 and then CoreImage.framework). -
Go to your project, click on the project and in the Build Settings tab add
-lstdc++
to all the "Other Linker Flags" keys. -
Go to your project settings, and ensure that C++ Standard Library => Compiler Default. (thanks to @trein)
-
Copy and import the
tessdata
folder from the Template Framework Project into the root of your project AS A REFERENCED FOLDER (see below). It contains the Tesseract trained data files. You can add your own trained data files here too. -
Import the Tesseract header in your classes to start using Tesseract:
#import <TesseractOCR/TesseractOCR.h>
NOTE: This library currently requires the tessdata folder to be linked as a referenced folder instead of a symbolic group. If Tesseract can't find a language file in your own project, it's probably because you created the tessdata folder as a symbolic group instead of a referenced folder. It should look like this if you did it correctly:
Note how the tessdata folder has a blue icon, indicating it was imported as a referenced folder instead of a symbolic group.