.. index:: 
  !FaceDetector Class

.. _id3_face_face_detector_class:

===============================================================================
FaceDetector Class
===============================================================================

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

.. toctree::
  :hidden:

  confidenceThreshold<confidence_threshold>
  detectFaces<detect_faces>
  model<model>
  nmsIouThreshold<nms_iou_threshold>
  processingUnit<processing_unit>
  threadCount<thread_count>
  trackFaces<track_faces>
  warmUp<warm_up>


Definition
----------
.. line-block::
    Detects human faces in images.

.. tab-set::

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

      .. code:: Python

        class FaceDetector

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

      .. code:: Dart

        class FaceDetector implements Finalizable

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

      .. code:: C#

        public partial class FaceDetector

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

      .. code:: Java

        public class FaceDetector implements AutoCloseable, Serializable

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

      .. code:: Swift

        public class FaceDetector

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

      .. code:: C

        typedef struct id3FaceDetector *ID3_FACE_DETECTOR;



Usage
-----

.. tab-set::

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

      .. code:: Python

        faceDetectorInstance = id3face.FaceDetector()

      **Explicit destruction**

      .. code:: Python

        # ...
        del faceDetectorInstance

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

      .. code:: Dart

        final faceDetectorInstance = sdk.FaceDetector();
        // ...

      **Explicit destruction**

      .. code:: Dart

        // ...
        faceDetectorInstance.dispose()

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

      .. code:: C#

        using (var faceDetectorInstance = new FaceDetector())
        {
           // ...
        }

      **Explicit destruction**

      .. code:: C#

        var faceDetectorInstance = new FaceDetector()
        // ...
        faceDetectorInstance.Dispose()

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

      .. code:: Java

        try (FaceDetector faceDetectorInstance = new FaceDetector()) {
        // ...
        }

      **Explicit destruction**

      .. code:: Java

        FaceDetector faceDetectorInstance = new FaceDetector();
        // ...
        faceDetectorInstance.close();

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

      .. code:: Swift

        private var faceDetectorInstance: FaceDetector? = nil
        faceDetectorInstance = try FaceDetector()

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

      .. code:: C

        ID3_FACE_DETECTOR hFaceDetector{};
        int err = id3FaceDetector_Initialize(&hFaceDetector);
        if (err == ID3_SUCCESS) {
            // ...
            id3FaceDetector_Dispose(&hFaceDetector);
        }


Properties
----------

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

  * - Name
    - Type
    - Description
  * - :ref:`confidenceThreshold<id3_face_face_detector_confidence_threshold_class_member>`
    - int
    - Confidence threshold, in the range [0;100].
  * - :ref:`model<id3_face_face_detector_model_class_member>`
    - :ref:`FaceModel<id3_face_face_model_enum>`
    - Model used to detect and track faces.
  * - :ref:`nmsIouThreshold<id3_face_face_detector_nms_iou_threshold_class_member>`
    - int
    - Non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100].
  * - :ref:`processingUnit<id3_face_face_detector_processing_unit_class_member>`
    - :ref:`ProcessingUnit<id3_face_processing_unit_enum>`
    - Processing unit where to run the detection process.
  * - :ref:`threadCount<id3_face_face_detector_thread_count_class_member>`
    - int
    - Number of threads to be used for face detection.

Methods
-------

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

  * - Name
    - Description
  * - :ref:`detectFaces<id3_face_face_detector_detect_faces_class_method>`
    - Detects faces in an image and store their info in a DetectedFaceList object.
  * - :ref:`trackFaces<id3_face_face_detector_track_faces_class_method>`
    - Tracks faces in an image and update their info in a DetectedFaceList object.
  * - :ref:`warmUp<id3_face_face_detector_warm_up_class_method>`
    - Gets the face detector module ready to work on a specific image size by initializing all its internal memory layout.
