.. index:: 
  !FaceDetector.detectFaces Method
  
.. _id3_face_face_detector_detect_faces_class_method:

===============================================================================
FaceDetector.detectFaces Method
===============================================================================

Module: :ref:`FaceDetector<id3_face_face_detector_class>`

Definition
----------

Detects faces in an image and store their info in a DetectedFaceList object.

.. note:: The algorithm searches for faces in the range [16px;512px]. If the image is too large to fit this range, one must resize it before the detection process.

.. important:: Loading a ``FaceDetector`` model is required to use this function.


.. tab-set::

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

      .. code:: Python

        detect_faces(self, image: Image) -> DetectedFaceList

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`DetectedFaceList<id3_face_detected_face_list_class>`
          The list of detected faces.

      **Exceptions**

        .. line-block::

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


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

      .. code:: Dart

        DetectedFaceList detectFaces(Image image)

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`DetectedFaceList<id3_face_detected_face_list_class>`
          The list of detected faces.

      **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 DetectedFaceList DetectFaces(Image image)

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`DetectedFaceList<id3_face_detected_face_list_class>`
          The list of detected faces.

      **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 DetectedFaceList detectFaces(Image image) throws FaceException

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`DetectedFaceList<id3_face_detected_face_list_class>`
          The list of detected faces.

      **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 detectFaces(image: Image) throws -> DetectedFaceList

      **Parameters**

        .. line-block::

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


      **Returns**

        .. line-block::

          :ref:`DetectedFaceList<id3_face_detected_face_list_class>`
          The list of detected faces.

      **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 id3FaceDetector_DetectFaces (
            ID3_FACE_DETECTOR hFaceDetector, 
            ID3_FACE_IMAGE hImage, 
            ID3_DETECTED_FACE_LIST hDetectedFaceList)

      **Parameters**

        .. line-block::

          ``hFaceDetector`` :ref:`ID3_FACE_DETECTOR<id3_face_face_detector_class>`
          :guilabel:`in` Handle to the FaceDetector object.

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

          ``hDetectedFaceList`` :ref:`ID3_DETECTED_FACE_LIST<id3_face_detected_face_list_class>`
          :guilabel:`out` The list of detected faces.


      **Returns**

        .. line-block::

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


