.. index:: 
  !FaceTracker Class

.. _id3_face_face_tracker_class:

===============================================================================
FaceTracker Class
===============================================================================

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

.. toctree::
  :hidden:

  confidenceThreshold<confidence_threshold>
  detectFaces<detect_faces>
  detectionModel<detection_model>
  encodingModel<encoding_model>
  matchThreshold<match_threshold>
  maximumTrackedFaceAge<maximum_tracked_face_age>
  minimumTrackedFaceAge<minimum_tracked_face_age>
  nmsIouThreshold<nms_iou_threshold>
  threadCount<thread_count>
  trackFaces<track_faces>
  warmUp<warm_up>


Definition
----------
.. line-block::
    Tracks faces on consecutive images and automatically creates and updates associated face templates.

.. tab-set::

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

      .. code:: Python

        class FaceTracker

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

      .. code:: Dart

        class FaceTracker implements Finalizable

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

      .. code:: C#

        public partial class FaceTracker

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

      .. code:: Java

        public class FaceTracker implements AutoCloseable, Serializable

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

      .. code:: Swift

        public class FaceTracker

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

      .. code:: C

        typedef struct id3FaceTracker *ID3_FACE_TRACKER;



Usage
-----

.. tab-set::

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

      .. code:: Python

        faceTrackerInstance = id3face.FaceTracker()

      **Explicit destruction**

      .. code:: Python

        # ...
        del faceTrackerInstance

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

      .. code:: Dart

        final faceTrackerInstance = sdk.FaceTracker();
        // ...

      **Explicit destruction**

      .. code:: Dart

        // ...
        faceTrackerInstance.dispose()

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

      .. code:: C#

        using (var faceTrackerInstance = new FaceTracker())
        {
           // ...
        }

      **Explicit destruction**

      .. code:: C#

        var faceTrackerInstance = new FaceTracker()
        // ...
        faceTrackerInstance.Dispose()

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

      .. code:: Java

        try (FaceTracker faceTrackerInstance = new FaceTracker()) {
        // ...
        }

      **Explicit destruction**

      .. code:: Java

        FaceTracker faceTrackerInstance = new FaceTracker();
        // ...
        faceTrackerInstance.close();

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

      .. code:: Swift

        private var faceTrackerInstance: FaceTracker? = nil
        faceTrackerInstance = try FaceTracker()

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

      .. code:: C

        ID3_FACE_TRACKER hFaceTracker{};
        int err = id3FaceTracker_Initialize(&hFaceTracker);
        if (err == ID3_SUCCESS) {
            // ...
            id3FaceTracker_Dispose(&hFaceTracker);
        }


Properties
----------

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

  * - Name
    - Type
    - Description
  * - :ref:`confidenceThreshold<id3_face_face_tracker_confidence_threshold_class_member>`
    - int
    - Confidence threshold, in the range [0;100].
  * - :ref:`detectionModel<id3_face_face_tracker_detection_model_class_member>`
    - :ref:`FaceModel<id3_face_face_model_enum>`
    - Model used to detect and track faces.
  * - :ref:`encodingModel<id3_face_face_tracker_encoding_model_class_member>`
    - :ref:`FaceModel<id3_face_face_model_enum>`
    - Model used to create features and assess consistancy among views of a given face.
  * - :ref:`matchThreshold<id3_face_face_tracker_match_threshold_class_member>`
    - int
    - Minimum match score to reach to preserve the ID of a tracked face between frame 't-1' and frame 't'.
  * - :ref:`maximumTrackedFaceAge<id3_face_face_tracker_maximum_tracked_face_age_class_member>`
    - int
    - Maximum number of consecutive non-detections to reach before deleting a tracked face.
  * - :ref:`minimumTrackedFaceAge<id3_face_face_tracker_minimum_tracked_face_age_class_member>`
    - int
    - Minimum number of consecutive detections to reach before creating a tracked face.
  * - :ref:`nmsIouThreshold<id3_face_face_tracker_nms_iou_threshold_class_member>`
    - int
    - Non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100].
  * - :ref:`threadCount<id3_face_face_tracker_thread_count_class_member>`
    - int
    - Number of threads to be used for face detection and tracking.

Methods
-------

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

  * - Name
    - Description
  * - :ref:`detectFaces<id3_face_face_tracker_detect_faces_class_method>`
    - Detects faces in an image and update their info in a TrackedFaceList object.
  * - :ref:`trackFaces<id3_face_face_tracker_track_faces_class_method>`
    - Tracks faces in an image and update their info in a TrackedFaceList object.
  * - :ref:`warmUp<id3_face_face_tracker_warm_up_class_method>`
    - Gets the face tracker module ready to work on a specific image size by initializing all its internal memory layout.
