.. index:: 
  !Portrait Class

.. _id3_face_portrait_class:

===============================================================================
Portrait Class
===============================================================================

Namespace: :ref:`id3.Face<reference_face>`

.. toctree::
  :hidden:

  age<age>
  backgroundUniformity<background_uniformity>
  clear<clear>
  clone<clone>
  expression<expression>
  eyeGaze<eye_gaze>
  faceId<face_id>
  faceMask<face_mask>
  faceTemplate<face_template>
  fromBuffer<from_buffer>
  genderMale<gender_male>
  geometricAttributes<geometric_attributes>
  glasses<glasses>
  hat<hat>
  image<image>
  imageCenter<image_center>
  imageScale<image_scale>
  imageTranslation<image_translation>
  instruction<instruction>
  landmarks<landmarks>
  leftEyeOpening<left_eye_opening>
  leftEyeVisibility<left_eye_visibility>
  lookStraightScore<look_straight_score>
  makeup<makeup>
  mouthOpening<mouth_opening>
  mouthVisibility<mouth_visibility>
  noseVisibility<nose_visibility>
  padScore<pad_score>
  padStatus<pad_status>
  photographicAttributes<photographic_attributes>
  pose<pose>
  qualityCheckpoints<quality_checkpoints>
  qualityScore<quality_score>
  rightEyeOpening<right_eye_opening>
  rightEyeVisibility<right_eye_visibility>
  smile<smile>
  status<status>
  subjectPosition<subject_position>
  toBuffer<to_buffer>
  trackedFace<tracked_face>


Definition
----------
.. line-block::
    Represents a portrait.

.. tab-set::

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

      .. code:: Python

        class Portrait

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

      .. code:: Dart

        class Portrait implements Finalizable

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

      .. code:: C#

        public partial class Portrait

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

      .. code:: Java

        public class Portrait implements AutoCloseable, Serializable

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

      .. code:: Swift

        public class Portrait

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

      .. code:: C

        typedef struct id3FacePortrait *ID3_FACE_PORTRAIT;



Usage
-----

.. tab-set::

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

      .. code:: Python

        portraitInstance = id3face.Portrait()

      **Explicit destruction**

      .. code:: Python

        # ...
        del portraitInstance

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

      .. code:: Dart

        final portraitInstance = sdk.Portrait();
        // ...

      **Explicit destruction**

      .. code:: Dart

        // ...
        portraitInstance.dispose()

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

      .. code:: C#

        using (var portraitInstance = new Portrait())
        {
           // ...
        }

      **Explicit destruction**

      .. code:: C#

        var portraitInstance = new Portrait()
        // ...
        portraitInstance.Dispose()

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

      .. code:: Java

        try (Portrait portraitInstance = new Portrait()) {
        // ...
        }

      **Explicit destruction**

      .. code:: Java

        Portrait portraitInstance = new Portrait();
        // ...
        portraitInstance.close();

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

      .. code:: Swift

        private var portraitInstance: Portrait? = nil
        portraitInstance = try Portrait()

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

      .. code:: C

        ID3_FACE_PORTRAIT hPortrait{};
        int err = id3FacePortrait_Initialize(&hPortrait);
        if (err == ID3_SUCCESS) {
            // ...
            id3FacePortrait_Dispose(&hPortrait);
        }


Properties
----------

