Package com.libremobileos.yifan.face
Class FaceFinder
- java.lang.Object
-
- com.libremobileos.yifan.face.FaceFinder
-
public class FaceFinder extends Object
Combination ofFaceDetector
andFaceScanner
for 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 likeFaceRecognizer
is 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 FaceFinder
create(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation)
Create newFaceFinder
instance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).static FaceFinder
create(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)
Create newFaceFinder
instance.List<Pair<FaceDetector.Face,FaceScanner.Face>>
process(Bitmap input, boolean allowPostprocessing)
Process a Bitmap usingFaceDetector
, scanning the resulting found faces usingFaceScanner
after 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 newFaceFinder
instance.- Parameters:
ctx
- AndroidContext
object, may be in background.minConfidence
- Minimum confidence to track a detection, must be higher than 0.0f and smaller than 1.0finputWidth
- width of theBitmap
s that are going to be processedinputHeight
- height of theBitmap
s 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:
FaceFinder
instance- See Also:
create(Context, float, int, int, int)
-
create
public static FaceFinder create(Context ctx, float minConfidence, int inputWidth, int inputHeight, int sensorOrientation)
Create newFaceFinder
instance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).- Parameters:
ctx
- AndroidContext
object, may be in background.minConfidence
- Minimum confidence to track a detection, must be higher than 0.0f and smaller than 1.0finputWidth
- width of theBitmap
s that are going to be processedinputHeight
- height of theBitmap
s 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 usingFaceScanner
after manually cropping the image. Adds extra metadata (location) toFaceScanner.Face
based on best effort basis.- Parameters:
input
- Bitmap to process.allowPostprocessing
- Allow postprocessing to improve detection quality. Undesirable when registering faces.- Returns:
List
ofPair
s of detection results fromFaceDetector
andFaceScanner
-
-