extractData method

Starts data capture for a single image. Data fields will be detected and recognized on the captured image according to the passed settings. One of the settings is a date capture profile, representing a type of a document to be recognized, i.e. a business card. The profile defines a data schema, describing document fields. The profile schema is applied during the capture process.

Result will be returned with some technical information such as warnings, if any, and text orientation on the image.

 Note: The functionality is currently supported for business cards recognition only.

AbbyyRtrSdk.extractData(callback, options)

Parameters

options
Object specifying parameters of the data capture scenario for a single image (see Options).

Return values

The method returns result depending on how the scenario finished (see Result).

Options

The table below describes parameters that you can pass as the options argument to change data capture settings. Omitting a parameter means that a default setting will be used.

Parameter Value type Description
licenseFileName string

The name of the license file. This file must be located in the /assets/ directory in your project.

Default: "MobileCapture.License".

imageUri string

imageUri (string): Image source for the operation passed as URI. This parameter can be set to the following values:

  • "Base64": you can pass an encode base64 image string, i.e. "data:image/jpeg;base64,<base64 encoded image data>"
  • "File": image file address, i.e. "file:///data/user/0/com.abbyy.rtr.reactnative.sample.coreapi/files/pages/page_848b121d-5a7a-4ead-94e6-dd91bc6bfead.jpg".
    'content://' schema is also supported for Android.

Required parameter.

profile string

The profile name. I.e. 'BusinessCards'.

 Note: The functionality is currently supported for business cards recognition only.

isTextOrientationDetectionEnabled boolean

Enables or disables detection of the image orientation while preprocessing.

If the property is set to true, the image top is detected and correct orientation can be used for image rotation.

You can set this property to false for speeding the process up.

 Note: Disable the image detection only if you can be sure that the captured image has correct orientation. Otherwise the text on image will not be detected and recognized.

The default value of this property is true (enabled).

recognitionLanguages string[]

List of languages, supported for the text recognition, i.e. ['English', 'Russian'].

See the full list of supported languages here.

Default: ['English'].

Result

This section describes the object that represents data capture results. Returned parameters depend on the captured and passed image.

Parameter Value type Description
orientation int

An angle on which the image was rotated to get normal orientation. Possible values are: 0, 90, 180, 270.

warnings string[]

Warnings that occurred during processing, if any.

dataFields object[]

List of objects representing captured and recognized data fields. Each data field has the following parameters:

  • id (int): internal identifier of the data field.
  • name (string): human readable name of the data field.
  • text (string): recognized text of the data field.
  • quadrangle (object): quadrangle containing text, represented by an array of its four vertices' coordinates: { x: int, y: int }. The vertices are indexed clockwise starting from the bottom left.

  • rect (object): bounding rectangle for quadrangle. The rectangle is set by the following parameters:

      • top (int): upper left point ordinate
      • bottom (int): bottom left point ordinate
      • left (int): upper left point abscissa
      • right (int): upper right point abscissa
  • components (object[]): field components. If the field has only one component, this array contains one element. This property may be 0, if the field is not compound. In this case result does not contain components. Each component can have the same parameters as dataField including components array.
  • charInfo (object[]): an array, which elements contain information concerning concrete recognized symbol.
dataFields.charInfo object[]

An array, which elements contain information concerning concrete recognized symbol. This object contains parameters, describing the symbol's place at an image, and its recognition confidence.

  • quadrangle (object): quadrangle containing text, represented by an array of its four vertices' coordinates: { x: int, y: int }
  • rect (object): bounding rectangle for quadrangle. The rectangle is set by the following parameters:
      • top (int): upper left point ordinate
      • bottom (int): bottom left point ordinate
      • left (int): upper left point abscissa
      • right (int): upper right point abscissa
  • isUncertain (boolean): returned only in case the symbol is uncertain.

Example of a result JSON.

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.