Class FaceScanner.Face

  • Direct Known Subclasses:
    FaceRecognizer.Face
    Enclosing class:
    FaceScanner

    public static class FaceScanner.Face
    extends Object
    An immutable result returned by a FaceDetector describing what was recognized.
    • Method Detail

      • getTitle

        public String getTitle()
        Display name for the recognition.
        Returns:
        Title as String
      • getDistance

        public Float getDistance()
        A score for how good the recognition is relative to others. Do not confuse with 3D distance, this is entirely about recognition.
        Returns:
        Sortable score. Lower is better.
      • getLocation

        public RectF getLocation()
        Optional location within the source image for the location of the recognized object.
        Returns:
        RectF containing location on input image
      • getCrop

        public Bitmap getCrop()
        Optional, source bitmap
        Returns:
        User-displayable Bitmap containing the cropped face
      • getExtra

        public float[] getExtra()
        Optional, raw AI output
        Returns:
        Facial features encoded in float[]
      • addRecognitionData

        public void addRecognitionData​(String title,
                                       float distance)
        Add metadata obtainable after face recognition.
        Parameters:
        title - The new title (name) to store.
        distance - The new distance to store.
      • isRecognized

        public boolean isRecognized()
        Test if the face has already been recognized (if addRecognitionData(String, float) has been called)
        Returns:
        equivalent of getDistance() < Float.MAX_VALUE
      • getBrightnessHint

        public int getBrightnessHint()
        Get information about image brightness/face light conditions
        Returns:
        negative if bad, 0 if neutral, positive if good
      • compare

        public static float compare​(float[] me,
                                    float[] other)
        Static method to compare two FaceScanner.Faces. Usually, one of the instance methods is used though.
        Parameters:
        me - The extra from one face.
        other - The extra from the other face.
        Returns:
        The distance, lower is better.
        See Also:
        compare(Face), compare(float[])