Package

## Class ImageCaptureScenario

- All Implemented Interfaces:
    `com.abbyy.mobile.uicomponents.scenario.CaptureScenario` , `com.abbyy.mobile.uicomponents.scenario.ImageCaptureSettings`

      public final class ImageCaptureScenario
      extends BaseCaptureScenario implements ImageCaptureSettings

  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 capture and recognition mechanisms.

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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `public final class` | `ImageCaptureScenario.Result` | Captured bitmap image with detected document boundaries. This result can be received in both real-time capture from camera preview and from an immediate manual capture.
    `public interface` | `ImageCaptureScenario.Callback` | The callback for ImageCaptureScenario. In case the image was captured successfully, the result image and the document boundaries on it are returned. Otherwise the callback will return the information about the occurred error. This interface and its methods are to be implemented on the client side.
    `public final class` | `ImageCaptureScenario.DocumentSize` | The physical size of the documents. Can be chosen from the preset values or defined manually.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ImageCaptureScenario(Engine engine)` |

  - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `final Unit` | `setCallback(ImageCaptureScenario.Callback callback)` | Sets the callback object for current image capture scenario.
    `Boolean` | `isCropEnabled()` | Checks if the crop function is enabled and the captured image will be cropped.
    `Unit` | `setCropEnabled(Boolean isCropEnabled)` | Enables or disables the automatic crop option.
    `ImageCaptureScenario.DocumentSize` | `getDocumentSize()` | Return the defined physical size of the captured document.
    `Unit` | `setDocumentSize(ImageCaptureScenario.DocumentSize documentSize)` | Set the physical size of the captured document.
    `Float` | `getMinimumDocumentToViewRatio()` | Return the value of defined minimum document area relative to the whole frame area.
    `Unit` | `setMinimumDocumentToViewRatio(Float ratio)` | Set the minimum document area, relative to the whole frame area, that is required for capture.
    `Unit` | `setAspectRatioMin(Float minValue)` | Set the lower limit of the document's aspect ratio.
    `Float` | `getAspectRatioMin()` | Return the value of defined lower limit of document's aspect ratio.
    `Unit` | `setAspectRatioMax(Float maxValue)` | Set the upper limit of document's aspect ratio.
    `Float` | `getAspectRatioMax()` | Return the value of defined upper limit of document's aspect ratio.
    `Integer` | `getImageFromGalleryMaxSize()` | Return the value of the maximum available size of an image that can be loaded from the gallery.
    `Unit` | `setImageFromGalleryMaxSize(Integer size)` | Set the maximum available size of an image, that can be loaded from the gallery
    `Unit` | `setNamedProperty(String name, Object value)` | Set the named extended property for image capture.
    `final Unit` | `start()` | Starts the capture scenario execution.
    `final Unit` | `captureImageManually()` | Captures image immediately.
    `final Unit` | `stop()` | Stops the automatic capture process and releases the resources.
    `final Unit` | `pickImageFromGallery()` | Opens image gallery view.
    `final Unit` | `setManualCaptureEnabled(Boolean isEnabled)` | Enables manual capture buttons (photo and gallery) for user.

    - ### Methods inherited from class com.abbyy.mobile.uicomponents.scenario.CaptureScenario

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ImageCaptureScenario

          ImageCaptureScenario(Engine engine)

  - ### Method Detail

    - #### setCallback

          @MainThread() final Unit setCallback(ImageCaptureScenario.Callback callback)

      Sets the callback object for current image capture scenario.

      Parameters:
        `callback` - The Callback interface instance set for current scenario.

    - #### isCropEnabled

          @Deprecated(message = "This flag should no longer be used", replaceWith = @ReplaceWith(imports = {}, expression = "false"))@MainThread() Boolean isCropEnabled()

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

    - #### setCropEnabled

          @Deprecated(message = "This flag should no longer be used")@MainThread() Unit setCropEnabled(Boolean isCropEnabled)

      Enables or disables the automatic crop option. In case this option is enabled, the fields around captured document will be cropped. Also perspective distortion will be corrected if needed.

      Parameters:
        `isCropEnabled` - This parameter defines if the crop option should be enabled.

    - #### getDocumentSize

          @MainThread() ImageCaptureScenario.DocumentSize getDocumentSize()

      Return the defined physical size of the captured document.

    - #### setDocumentSize

          @MainThread() Unit setDocumentSize(ImageCaptureScenario.DocumentSize documentSize)

      Set the physical size of the captured document.

      Parameters:
        `documentSize` - The size of the captured document, represented by a DocumentSize object.

    - #### getMinimumDocumentToViewRatio

          @MainThread() Float getMinimumDocumentToViewRatio()

      Return the value of defined minimum document area relative to the whole frame area.

    - #### setMinimumDocumentToViewRatio

          @MainThread() Unit setMinimumDocumentToViewRatio(Float ratio)

      Set the minimum document area, relative to the whole frame area, that is required for capture. If the document area is less than that, the image will not be captured.

      Parameters:
        `ratio` - The 0..

    - #### setAspectRatioMin

          @MainThread() Unit setAspectRatioMin(Float minValue)

      Set the lower limit of the document's aspect ratio.

      This method is used in pair with the setAspectRatioMax, 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 upper limit is set, lower limit will be set to 1.

      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). By default aspect ratio is not set and is defined by DocumentSize.

      Parameters:
        `minValue` - minimum acceptable value for document's aspect ratio

    - #### getAspectRatioMin

          @MainThread() Float getAspectRatioMin()

      Return the value of defined lower limit of document's aspect ratio.

    - #### setAspectRatioMax

          @MainThread() Unit setAspectRatioMax(Float maxValue)

      Set the upper limit of document's aspect ratio.

      This method is used in pair with the setAspectRatioMin, 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 lower limit is set, upper limit will be set to infinity

      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). By default aspect ratio is not set and is defined by DocumentSize.

      Parameters:
        `maxValue` - maximum acceptable value for document's aspect ratio

    - #### getAspectRatioMax

          @MainThread() Float getAspectRatioMax()

      Return the value of defined upper limit of document's aspect ratio.

    - #### getImageFromGalleryMaxSize

          @MainThread() Integer getImageFromGalleryMaxSize()

      Return the value of the maximum available size of an image that can be loaded from the gallery.

    - #### setImageFromGalleryMaxSize

          @MainThread() Unit setImageFromGalleryMaxSize(Integer size)

      Set the maximum available size of an image, that can be loaded from the gallery

    - #### setNamedProperty

          @MainThread() Unit setNamedProperty(String name, Object value)

      Set the named extended property for image capture.

      Parameters:
        `name` - the name of the property
        `value` - the value of the property

    - #### start

          @MainThread() final Unit start()

      Starts the capture scenario execution.

      This method can be called before the camera launch. In this case scenario will start simultaneously with the camera.

    - #### captureImageManually

          @MainThread() final Unit captureImageManually()

      Captures image immediately. This method is useful for implementing your own manual capture button.

    - #### stop

          @MainThread() final Unit stop()

      Stops the automatic capture process and releases the resources.

    - #### pickImageFromGallery

          @MainThread() final Unit pickImageFromGallery()

      Opens image gallery view. This method can be used for implementing your own gallery button.

    - #### setManualCaptureEnabled

          @MainThread() final Unit setManualCaptureEnabled(Boolean isEnabled)

      Enables manual capture buttons (photo and gallery) for user.

      Parameters:
        `isEnabled` - Set true to enable buttons for user and false otherwise.