.. index:: 
  !DocumentImage.extractRoi Method
  
.. _id3_document_document_image_extract_roi_class_method:

===============================================================================
DocumentImage.extractRoi Method
===============================================================================

Module: :ref:`DocumentImage<id3_document_document_image_class>`

Definition
----------

Extracts a region of interest in the image according to the given bounds.


.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        extract_roi(self, bounds: Rectangle) -> DocumentImage

      **Parameters**

        .. line-block::

          ``bounds`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` Bounds of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`DocumentImage<id3_document_document_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        DocumentImage extractRoi(Rectangle bounds)

      **Parameters**

        .. line-block::

          ``bounds`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` Bounds of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`DocumentImage<id3_document_document_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public DocumentImage ExtractRoi(Rectangle bounds)

      **Parameters**

        .. line-block::

          ``bounds`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` Bounds of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`DocumentImage<id3_document_document_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public DocumentImage extractRoi(Rectangle bounds) throws DocumentException

      **Parameters**

        .. line-block::

          ``bounds`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` Bounds of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`DocumentImage<id3_document_document_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public func extractRoi(bounds: Rectangle) throws -> DocumentImage

      **Parameters**

        .. line-block::

          ``bounds`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` Bounds of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`DocumentImage<id3_document_document_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C
      :sync: C

      .. code:: C

        int id3DocumentImage_ExtractRoi (
            ID3_DOCUMENT_IMAGE hDocumentImage, 
            const id3DocumentRectangle * sBounds, 
            ID3_DOCUMENT_IMAGE hDocumentImageRoi)

      **Parameters**

        .. line-block::

          ``hDocumentImage`` :ref:`ID3_DOCUMENT_IMAGE<id3_document_document_image_class>`
          :guilabel:`in` Handle to the DocumentImage object.

          ``sBounds`` :ref:`const id3DocumentRectangle *<id3_document_rectangle_struct>`
          :guilabel:`in` Bounds of the crop to extract.

          ``hDocumentImageRoi`` :ref:`ID3_DOCUMENT_IMAGE<id3_document_document_image_class>`
          :guilabel:`out` The extracted region of interest.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3DocumentError<id3_document_document_error_enum>` file for the list of possible error codes.


