.. index:: 
  !DocumentImage.extractRoiWithColor Method
  
.. _id3_document_document_image_extract_roi_with_color_class_method:

===============================================================================
DocumentImage.extractRoiWithColor 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_with_color(self, bounds: Rectangle, color_red: int, color_green: int, color_blue: int) -> DocumentImage

      **Parameters**

        .. line-block::

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

          ``color_red`` int
          :guilabel:`in` Background color red (from 0 to 255)

          ``color_green`` int
          :guilabel:`in` Background color green (from 0 to 255)

          ``color_blue`` int
          :guilabel:`in` Background color blue (from 0 to 255)


      **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 extractRoiWithColor(Rectangle bounds, int colorRed, int colorGreen, int colorBlue)

      **Parameters**

        .. line-block::

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

          ``colorRed`` int
          :guilabel:`in` Background color red (from 0 to 255)

          ``colorGreen`` int
          :guilabel:`in` Background color green (from 0 to 255)

          ``colorBlue`` int
          :guilabel:`in` Background color blue (from 0 to 255)


      **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 ExtractRoiWithColor(Rectangle bounds, int colorRed, int colorGreen, int colorBlue)

      **Parameters**

        .. line-block::

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

          ``colorRed`` int
          :guilabel:`in` Background color red (from 0 to 255)

          ``colorGreen`` int
          :guilabel:`in` Background color green (from 0 to 255)

          ``colorBlue`` int
          :guilabel:`in` Background color blue (from 0 to 255)


      **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 extractRoiWithColor(Rectangle bounds, int colorRed, int colorGreen, int colorBlue) throws DocumentException

      **Parameters**

        .. line-block::

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

          ``colorRed`` int
          :guilabel:`in` Background color red (from 0 to 255)

          ``colorGreen`` int
          :guilabel:`in` Background color green (from 0 to 255)

          ``colorBlue`` int
          :guilabel:`in` Background color blue (from 0 to 255)


      **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 extractRoiWithColor(bounds: Rectangle, colorRed: Int32, colorGreen: Int32, colorBlue: Int32) throws -> DocumentImage

      **Parameters**

        .. line-block::

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

          ``colorRed`` Int32
          :guilabel:`in` Background color red (from 0 to 255)

          ``colorGreen`` Int32
          :guilabel:`in` Background color green (from 0 to 255)

          ``colorBlue`` Int32
          :guilabel:`in` Background color blue (from 0 to 255)


      **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_ExtractRoiWithColor (
            ID3_DOCUMENT_IMAGE hDocumentImage, 
            const id3DocumentRectangle * sBounds, 
            int colorRed, 
            int colorGreen, 
            int colorBlue, 
            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.

          ``colorRed`` int
          :guilabel:`in` Background color red (from 0 to 255)

          ``colorGreen`` int
          :guilabel:`in` Background color green (from 0 to 255)

          ``colorBlue`` int
          :guilabel:`in` Background color blue (from 0 to 255)

          ``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.


