detectDocumentBoundary method

Detects a quadrangle representing document boundary on an image.

AbbyyRtrSdk.detectDocumentBoundary(callback, options)

Parameters

options
Object specifying parameters of the document boundary detection (see Options).

Return values

The method returns result depending on how the document boundary detection finished (see Result).

Options

The table below describes parameters that you can pass as the options argument to change document boundary detection 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.

areaOfInterest object

A rectangle specifying the area of interest in the coordinates, 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

I.e., {top: 100, bottom: 1000, left: 100, right: 1000}

 Note: All parameters should be defined to set the areaOfInterest parameter. If some of them are defined and some are not, an error occurs.

Default: a rectangle, containing the whole image.

detectionMode string

Document boundary detection mode. The mode influences the crop speed and accuracy.

This parameter can be set to the following values:

  • 'Fast' - this mode signifies processing speed
  • 'Default' - balanced mode, that combines optimal processing speed and high quality.

Default: 'Default'.

documentSize object

Document size represented by its width and height in millimeters. The values of the width and height are set to the documentSize parameters:

  • width (float)
  • height (float)

I.e., {x: 210; y: 297} for A4 document size.

To leave the document size undefined, set both width and height to 0. In this case document of any size will be detected.

Result

This section describes the object that represents image capture results. Returned parameters depend on the scenario.

Parameter Value type Description
documentSize object

Detected document size represented by its width and height in millimeters. The values of the width and height are stored in the documentSize parameters:

  • width (int)
  • height (int)
documentBoundary object

Quadrangle containing the whole document. It is represented by an array of its four vertices' coordinates: { x: int, y: int }. The vertices are indexed clockwise starting from the bottom left.

Default: coordinates of a quadrangle, containing the whole image.

When document boundary is not detected, this parameter is not returned.

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.