assessQualityForOcr method

Estimates if an image quality is suitable for OCR. The whole image is represented as a set of rectangles. A type of rectangle can be either text or unknown. The quality assessment of the image for OCR is calculated based on the rectangles collection.

 Note: This is a technology preview feature. The functionality will be improved and completed in future versions.

AbbyyRtrSdk.assessQualityForOcr(callback, options)

Parameters

options
Object specifying parameters of the image quality assessment (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 image quality assessment 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

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.

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.

Result

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

Parameter Value type Description
qualityAssessmentForOcrBlocks object[]

Collection of rectangles with corresponding quality assessment for each of them. Each rectangle can have the following parameters:

  • type (string): rectangle type for quality for OCR estimating. Can be 'Text' or 'Unknown'.
  • quality (int): for blocks with 'Text' type this parameter stores a value from 0 to 100 that indicates suitability of the text for OCR.
  • 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

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.