Package com.libremobileos.yifan.face
Class FaceScanner.Face
- java.lang.Object
-
- com.libremobileos.yifan.face.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRecognitionData(String title, float distance)Add metadata obtainable after face recognition.floatcompare(float[] other)Compare twoFaceScanner.Facesstatic floatcompare(float[] me, float[] other)Static method to compare twoFaceScanner.Faces.floatcompare(FaceScanner.Face other)Compare twoFaceScanner.FacesintgetBrightnessHint()Get information about image brightness/face light conditionsBitmapgetCrop()Optional, source bitmapFloatgetDistance()A score for how good the recognition is relative to others.float[]getExtra()Optional, raw AI outputRectFgetLocation()Optional location within the source image for the location of the recognized object.StringgetTitle()Display name for the recognition.booleanisRecognized()Test if the face has already been recognized (ifaddRecognitionData(String, float)has been called)StringtoString()
-
-
-
Method Detail
-
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:
RectFcontaining location on input image
-
getCrop
public Bitmap getCrop()
Optional, source bitmap- Returns:
- User-displayable
Bitmapcontaining 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 (ifaddRecognitionData(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 twoFaceScanner.Faces. Usually, one of the instance methods is used though.- Parameters:
me- Theextrafrom one face.other- Theextrafrom the other face.- Returns:
- The
distance, lower is better. - See Also:
compare(Face),compare(float[])
-
compare
public float compare(float[] other)
Compare twoFaceScanner.Faces- Parameters:
other- Theextrafrom the other face.- Returns:
- The
distance, lower is better. - See Also:
compare(Face),compare(float[], float[])
-
compare
public float compare(FaceScanner.Face other)
Compare twoFaceScanner.Faces- Parameters:
other- The other face.- Returns:
- The
distance, lower is better. - See Also:
compare(float[]),compare(float[], float[])
-
-