How to Implement Text Capture with User Interface

 Note: Before you begin, see How to Add the Library to Your Xcode Project.

  1. Add the NSCameraUsageDescription and NSPhotoLibraryUsageDescription keys into the info.plist file for requesting access to the device’s camera and to the user’s photo library.
  2. Create an instance of the AUICaptureController interface for managing user interface and starting capture scenario. On this step you can use the properties of this interface to tune the user interface appearance and the settings of the camera.
  3. To get access to the processing mechanisms for the chosen scenario create an RTREngine object using the sharedEngineWithLicenseData: method. The method requires an NSData object containing your license data. For example, you can use dataWithContentsOfFile: to create a data object, then pass this object to the sharedEngineWithLicenseData: method.
  4. Create an instance of an interface inherited from the AUICaptureScenario for managing the capture scenario. Choose the inherited interface for the data capture scenario: AUIDataCaptureScenario interface. Pass the previously created RTREngine object as an input parameter to the constructor.
  5. Configure capture process, using the AUIImageCaptureSettings protocol and the AUIDataCaptureSettings interface. These objects are read-only, so you should change necessary settings via the dataCaptureSettings and the imageCaptureSettings properties of the AUIDataCaptureScenario interface.
    1. Configure the capture of an image via the imageCaptureSettings property. I.e. you can set a document size and a minimum document to view ratio.
    2. Configure the data capture via the dataCaptureSettings property. Set the profile property to a "Text" NSString value to set the scenario type. The parameter is case sensitive.
      Tune scenario settings using properties of the AUIDataCaptureSettings interface if necessary. I.e., you can set recognition languages and an area of interest. All settings are optional.
      Call the checkAndApply: method to check the properties consistence and apply the settings to the data capture scenario.
  6. Implement the delegate interface, corresponding to the scenario object, and its methods. I.e. for AUIDataCaptureScenarioDelegate interface you should implement these methods:
    1. The dataCaptureScenario:didFinishWithResult: method returns the recognized result as an AUIDataCaptureScenarioResult object
    2. The dataCaptureScenario:didFailWithError: method delivers error messages
    3. The dataCaptureScenarioDidCancel: method notifies that the scenario was canceled.
  7. Add the instance of the interface as a delegate property of the AUIDataCaptureScenario object.
  8. Set the created scenario object as a captureScenario property of the AUICaptureController object. Scenario will start immediately at the camera start.
  9. If any error occurs while processing, the capture scenario becomes temporary passive and the paused property of the AUICaptureController object is set to true.
  10. Process the messages sent by scenario to the delegate object. The result will be delivered as an AUIDataCaptureScenarioDelegate object, storing the AUIDataCaptureScenarioResult object.

02.03.2022 12:59:15

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.