eu.id3.face

## Class FaceEncoder

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

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

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

  Extracts facial features and encodes face templates.
  See Also:
    Serialized Form

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Releases all resources used by this FaceEncoder.
    `int` | `computeQuality(Image image, DetectedFace detectedFace)` Computes the quality of a detected face.
    `FaceTemplate` | `createTemplate(Image image, DetectedFace detectedFace)` Extracts the unique features of a detected face and store them in a FaceTemplate.
    `protected void` | `finalize()` Finalizer for this class.
    `long` | `getHandle()` Gets the native handle.
    `int` | `getMinimalIod()` Gets the minimal interocular distance (IOD) in pixels required to perform a face encoding.
    `FaceModel` | `getModel()` Gets the model used to create templates.
    `ProcessingUnit` | `getProcessingUnit()` Gets the processing unit where to run the encoding process.
    `int` | `getThreadCount()` Gets the number of threads to be used for template encoding.
    `void` | `setMinimalIod(int minimalIod)` Sets the minimal interocular distance (IOD) in pixels required to perform a face encoding.
    `void` | `setModel(FaceModel model)` Sets the model used to create templates.
    `void` | `setProcessingUnit(ProcessingUnit processingUnit)` Sets the processing unit where to run the encoding process.
    `void` | `setThreadCount(int threadCount)` Sets the number of threads to be used for template encoding.
    `void` | `warmUp()` Gets the face encoder module ready to work 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

    - #### FaceEncoder

          public FaceEncoder()
                      throws FaceException

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

    - #### FaceEncoder

          public FaceEncoder(long handle)
                      throws FaceException

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

  - ### Method Detail

    - #### close

          public void close()

      Releases all resources used by this FaceEncoder.
      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.

    - #### getMinimalIod

          public int getMinimalIod()
                            throws FaceException

      Gets the minimal interocular distance (IOD) in pixels required to perform a face encoding. Hint: Default value is 30 pixels. It is not recommended to change this value. Warning: Reducing the minimal required IOD to encode smaller face images may create unreliable face templates and significantly degrade recognition performances.
      Returns:
        Minimal interocular distance (IOD) in pixels required to perform a face encoding.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setMinimalIod

          public void setMinimalIod(int minimalIod)
                             throws FaceException

      Sets the minimal interocular distance (IOD) in pixels required to perform a face encoding. Hint: Default value is 30 pixels. It is not recommended to change this value. Warning: Reducing the minimal required IOD to encode smaller face images may create unreliable face templates and significantly degrade recognition performances.
      Parameters:
        `minimalIod` - Minimal interocular distance (IOD) in pixels required to perform a face encoding.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### getModel

          public FaceModel getModel()
                             throws FaceException

      Gets the model used to create templates. Hint: Default value is FaceEncoder9A 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 create templates.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setModel

          public void setModel(FaceModel model)
                        throws FaceException

      Sets the model used to create templates. Hint: Default value is FaceEncoder9A 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 create templates.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### getProcessingUnit

          public ProcessingUnit getProcessingUnit()
                                           throws FaceException

      Gets the processing unit where to run the encoding process. Hint: Default value is CPU.
      Returns:
        Processing unit where to run the encoding 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 encoding process. Hint: Default value is CPU.
      Parameters:
        `processingUnit` - Processing unit where to run the encoding 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 template encoding. 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 template encoding.
      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 template encoding. 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 template encoding.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### computeQuality

          public int computeQuality(Image image,
                                    DetectedFace detectedFace)
                             throws FaceException

      Computes the quality of a detected face. Here, quality expresses the match capability of an image: a high quality image will generate less match errors (false acceptance or false rejection) than a low quality one. Warning: A minimum interocular distance (IOD) of 30 pixels for the detected face is required for this function, below this value it will output an error. Important: Loading the ``FaceEncodingQualityEstimator`` model is required to use this function.
      Parameters:
        `image` - Source image to process.
        `detectedFace` - Detected face to process.
      Returns:
        The estimated quality of the detected face. Range is [0:100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### createTemplate

          public FaceTemplate createTemplate(Image image,
                                             DetectedFace detectedFace)
                                      throws FaceException

      Extracts the unique features of a detected face and store them in a FaceTemplate. Warning: A minimum interocular distance (IOD) of 30 pixels for the detected face is required for this function, below this value it will output an error. Important: Loading a ``FaceEncoder`` model is required to use this function.
      Parameters:
        `image` - Source image to process.
        `detectedFace` - Detected face to process.
      Returns:
        The generated face template.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### warmUp

          public void warmUp()
                      throws FaceException

      Gets the face encoder module ready to work by initializing all its internal memory layout. This function can be called after setting all the parameters of the face encoder module. Calling this function is not mandatory as the internal memory layout is automatically initialized in the first call to createTemplate() if missing. Important: Loading a ``FaceEncoder`` is required to use this function.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

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