.. index:: 
  !PortraitProcessor.createPortrait Method
  
.. _id3_face_portrait_processor_create_portrait_class_method:

===============================================================================
PortraitProcessor.createPortrait Method
===============================================================================

Module: :ref:`PortraitProcessor<id3_face_portrait_processor_class>`

Definition
----------

Analyses an image and creates a portrait with the first detected face or the currently tracked face if the update parameter is activated.

This method performs the following tasks:

- Face detection

- Landmark detection (68 points)

- Head pose estimation

- Verification of subject position

- Geometric attributes computation

- Unified quality score computation

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


.. tab-set::

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

      .. code:: Python

        create_portrait(self, image: Image) -> Portrait

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`Portrait<id3_face_portrait_class>`
          The newly created portrait.

      **Exceptions**

        .. line-block::

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


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

      .. code:: Dart

        Portrait createPortrait(Image image)

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`Portrait<id3_face_portrait_class>`
          The newly created portrait.

      **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 Portrait CreatePortrait(Image image)

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`Portrait<id3_face_portrait_class>`
          The newly created portrait.

      **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 Portrait createPortrait(Image image) throws FaceException

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`Portrait<id3_face_portrait_class>`
          The newly created portrait.

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

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`Portrait<id3_face_portrait_class>`
          The newly created portrait.

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

      **Parameters**

        .. line-block::

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

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

          ``hPortrait`` :ref:`ID3_FACE_PORTRAIT<id3_face_portrait_class>`
          :guilabel:`out` The newly created portrait.


      **Returns**

        .. line-block::

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


