eu.id3.face

## Class FaceDetector

- java.lang.Object
- - eu.id3.face.FaceDetector

- All Implemented Interfaces:
    java.io.Serializable, java.lang.AutoCloseable

      public class FaceDetector
      extends java.lang.Object
      implements java.lang.AutoCloseable, java.io.Serializable

  Detects human faces in images.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FaceDetector()` Creates a new instance of the FaceDetector class.
    `FaceDetector(long handle)` Creates a new instance of the FaceDetector class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Releases all resources used by this FaceDetector.
    `DetectedFaceList` | `detectFaces(Image image)` Detects faces in an image and store their info in a DetectedFaceList object.
    `protected void` | `finalize()` Finalizer for this class.
    `int` | `getConfidenceThreshold()` Gets the confidence threshold, in the range [0;100].
    `long` | `getHandle()` Gets the native handle.
    `FaceModel` | `getModel()` Gets the model used to detect and track faces.
    `int` | `getNmsIouThreshold()` Gets the non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100].
    `ProcessingUnit` | `getProcessingUnit()` Gets the processing unit where to run the detection process.
    `int` | `getThreadCount()` Gets the number of threads to be used for face detection.
    `void` | `setConfidenceThreshold(int confidenceThreshold)` Sets the confidence threshold, in the range [0;100].
    `void` | `setModel(FaceModel model)` Sets the model used to detect and track faces.
    `void` | `setNmsIouThreshold(int nmsIouThreshold)` Sets the non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100].
    `void` | `setProcessingUnit(ProcessingUnit processingUnit)` Sets the processing unit where to run the detection process.
    `void` | `setThreadCount(int threadCount)` Sets the number of threads to be used for face detection.
    `void` | `trackFaces(Image image, DetectedFaceList detectedFaceList)` Tracks faces in an image and update their info in a DetectedFaceList object.
    `void` | `warmUp(int imageWidth, int imageHeight)` Gets the face detector module ready to work on a specific image size by initializing all its internal memory layout.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FaceDetector

          public FaceDetector()
                       throws FaceException

      Creates a new instance of the FaceDetector class.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### FaceDetector

          public FaceDetector(long handle)
                       throws FaceException

      Creates a new instance of the FaceDetector class.
      Parameters:
        `handle` - Handle to the FaceDetector.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

  - ### Method Detail

    - #### close

          public void close()

      Releases all resources used by this FaceDetector.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### finalize

          protected void finalize()

      Finalizer for this class. Finalizers are deprecated since Java 9+. This method is not guaranteed to be called. To release all memory held by this class please be sure to call the close() method.
      Overrides:
        `finalize` in class `java.lang.Object`

    - #### getHandle

          public long getHandle()

      Gets the native handle.
      Returns:
        The native handle.

    - #### getConfidenceThreshold

          public int getConfidenceThreshold()
                                     throws FaceException

      Gets the confidence threshold, in the range [0;100]. Hint: Default value is 50. Note: Setting a high threshold reduces false detection but can increase the number of undetected faces.
      Returns:
        Confidence threshold, in the range [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setConfidenceThreshold

          public void setConfidenceThreshold(int confidenceThreshold)
                                      throws FaceException

      Sets the confidence threshold, in the range [0;100]. Hint: Default value is 50. Note: Setting a high threshold reduces false detection but can increase the number of undetected faces.
      Parameters:
        `confidenceThreshold` - Confidence threshold, in the range [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### getModel

          public FaceModel getModel()
                             throws FaceException

      Gets the model used to detect and track faces. Hint: Default value is FaceDetector4A which is the best available algorithm in this SDK in terms of accuracy. Some better accuracy/speed balances can be found by choosing another model.
      Returns:
        Model used to detect and track faces.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setModel

          public void setModel(FaceModel model)
                        throws FaceException

      Sets the model used to detect and track faces. Hint: Default value is FaceDetector4A which is the best available algorithm in this SDK in terms of accuracy. Some better accuracy/speed balances can be found by choosing another model.
      Parameters:
        `model` - Model used to detect and track faces.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### getNmsIouThreshold

          public int getNmsIouThreshold()
                                 throws FaceException

      Gets the non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100]. Hint: Default value is 40. Note: Setting a high threshold allows to detect more overlapping faces which can be useful in a multi-face scenario. On the contrary, in a portrait scenario, a low NMS IOU threshold should be preferred.
      Returns:
        Non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setNmsIouThreshold

          public void setNmsIouThreshold(int nmsIouThreshold)
                                  throws FaceException

      Sets the non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100]. Hint: Default value is 40. Note: Setting a high threshold allows to detect more overlapping faces which can be useful in a multi-face scenario. On the contrary, in a portrait scenario, a low NMS IOU threshold should be preferred.
      Parameters:
        `nmsIouThreshold` - Non-maximum suppression (NMS) intersection-over-union (IOU) threshold, in the range is [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### getProcessingUnit

          public ProcessingUnit getProcessingUnit()
                                           throws FaceException

      Gets the processing unit where to run the detection process. Hint: Default value is CPU.
      Returns:
        Processing unit where to run the detection process.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setProcessingUnit

          public void setProcessingUnit(ProcessingUnit processingUnit)
                                 throws FaceException

      Sets the processing unit where to run the detection process. Hint: Default value is CPU.
      Parameters:
        `processingUnit` - Processing unit where to run the detection process.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### getThreadCount

          public int getThreadCount()
                             throws FaceException

      Gets the number of threads to be used for face detection. Hint: Default value is 1. Allocating more than one thread can increase the speed of the process.
      Returns:
        Number of threads to be used for face detection.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setThreadCount

          public void setThreadCount(int threadCount)
                              throws FaceException

      Sets the number of threads to be used for face detection. Hint: Default value is 1. Allocating more than one thread can increase the speed of the process.
      Parameters:
        `threadCount` - Number of threads to be used for face detection.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### detectFaces

          public DetectedFaceList detectFaces(Image image)
                                       throws FaceException

      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.
      Parameters:
        `image` - Source image to process.
      Returns:
        The list of detected faces.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### trackFaces

          public void trackFaces(Image image,
                                 DetectedFaceList detectedFaceList)
                          throws FaceException

      Tracks faces in an image and update their info in a DetectedFaceList object. In a realtime process, one must use this function instead of DetectFaces() to keep the face IDs stable in time. 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. Warning: This function is deprecated: use the FaceTracker module instead.
      Parameters:
        `image` - Source image to process.
        `detectedFaceList` - List of detected faces.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### warmUp

          public void warmUp(int imageWidth,
                             int imageHeight)
                      throws FaceException

      Gets the face detector module ready to work on a specific image size by initializing all its internal memory layout. This function can be called after setting all the parameters of the face detector module if the image size is fixed, for example using frames from a video stream. Calling this function is not mandatory as the internal memory layout is automatically initialized in the first call to detectFaces() or trackFaces() if missing. Important: Loading a ``FaceDetector`` model is required to use this function.
      Parameters:
        `imageWidth` - Width of the expected image size.
        `imageHeight` - Height of expected image size.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

Copyright © id3 Technologies. All rights reserved. eu.id3.face