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 void
addRecognitionData(String title, float distance)
Add metadata obtainable after face recognition.float
compare(float[] other)
Compare twoFaceScanner.Face
sstatic float
compare(float[] me, float[] other)
Static method to compare twoFaceScanner.Face
s.float
compare(FaceScanner.Face other)
Compare twoFaceScanner.Face
sint
getBrightnessHint()
Get information about image brightness/face light conditionsBitmap
getCrop()
Optional, source bitmapFloat
getDistance()
A score for how good the recognition is relative to others.float[]
getExtra()
Optional, raw AI outputRectF
getLocation()
Optional location within the source image for the location of the recognized object.String
getTitle()
Display name for the recognition.boolean
isRecognized()
Test if the face has already been recognized (ifaddRecognitionData(String, float)
has been called)String
toString()
-
-
-
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:
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 (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.Face
s. Usually, one of the instance methods is used though.- Parameters:
me
- Theextra
from one face.other
- Theextra
from the other face.- Returns:
- The
distance
, lower is better. - See Also:
compare(Face)
,compare(float[])
-
compare
public float compare(float[] other)
Compare twoFaceScanner.Face
s- Parameters:
other
- Theextra
from 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.Face
s- Parameters:
other
- The other face.- Returns:
- The
distance
, lower is better. - See Also:
compare(float[])
,compare(float[], float[])
-
-