.. list-table:: 
  :width: 100%
  :widths: 30 5 65
  :header-rows: 1

  * - Name
    - Type
    - Description
  * - :ref:`age<id3_face_portrait_age_class_member>`
    - int
    - Estimated age of the subject. -1 if not computed.
  * - :ref:`backgroundUniformity<id3_face_portrait_background_uniformity_class_member>`
    - :ref:`BackgroundUniformity<id3_face_background_uniformity_struct>`
    - Result of the background uniformity computation.
  * - :ref:`expression<id3_face_portrait_expression_class_member>`
    - :ref:`FaceExpression<id3_face_face_expression_enum>`
    - Estimated expression of the subject (angriness, disgust, fear, happiness, sadness, surprise, or neutral). Unknown if not computed.
  * - :ref:`eyeGaze<id3_face_portrait_eye_gaze_class_member>`
    - :ref:`EyeGaze<id3_face_eye_gaze_struct>`
    - Estimated gaze.
  * - :ref:`faceId<id3_face_portrait_face_id_class_member>`
    - int
    - Unique face ID.
  * - :ref:`faceMask<id3_face_portrait_face_mask_class_member>`
    - int
    - Value indicating whether a face mask is detected. The range is 0-100, 100 meaning a mask is detected.
  * - :ref:`faceTemplate<id3_face_portrait_face_template_class_member>`
    - :ref:`FaceTemplate<id3_face_face_template_class>`
    - Face template.
  * - :ref:`genderMale<id3_face_portrait_gender_male_class_member>`
    - int
    - Value indicating whether the subject is a male. -1 if not computed. The range is 0 (female) -100 (male).
  * - :ref:`geometricAttributes<id3_face_portrait_geometric_attributes_class_member>`
    - :ref:`GeometricAttributes<id3_face_geometric_attributes_struct>`
    - Geometric attributes.
  * - :ref:`glasses<id3_face_portrait_glasses_class_member>`
    - int
    - Value indicating whether the subject wears glasses. -1 if not computed. The range is 0-100, 100 meaning glasses are detected.
  * - :ref:`hat<id3_face_portrait_hat_class_member>`
    - int
    - Value indicating whether the subject wears a hat. -1 if not computed. The range is 0-100, 100 meaning a hat is detected.
  * - :ref:`image<id3_face_portrait_image_class_member>`
    - :ref:`Image<id3_face_image_class>`
    - Source image.
  * - :ref:`imageCenter<id3_face_portrait_image_center_class_member>`
    - :ref:`Point<id3_face_point_struct>`
    - Center of the portrait in the source image.
  * - :ref:`imageScale<id3_face_portrait_image_scale_class_member>`
    - float
    - Scale to be applied to the source image to display the portrait.
  * - :ref:`imageTranslation<id3_face_portrait_image_translation_class_member>`
    - :ref:`Point<id3_face_point_struct>`
    - Translation to be applied to the source image to display the portrait.
  * - :ref:`instruction<id3_face_portrait_instruction_class_member>`
    - :ref:`PortraitInstruction<id3_face_portrait_instruction_enum>`
    - Instruction to be given to the user for portrait capture.
  * - :ref:`landmarks<id3_face_portrait_landmarks_class_member>`
    - :ref:`PointList<id3_face_point_list_class>`
    - 68-points landmarks.
  * - :ref:`leftEyeOpening<id3_face_portrait_left_eye_opening_class_member>`
    - int
    - Value estimating the opening of the left eye. -1 if not computed. The range is 0-100, 100 meaning the eye is fully opened.
  * - :ref:`leftEyeVisibility<id3_face_portrait_left_eye_visibility_class_member>`
    - int
    - Value estimating the visibility of the left eye. -1 if not computed. The range is 0-100, 100 meaning the left eye is fully visible.
  * - :ref:`lookStraightScore<id3_face_portrait_look_straight_score_class_member>`
    - int
    - Value estimating if the user is looking straight towards the camera. -1 if not computed. The range is 0-100, 100 meaning the look is straight.
  * - :ref:`makeup<id3_face_portrait_makeup_class_member>`
    - int
    - Value indicating whether makeup is detected. -1 if not computed. The range is 0-100, 100 meaning makeup is detected.
  * - :ref:`mouthOpening<id3_face_portrait_mouth_opening_class_member>`
    - int
    - Value indicating estimating the opening of the mouth. -1 if not computed. The range is 0-100, 100 meaning the mouth is fully open.
  * - :ref:`mouthVisibility<id3_face_portrait_mouth_visibility_class_member>`
    - int
    - Value estimating the visibility of the mouth. -1 if not computed. The range is 0-100, 100 meaning the mouth is fully visible.
  * - :ref:`noseVisibility<id3_face_portrait_nose_visibility_class_member>`
    - int
    - Value estimating the visibility of the nose. -1 if not computed. The range is 0-100, 100 meaning the nose is fully visible.
  * - :ref:`padScore<id3_face_portrait_pad_score_class_member>`
    - int
    - Score of the presentation attack detection.
  * - :ref:`padStatus<id3_face_portrait_pad_status_class_member>`
    - :ref:`PadStatus<id3_face_pad_status_enum>`
    - Status of the presentation attack detection.
  * - :ref:`photographicAttributes<id3_face_portrait_photographic_attributes_class_member>`
    - :ref:`PhotographicAttributes<id3_face_photographic_attributes_struct>`
    - Photographic attributes.
  * - :ref:`pose<id3_face_portrait_pose_class_member>`
    - :ref:`FacePose<id3_face_face_pose_struct>`
    - Face pose.
  * - :ref:`qualityCheckpoints<id3_face_portrait_quality_checkpoints_class_member>`
    - :ref:`PortraitQualityCheckpoints<id3_face_portrait_quality_checkpoints_struct>`
    - Quality check points of the portrait.
  * - :ref:`qualityScore<id3_face_portrait_quality_score_class_member>`
    - int
    - Unified quality score, from 0 to 100. -1 if not computed.
  * - :ref:`rightEyeOpening<id3_face_portrait_right_eye_opening_class_member>`
    - int
    - Value estimating the opening of the left eye. -1 if not computed. The range is 0-100, 100 meaning the eye is fully opened.
  * - :ref:`rightEyeVisibility<id3_face_portrait_right_eye_visibility_class_member>`
    - int
    - Value estimating the visibility of the right eye. -1 if not computed. The range is 0-100, 100 meaning the right eye is fully visible.
  * - :ref:`smile<id3_face_portrait_smile_class_member>`
    - int
    - Value indicating whether the subject is smiling. -1 if not computed. The range is 0-100, 100 meaning the person is smiling.
  * - :ref:`status<id3_face_portrait_status_class_member>`
    - :ref:`PortraitStatus<id3_face_portrait_status_enum>`
    - Status of the portrait.
  * - :ref:`subjectPosition<id3_face_portrait_subject_position_class_member>`
    - :ref:`SubjectPosition<id3_face_subject_position_enum>`
    - Position of the subject in the image.
  * - :ref:`trackedFace<id3_face_portrait_tracked_face_class_member>`
    - :ref:`TrackedFace<id3_face_tracked_face_class>`
    - Tracked face.

Static Methods
--------------

.. list-table:: 
  :width: 100%
  :widths: 30 70
  :header-rows: 1

  * - Name
    - Description
  * - :ref:`fromBuffer<id3_face_portrait_from_buffer_class_method>`
    - Imports the portrait object from a buffer.

Methods
-------

.. list-table:: 
  :width: 100%
  :widths: 30 70
  :header-rows: 1

  * - Name
    - Description
  * - :ref:`clear<id3_face_portrait_clear_class_method>`
    - Clears all attributes.
  * - :ref:`clone<id3_face_portrait_clone_class_method>`
    - Clones the Portrait object.
  * - :ref:`toBuffer<id3_face_portrait_to_buffer_class_method>`
    - Exports the portrait to a buffer.
