Package com.libremobileos.yifan.face
Class FaceFinder
- java.lang.Object
-
- com.libremobileos.yifan.face.FaceFinder
-
public class FaceFinder extends Object
Combination ofFaceDetectorandFaceScannerfor workloads where both face detection and face scanning are required. However, this class makes no assumptions about the workload and is therefore bare-bones. Because of this, usage of a task-specific class likeFaceRecognizeris highly recommended, unless these do not fit your use case.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FaceFindercreate(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation)Create newFaceFinderinstance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).static FaceFindercreate(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)Create newFaceFinderinstance.List<Pair<FaceDetector.Face,FaceScanner.Face>>process(Bitmap input, boolean allowPostprocessing)Process a Bitmap usingFaceDetector, scanning the resulting found faces usingFaceScannerafter manually cropping the image.
-
-
-
Method Detail
-
create
public static FaceFinder create(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)
Create newFaceFinderinstance.- Parameters:
ctx- AndroidContextobject, may be in background.minConfidence- Minimum confidence to track a detection, must be higher than 0.0f and smaller than 1.0finputWidth- width of theBitmaps that are going to be processedinputHeight- height of theBitmaps that are going to be processedsensorOrientation- rotation if the image should be rotated, or 0.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:
FaceFinderinstance- See Also:
create(Context, float, int, int, int)
-
create
public static FaceFinder create(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation)
Create newFaceFinderinstance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).- Parameters:
ctx- AndroidContextobject, may be in background.minConfidence- Minimum confidence to track a detection, must be higher than 0.0f and smaller than 1.0finputWidth- width of theBitmaps that are going to be processedinputHeight- height of theBitmaps that are going to be processedsensorOrientation- rotation if the image should be rotated, or 0.- Returns:
- FaceFinder instance
- See Also:
create(Context, float, int, int, int, boolean, boolean, int)
-
process
public List<Pair<FaceDetector.Face,FaceScanner.Face>> process(Bitmap input, boolean allowPostprocessing)
Process a Bitmap usingFaceDetector, scanning the resulting found faces usingFaceScannerafter manually cropping the image. Adds extra metadata (location) toFaceScanner.Facebased on best effort basis.- Parameters:
input- Bitmap to process.allowPostprocessing- Allow postprocessing to improve detection quality. Undesirable when registering faces.- Returns:
ListofPairs of detection results fromFaceDetectorandFaceScanner
-
-