.. index:: 
  !FaceAnalyser.computeBackgroundUniformity Method
  
.. _id3_face_face_analyser_compute_background_uniformity_class_method:

===============================================================================
FaceAnalyser.computeBackgroundUniformity Method
===============================================================================

Module: :ref:`FaceAnalyser<id3_face_face_analyser_class>`

Definition
----------

Computes the background uniformity behind a detected face.

This function must be used for a portrait image with only one face in it. A high uniformity score means that the background is uniform.

.. important:: Loading the model ``FaceBackgroundUniformity`` is required to use this function.


.. tab-set::

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

      .. code:: Python

        compute_background_uniformity(self, image: Image, detected_face: DetectedFace) -> BackgroundUniformity

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` Source image to process.

          ``detected_face`` :ref:`DetectedFace<id3_face_detected_face_class>`
          :guilabel:`in` Detected face to process.


      **Returns**

        .. line-block::

          :ref:`BackgroundUniformity<id3_face_background_uniformity_struct>`
          The estimated background uniformity. Both color and texture scores are in the range [0:100]. The minimum recommended thresholds are respectively 80 for color and 80 for texture.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


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

      .. code:: Dart

        BackgroundUniformity computeBackgroundUniformity(Image image, DetectedFace detectedFace)

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` Source image to process.

          ``detectedFace`` :ref:`DetectedFace<id3_face_detected_face_class>`
          :guilabel:`in` Detected face to process.


      **Returns**

        .. line-block::

          :ref:`BackgroundUniformity<id3_face_background_uniformity_struct>`
          The estimated background uniformity. Both color and texture scores are in the range [0:100]. The minimum recommended thresholds are respectively 80 for color and 80 for texture.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


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

      .. code:: C#

        public BackgroundUniformity ComputeBackgroundUniformity(Image image, DetectedFace detectedFace)

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` Source image to process.

          ``detectedFace`` :ref:`DetectedFace<id3_face_detected_face_class>`
          :guilabel:`in` Detected face to process.


      **Returns**

        .. line-block::

          :ref:`BackgroundUniformity<id3_face_background_uniformity_struct>`
          The estimated background uniformity. Both color and texture scores are in the range [0:100]. The minimum recommended thresholds are respectively 80 for color and 80 for texture.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


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

      .. code:: Java

        public BackgroundUniformity computeBackgroundUniformity(Image image, DetectedFace detectedFace) throws FaceException

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` Source image to process.

          ``detectedFace`` :ref:`DetectedFace<id3_face_detected_face_class>`
          :guilabel:`in` Detected face to process.


      **Returns**

        .. line-block::

          :ref:`BackgroundUniformity<id3_face_background_uniformity_struct>`
          The estimated background uniformity. Both color and texture scores are in the range [0:100]. The minimum recommended thresholds are respectively 80 for color and 80 for texture.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


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

      .. code:: Swift

        public func computeBackgroundUniformity(image: Image, detectedFace: DetectedFace) throws -> BackgroundUniformity

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` Source image to process.

          ``detectedFace`` :ref:`DetectedFace<id3_face_detected_face_class>`
          :guilabel:`in` Detected face to process.


      **Returns**

        .. line-block::

          :ref:`BackgroundUniformity<id3_face_background_uniformity_struct>`
          The estimated background uniformity. Both color and texture scores are in the range [0:100]. The minimum recommended thresholds are respectively 80 for color and 80 for texture.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


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

      .. code:: C

        int id3FaceAnalyser_ComputeBackgroundUniformity (
            ID3_FACE_ANALYSER hFaceAnalyser, 
            ID3_FACE_IMAGE hImage, 
            ID3_DETECTED_FACE hDetectedFace, 
            id3FaceBackgroundUniformity * sBackgroundUniformity)

      **Parameters**

        .. line-block::

          ``hFaceAnalyser`` :ref:`ID3_FACE_ANALYSER<id3_face_face_analyser_class>`
          :guilabel:`in` Handle to the FaceAnalyser object.

          ``hImage`` :ref:`ID3_FACE_IMAGE<id3_face_image_class>`
          :guilabel:`in` Source image to process.

          ``hDetectedFace`` :ref:`ID3_DETECTED_FACE<id3_face_detected_face_class>`
          :guilabel:`in` Detected face to process.

          ``sBackgroundUniformity`` :ref:`id3FaceBackgroundUniformity *<id3_face_background_uniformity_struct>`
          :guilabel:`out` The estimated background uniformity. Both color and texture scores are in the range [0:100]. The minimum recommended thresholds are respectively 80 for color and 80 for texture.


      **Returns**

        .. line-block::

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


