IWebCapture interface

This interface provides access to all capture settings.

interface IWebCapture

The following table describes the options available for capturing process configuration. All the settings are optional.

Name Type Description
Initialization settings
licenseFilePath string

A path to the License file. This property should be set according to your personal License file name. You can set either absolute or relative path. Please note, that the relative path refers to the wasmFilesPath property value, as the license is used inside the wasm files code.

 Important! This parameter value is case sensitive.

Default value of this property is an absolute path '/libs/js/MWC.ABBYY.License'.

 Note: If the licenseFilePath was defined in the init method options, the value of this property in capture method will be ignored.

wasmFilesPath string

A path to folder storing the wasm files. You can set either absolute or relative path. Please note, that the relative path refers to the file calling current method.

 Important! This parameter value is case sensitive.

Default value of this property is a relative path 'libs/js'.

 Note: If the wasmFilesPath was defined in the init method options, the value of this property in capture method will be ignored.

Scenario screens settings
mode CaptureMode

Defines if the whole scenario or concrete scenario part is started by the capture method.

Depending on this option value, input and output parameters of the capture method may differ. See the CaptureMode description for details.

User interface settings
localizedStrings object

JSON object containing the interface strings. If you are implementing a non-English user interface, you can define the string resources, uploading a JSON file with messages in required language to this parameter or defining them inside your code.

Investigate the /libs/js/index.d.ts file to view available source strings described in the ILocalizedStrings interface.

By default the object is set to {} (is empty), which means, that user interface is performed in English.

viewConfiguration object

JSON object containing the user interface settings. To adjust your web-site user interface, i.e. elements color, define the settings in a .json file. The settings can be general, that will be applied to all the screens, and local for each separate screen tuning.

 Note: General settings are preferred over separate screens customization. Exceptions: "Add page" button, "Done" button and "Continue" button. These buttons should be tuned for every screen separately.

Investigate the How to customize user interface section for details and JSON example..

startPage number

Index of the image from the images array. This image will be shown at the application start instead of the camera stream, if the images parameter is not empty.

 Notes: 

  • If maxImagesCount property is specified, this parameter should be less than or equal to maxImagesCount. Otherwise an error occurs.
  • If maxImagesCount property is not specified and the startPage parameter is set to a value larger than or equal to the total count of the images array elements, the camera stream will be shown.

Default value of this property is 0.

Capture settings
aspectRatioMin* number

Lower limit of the document's aspect ratio.

This property is used in pair with the aspectRatioMax, defining an interval of acceptable aspect ratio values of the document to be captured. Setting aspect ratio will help to improve boundary detection accuracy.

If only aspectRatioMax is set, aspectRatioMin will be set to 1.

By default the property is set to 0 (aspect ratio is not set).

aspectRatioMax* number

Upper limit of document's aspect ratio.

This property is used in pair with the aspectRatioMin, defining an interval of acceptable aspect ratio values of the document to be captured. Setting aspect ratio will help to improve boundary detection accuracy.

If only aspectRatioMin is set, aspectRatioMax will be set to Number.MAX_SAFE_INTEGER.

By default the property is set to 0 (aspect ratio is not set).

* Note: Aspect ratio is calculated by division of the upper limit to lower limit and is expected to be greater than or equal to 1 (or 0 if not set).
enableAutoCapture boolean

Defines if the real-time capturing from the camera preview is enabled. If true, the module will search for the best-quality frame, capture it and crop the image. Otherwise the image should be captured manually.

Default value of this property is true.

enableAutoCrop boolean

Specifies if the original document should be automatically cropped.

If true, the module will correct perspective distortion and the image will be cropped according to the detected document boundary. In the preview mode the cropped image will be shown.

if false, the image will be captured and shown in preview mode as is.

The original image with detected document boundary is shown on the crop page for both crop modes.

Default value of this property is true.

enableCamera boolean

Indicates if the images will be received from the camera stream. If true, the camera stream will be enabled on the screen. Otherwise the camera preview will be hidden. In this case the image can be loaded from the photo library.

Default value of this property is true.

enableQualityAssessmentForOCR (feature preview) boolean

Indicates if the image quality assessment for OCR should be calculated. If true, the module will detect quality of the captured image and calculate assessment of this image quality for OCR. In case the quality is poor, warning will be shown.

Default value of this property is false.

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

enableSharpnessFilter
(feature preview)
boolean

Indicates if low text documents or documents with blurred text should be filtered from capture in video stream.

Capture module estimates sharpness of the text on image. Hence you can filter from capture images, containing not enough sharp text on them. If this property is set to true, images with blurred text will be prevented from capture. This setting filter low text documents or documents with no text on them either. Image will not be captured and an error message "Not enough sharp text on the document" will be shown.

 Note: Approx. one paragraph on an A4 list is considered to be enough text on a document for capture with enableSharpnessFilter set to true.

Use this setting in scenarios, when documents with lot of text on them are intended to be captured.

If this property is set to false, capture process will proceed regardless of detected sharp text amount on document.

Default value of this property is false.

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

frameBoundaryPadding number

Value defining the padding area for the capture frame. This value influences required position of the image corners on the screen frame. All four corners should be located inside the red area. In case the corners of the image do not fit this condition, the image will not be captured and a tip "Closer" will be shown.

The value is set in percentage and should be from 1 to 50:

  • if the value is set to 1%, the corners must strictly match the screen frame
  • if the value is set to 50%, the corners of the image can be located in any part of the screen frame

By default the property is set to 15%.

maxImagesCount number

Upper limit of images to be captured by the module during one session.

The value of this property should be larger than or equal to 1.

Default value of this property is Infinity.

minCameraResolution number

Lower limit of the device camera resolution, required for capture from browser. Capture via camera will be available only for devices with camera resolution equal to or greater than set by this value. Loading from gallery is available for all devices, regardless this parameter value.

Property is set to an integer, that defines a lower resolution limit by the width size. I.e. if the value is less than or equal to 600, all devices with camera resolution SVGA 800x600 and higher will support capture from camera. If minCameraResolution is set to a value greater than 600 and less than 720, the minimum camera resolution should be HD 1280x720.

By default the property is set to 1000, which means that camera resolution not less than 1920x1080 is required for capture.

preferredCameraResolution string

Camera resolution, set for the video stream. This value defines resolution of camera frames in video stream and resolution of captured image consequently. Some cases require high image resolution for accurate processing results. In such cases 4K resolution should be used.

 Important! This property value influences camera FPS. Please, take into account, that choosing "4K" will cause delays in processing.

Property can be set to one of the following values:

  • 4K (3840x2160)
     Note: This value is a technology preview feature. The functionality will be improved and completed in future versions.
  • FullHD (1920x1080)
  • Auto (optimal resolution, appropriate for current device

 Note: If device camera resolution is less then FullHD, maximum device camera resolution value will be taken as preferredCameraResolution value.

Default value of this property is "Auto".

Result settings
images ICaptureResult[]

Array of result images in the internal format, saved after the last capturing session. Passing an empty array to the capture method will start a session with no images in memory and in this case a camera stream will be shown at the application start. If the input array is not empty, an image with index set by the startPage property will be displayed instead.

Default value of this property is [].

jpegQuality number

Quality of captured JPEG image in percents and should be from 1 to 100.

 Note: The higher is the quality, the more time will be required for recognition.

Default value of this property is 80, since it is the optimal value for a wide range of devices.

documentSize IDocumentSizeType

The physical size of the document to be captured. The module captures documents with defined aspect ratio and uses this parameter to restore document proportions on saving the result.

Predefined values from an enumeration are used.

7/27/2020 11:24:00 AM