.. index:: 
  !PortraitProcessor.updatePortrait Method
  
.. _id3_face_portrait_processor_update_portrait_class_method:

===============================================================================
PortraitProcessor.updatePortrait Method
===============================================================================

Module: :ref:`PortraitProcessor<id3_face_portrait_processor_class>`

Definition
----------

Analyses an image and updates the specified portrait with the first detected face or the currently tracked face.

This method performs the following tasks:

- Face detection and tracking with prediction models

- Landmark detection (68 points)

- Head pose estimation

- Verification of subject position

- Template encoding and updating

- Geometric attributes computation

- Unified quality score computation

.. important:: This method requires the ``FaceDetector``, ``FaceEncoder``, ``FaceLandmarksEstimator`` and ``FacePoseEstimator`` models to be loaded.


.. tab-set::

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

      .. code:: Python

        update_portrait(self, portrait: Portrait, image: Image) -> None

      **Parameters**

        .. line-block::

          ``portrait`` :ref:`Portrait<id3_face_portrait_class>`
          :guilabel:`in` The portrait to be updated.

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The source image.


      **Exceptions**

        .. line-block::

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


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

      .. code:: Dart

        void updatePortrait(Portrait portrait, Image image)

      **Parameters**

        .. line-block::

          ``portrait`` :ref:`Portrait<id3_face_portrait_class>`
          :guilabel:`in` The portrait to be updated.

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The source image.


      **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 void UpdatePortrait(Portrait portrait, Image image)

      **Parameters**

        .. line-block::

          ``portrait`` :ref:`Portrait<id3_face_portrait_class>`
          :guilabel:`in` The portrait to be updated.

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The source image.


      **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 void updatePortrait(Portrait portrait, Image image) throws FaceException

      **Parameters**

        .. line-block::

          ``portrait`` :ref:`Portrait<id3_face_portrait_class>`
          :guilabel:`in` The portrait to be updated.

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The source image.


      **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 updatePortrait(portrait: Portrait, image: Image) throws

      **Parameters**

        .. line-block::

          ``portrait`` :ref:`Portrait<id3_face_portrait_class>`
          :guilabel:`in` The portrait to be updated.

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The source image.


      **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 id3FacePortraitProcessor_UpdatePortrait (
            ID3_FACE_PORTRAIT_PROCESSOR hPortraitProcessor, 
            ID3_FACE_PORTRAIT hPortrait, 
            ID3_FACE_IMAGE hImage)

      **Parameters**

        .. line-block::

          ``hPortraitProcessor`` :ref:`ID3_FACE_PORTRAIT_PROCESSOR<id3_face_portrait_processor_class>`
          :guilabel:`in` Handle to the PortraitProcessor object.

          ``hPortrait`` :ref:`ID3_FACE_PORTRAIT<id3_face_portrait_class>`
          :guilabel:`in` The portrait to be updated.

          ``hImage`` :ref:`ID3_FACE_IMAGE<id3_face_image_class>`
          :guilabel:`in` The source image.


      **Returns**

        .. line-block::

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


