iOS OCR quick start guide
If you develop an OCR application for iOS, you need an OCR engine capable of capturing data from low-quality images, not requiring much processing power and memory space. ABBYY Cloud OCR SDK is the perfect solution for this case. OCR on iPhone can be performed easily with full set of professional features provided by ABBYY SDK. These are: 200+ recognition languages, special recognition modes, and image preprocessing features. Though OCR process is CPU-intensive, iPhone app with ABBYY Cloud OCR will need no additional system resources, only an Internet connection will be necessary.
Follow these few steps to try Cloud OCR for iPhone:
- To develop an app for iPhone, you need iOS SDK and Xcode. You can download Xcode in Mac App Store.
- If you are not a registered user, register. Registration procedure takes very little time, and you can use your Google or Facebook account. After the registration is completed you have an Application ID and Application Password, which are necessary for the application to function. See details in Authentication.
- Try out iPhone OCR SDK from ABBYY using the sample project. You can download the code sample from GitHub.
- Before running the program do a little configuration. Customize the URL for HTML requests according to the processing location. The URL is set in the Sources/Client.m file.
- Provide your credentials to connect to Cloud OCR server in the Sources/OCRDemoClient.m file. Set kApplicationID and kPassword constants and remove the line marked #error.
#error Provide Application ID and Password static NSString const * kApplicationID = @"<#your application id#>"; static NSString const * kPassword = @"<#your application password#>";
- The sample is pre-configured to recognize English texts. If you recognize text in other language, you need to change the behaviour using kRecognitionLanguages and kExportFormat constants in Sources/OCRMainViewController.m.
static NSString * const kRecognitionLanguages = @"English"; static NSString * const kExportFormat = @"txt";
- Run the app in Simulator. To run the application on a device, you need to enroll as an Apple Developer in the iOS Developer Program.
- If you are testing the app on a device, take a photo of some text by tapping Take photo. If you are testing in Simulator, you can use the sample image Resources/sample.jpg.
The procedure uses standard iOS SDK method calls and is implemented in Sources/OCRMainViewController.m.
- Tap Recognize and wait for the result.
The recognition procedure uses HTTP POST processImage method of ABBYY OCR SDK for sending data to an HTTP server. You can find other processing methods in API Reference. Selection of the recognition method depends on your task and the type of documents you are going to process. Cloud OCR SDK server returns an XML response for each method call. The XML response contains the status of the processing task and some other information. After the image is uploaded, you should monitor the status of the task using the getTaskStatus method. Find details on the task status management in How to Work with Cloud OCR SDK.
- When the image is recognized, you can see the result on the screen.
The reference to the output result is provided in the XML response returned by the server.
- Now you can make modifications to the sample to fit your scenario of OCR on iOS.
Need an offline iPhone OCR SDK? Pay attention for ABBYY Real-Time Recognition SDK.