Package com.libremobileos.yifan.face
Class FaceScanner
- java.lang.Object
-
- com.libremobileos.yifan.face.FaceScanner
-
public class FaceScanner extends Object
Raw wrapper around AI model that scans ONE Face inside a perfectly cropped Bitmap and returns facial features. Most likely, specialized classes likeFaceRecognizer
orFaceFinder
fit your use case better.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FaceScanner.Face
An immutable result returned by a FaceDetector describing what was recognized.static class
FaceScanner.InputImage
Wrapper around Bitmap to avoid user passing unprocessed datastatic class
FaceScanner.InputImageProcessor
Processes Bitmaps to compatible format.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FaceScanner
create(Context context)
CreateFaceScanner
instance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).static FaceScanner
create(Context context, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)
CreateFaceScanner
instance.FaceScanner.Face
detectFace(FaceScanner.InputImage input, boolean allowPostprocessing)
Scan the face inside theFaceScanner.InputImage
.
-
-
-
Method Detail
-
create
public static FaceScanner create(Context context, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)
CreateFaceScanner
instance.- Parameters:
context
- AndroidContext
object, may be in background.hwAcceleration
- Enable hardware acceleration (NNAPI/GPU)enhancedHwAcceleration
- if hwAcceleration is enabled, use NNAPI instead of GPU. if not, this toggles XNNPACKnumThreads
- How many threads to use, if running on CPU or with XNNPACK- Returns:
FaceScanner
instance.- See Also:
create(Context)
-
create
public static FaceScanner create(Context context)
CreateFaceScanner
instance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).- Parameters:
context
- AndroidContext
object, may be in background.- Returns:
FaceScanner
instance.- See Also:
create(Context, boolean, boolean, int)
-
detectFace
public FaceScanner.Face detectFace(FaceScanner.InputImage input, boolean allowPostprocessing)
Scan the face inside theFaceScanner.InputImage
.- Parameters:
input
- TheFaceScanner.InputImage
to processallowPostprocessing
- Allow postprocessing to improve detection quality. Undesirable when registering faces.- Returns:
FaceScanner.Face
-
-