eu.id3.face

## Class FacePad

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

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

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

  Detects presentation attacks in still images or video frames.
  See Also:
    Serialized Form

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Releases all resources used by this FacePad.
    `int` | `computeBlurrinessScore(Image image, DetectedFace detectedFace)` Computes a blurriness score for a color image.
    `ColorBasedPadResult` | `computeColorBasedScore(Image image, DetectedFace detectedFace)` Computes the PAD score and confidence of a detected face using only the color image.
    `int` | `computeDepthBasedScore(Image image, DetectedFace detectedFace)` Computes the PAD score of a detected face using a depth map image.
    `DetectedFaceAttackSupport` | `detectAttackSupport(Image image, DetectedFace detectedFace)` Detects if an attack support surrounds the detected face.
    `protected void` | `finalize()` Finalizer for this class.
    `int` | `getAttackSupportDetectorConfidenceThreshold()` Gets the attack support detector confidence threshold, in the range [0;100].
    `long` | `getHandle()` Gets the native handle.
    `void` | `setAttackSupportDetectorConfidenceThreshold(int attackSupportDetectorConfidenceThreshold)` Sets the attack support detector confidence threshold, in the range [0;100].

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

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

- - ### Constructor Detail

    - #### FacePad

          public FacePad()
                  throws FaceException

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

    - #### FacePad

          public FacePad(long handle)
                  throws FaceException

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

  - ### Method Detail

    - #### close

          public void close()

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

    - #### getAttackSupportDetectorConfidenceThreshold

          public int getAttackSupportDetectorConfidenceThreshold()
                                                          throws FaceException

      Gets the attack support detector confidence threshold, in the range [0;100]. Hint: Default value is 25. Note: Setting a high threshold reduces false attack support detections but can increase the number of undetected attack supports.
      Returns:
        Attack support detector confidence threshold, in the range [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### setAttackSupportDetectorConfidenceThreshold

          public void setAttackSupportDetectorConfidenceThreshold(int attackSupportDetectorConfidenceThreshold)
                                                           throws FaceException

      Sets the attack support detector confidence threshold, in the range [0;100]. Hint: Default value is 25. Note: Setting a high threshold reduces false attack support detections but can increase the number of undetected attack supports.
      Parameters:
        `attackSupportDetectorConfidenceThreshold` - Attack support detector confidence threshold, in the range [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### computeBlurrinessScore

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

      Computes a blurriness score for a color image. An attack presented on a low resolution support has more chance to be blurred than a bonafide. The maximum recommended value is 20. Important: Loading the model ``FaceBlurrinessDetector`` is required to use this function.
      Parameters:
        `image` - Source image to process.
        `detectedFace` - Detected face to process.
      Returns:
        The computed blurriness score, in the range [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### computeColorBasedScore

          public ColorBasedPadResult computeColorBasedScore(Image image,
                                                            DetectedFace detectedFace)
                                                     throws FaceException

      Computes the PAD score and confidence of a detected face using only the color image. A high score means a high probability for the face to be bona-fide, hence not an attack. The minimum recommended score is 90. A low confidence means that the quality of the image is not sufficient enough to take a decision. The minimum recommended confidence is 70. Warning: A minimum IOD (64 pixels per default) for the detected face is required for this function, below this value it will output an error. Important: Loading the ``FaceColorBasedPad`` model is required to use this function.
      Parameters:
        `image` - Source image to process.
        `detectedFace` - Detected face to process.
      Returns:
        The computed PAD result including score and confidence.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### computeDepthBasedScore

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

      Computes the PAD score of a detected face using a depth map image. A high score means a high probability for the face to be bona-fide, hence not an attack. The minimum recommended value is 10. Important: Loading the ``FaceDepthBasedPad`` model is required to use this function.
      Parameters:
        `image` - Source image to process. Must be Grayscale 16 Bits.
        `detectedFace` - Detected face to process.
      Returns:
        The computed PAD score, in the range [0;100].
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

    - #### detectAttackSupport

          public DetectedFaceAttackSupport detectAttackSupport(Image image,
                                                               DetectedFace detectedFace)
                                                        throws FaceException

      Detects if an attack support surrounds the detected face. The recommended usage is to consider the image to be an attack as soon as an attack support is detected. Important: Loading the ``FaceAttackSupportDetector`` model is required to use this function.
      Parameters:
        `image` - Source image to process.
        `detectedFace` - Detected face to process.
      Returns:
        The detected face attack support.
      Throws:
        `FaceException` - An error has occurred during Face Library execution.

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