ImageCaptureScenario class

Provides access to the image capture scenario management. The ImageCaptureScenario object constructor receives an instance of the Engine object, required for connection of the User Interface API with the capturing and recognition mechanisms.

Scenario, represented by this class, is started when the setCaptureScenario method of the CaptureView class is called.

Implements the CaptureScenario interface.

class ImageCaptureScenario implements CaptureScenario {
   public ImageCaptureScenario(Engine engine);
}

The ImageCaptureScenario class constructor throws an exception when the dependencies for the image capture scenario are not set. See the How to Add the Library to Your Android Studio Project to find the dependencies definition.

Methods

 Important! All methods should be called from the Android Main Thread.

Name Description
setAspectRatioMax Sets the upper limit of document's aspect ratio*.
getAspectRatioMax Returns the value of the upper limit of document's aspect ratio*.
setAspectRatioMin Sets the lower limit of the document's aspect ratio*.
getAspectRatioMinz Returns the value of the lower limit of the document's aspect ratio*.
setCallback Sets the callback object for the current image capture scenario.
setCropEnabled

Deprecated. An image is always cropped. A result provides access to both cropped and original images.

Indicates if the captured image should be cropped.

isCropEnabled

Deprecated. An image is always cropped. A result provides access to both cropped and original images.

Checks if the crop function is enabled and the captured image is to be cropped.

setDocumentSize Sets the physical size of the captured document, if known.
getDocumentSize Returns the defined physical size of the captured document.
setImageFromGalleryMaxSize Sets the maximum available size of an image, that can be loaded from the gallery. The size is defined as the length of the largest side of an image (in pixels).
getImageFromGalleryMaxSize Returns the value of the maximum available size of an image, that can be loaded from the gallery. The size is defined as the length of the largest side of an image (in pixels).
setMinimumDocumentToViewRatio Sets the minimum document area relative to the whole frame area, required for capture. If the document area is less than the set value, the image will not be captured.
getMinimumDocumentToViewRatio Returns the value of the defined minimum document area relative to the whole frame area.
start Starts the image capture scenario.
captureImageManually Captures image immediately.
setManualCaptureEnabled Enables photo and gallery buttons for manual capture by user.
pickImageFromGallery Opens image gallery view. This method can be used for implementing your own gallery button.
stop Stops the automatic capture process.

Document aspect ratio setting is intended to specify the exact proportions of the target document, which will increase capture accuracy.

 Notes: 

  • Aspect ratio detection requires the mobile device to be placed strictly horizontally over the document during image capture. In case the mobile device is tilted, camera will capture distorted image and the document aspect ratio may be detected incorrectly.
  • The value of aspect ratio is calculated by division of the longer side to the shorter side and is expected to be greater than or equal to 1 (or 0 if not set). If neither aspectRatioMin nor aspectRatioMin are set, the values will be calculated from the documentSize setting.
  • Either height or width of the document should be greater than 60% of the frame height or width respectively. Otherwise the document is considered to be too small and no capture is performed.

Nested classes

Name Description
Result Returned image in the Bitmap format and the coordinates of the result's boundaries.
Callback The callback interface to return the result of the capture or error information.
DocumentSize The physical size of the documents.

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.