How to Implement Data Capture Processing

 Note: Before you begin, see Build your application with the library for Android.

To implement the document data capture scenario, follow these steps:

  1. Begin with the Callback interface implementation. Its methods will be used to pass the data to and from the recognition service. Here are the brief recommendations on what the methods should do:
  2. Call the Engine.load method on the UI thread to create an engine object via which all other objects may be created. This object should be reused for every new operation and should not be created again in the same activity.
  3. Use the createDataCaptureService method of the Engine object to create a background recognition service (implementing the IDataCaptureService interface). Set the type of document you are going to capture using the profileName parameter — for example, "BusinessCard". The service is created and will further work with this profile.
    Only one instance of the service per application is necessary: multiple threads will be started internally.
  4. When the camera is ready, call the start method of the IDataCaptureService interface. Its required input parameters are the size and orientation of the video frame and the rectangular area of interest (e.g. if your application displays a highlighted rectangle in the center of the image, this rectangle should be specified as the "area of interest").
    The service will then start up several working threads and continue interacting with your application via the Callback interface.
  5. Whenever the Callback.onRequestLatestFrame method is called, provide the current video frame from the camera by calling IDataCaptureService.submitRequestedFrame.
  6. The Callback.onFrameProcessed method will be called on the UI thread to return the result. Its parameters are:
    • a DataScheme object; use its Id property to determine what recognition scheme has been applied to the document (some profiles provide two or more recognition result schemes), and its Name property to display a human-readable description to the user, if needed.
    • an array of DataField objects, each representing one of the fields found and recognized. A DataField object provides the identifier and the human-readable name for the field, the field text, and its location.
    • the result stability status, which indicates if the result is available and if it is likely to be improved by adding further frames. Use it to determine whether the application should stop processing and display the result to the user. We do not recommend using the result until the stability level has reached at least Available and the data scheme has been matched.
  7. Save the results for the recognized page. Call the IDataCaptureService.stop method to terminate the processing threads and clean up image buffers.

See the description of classes and methods in the API Reference section.

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.