Capture Data from Documents

Documentation Menu

This guide describes the procedure you need to follow to create an application for your Android device which captures data from a specified type of document, without snapping a photo.

How it Works

In data capture scenarios, the processing quality is improved by the fact that we know which kind of fields may be expected on the document. When you start capturing, you specify the type of document you are going to recognize (a data capture profile). The Real-Time Recognition SDK engine will automatically request new camera frames and process them, trying to apply corresponding result schemes. The engine uses each new frame to verify and improve the recognition result from the previous frame. This process is continued until a specific result scheme is matched and the result reaches the required stability level.

For some data capture profiles, there are two or more corresponding result schemes. The difference between a data capture profile and a result scheme is the following:

  • A data capture profile is the general type of document you specify to the engine — for example, a bank card or some document with a machine-readable zone (MRZ).
  • A result scheme is a more specific identifier of the recognized document, returned by the engine — for example, an embossed or unembossed bank card, or a specific MRZ (from a passport, visa, travel document, and so on).

The profile you specify determines which result schemes may be applied during recognition, and the result scheme determines which document fields will be recognized and returned as the result. Data capture profiles and corresponding result schemes supported in Real-Time Recognition Android library are detailed in Data Capture Profiles; see also the summary below in Supported ID Documents.

note Note: Predefined data capture profiles are available only in the extended version of the library.

Note that Real-Time Recognition library for Android also allows you to create custom data capture profiles for documents that are not supported out-of-the-box. See Capture a Custom Data Field for the description of this scenario.

Supported Documents

Real-Time Recognition SDK provides predefined data capture profiles for many types of data, including:

  • machine-readable zone (MRZ) in various documents,
  • international bank account numbers (IBAN),
  • bank card details,
  • data from ID documents:
    • ID cards,
    • passports,
    • driver's licenses, and other.

Recognizing with predefined profiles does not require you to set specific rules or specify regular expressions that should match document fields. You simply specify a data capture profile (the general type of a document) and get recognized data with a more specific result scheme identifying the recognized document.

MRZ

Real-Time Recognition SDK can automatically detect and recognize the machine-readable zone (MRZ) on various ID documents: passports, ID cards, travel documents, and other. For details on supported MRZ types and recognized data, see MRZ profiles.

dcdocs_mrz_2line

dcdocs_mrz_3line

For example, when recognizing a 2-line or 3-line MRZ of a passport or an ID document, Real-Time Recognition SDK will recognize and extract the following data:

  • Document type and subtype
  • Document number
  • The country where the document was issued
  • Document holder's first and last name, date of birth, sex and nationality
  • Document holder's personal number
  • Document expiry date

IBAN

Real-Time Recognition SDK allows to automatically detect and extract international bank account numbers for Germany, France, Spain, and the United Kingdom. IBAN can be extracted from any document.

dcdocs_iban

Bank card

Real-Time Recognition SDK can capture data from debit and credit cards, embossed and unembossed.

dcdocs_card_embossed

dcdocs_card_unembossed

When recognizing a bank card, Real-Time Recognition SDK will detect and extract the card number, cardholder's full name, and date of expiry.

ID documents

Real-Time Recognition SDK can automatically extract data from various ID documents such as ID cards, driver's licenses, passports, and other documents from different countries (see Data Capture Profiles for detailed information).

dcdocs_id_deu_type1

For example, when recognizing the front side of a German ID card, Real-Time Recognition SDK will detect and extract the following data:

  • Document number
  • Document holder's first and last name, nationality, date and place of birth
  • RFID number
  • Document expiry date

The rest of the data in the German ID card scheme is recognized from the back side of the card; note that the data capture profile you specify and the result data scheme are the same for both card sides.

Implementation

note Note: Before you begin, see Build your application with the OCR 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, "IBAN" or "MRZ". The service is created and will further work with this profile (for a full list of available profiles, see Data Capture Profiles).
      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 where to search for the text (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. For details on recognition schemes corresponding to the profile you selected, see Data Capture Profiles.

warning Important! If null is passed instead of a valid DataScheme object, the data scheme has not yet been matched, which may mean that the document the user is trying to recognize is not a passport. In this case, the results are not usable.

    • 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.
  1. 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.