Package com.libremobileos.yifan.face
Class FaceDetector
- java.lang.Object
-
- com.libremobileos.yifan.face.FaceDetector
-
public class FaceDetector extends Object
Detect multiple faces in one largeBitmap
and returnsFaceDetector.Face
objects. Requires preprocessedFaceDetector.InputImage
objects fromFaceDetector.InputImageProcessor
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FaceDetector.Face
An immutable result returned by aFaceDetector
describing what was recognized.static class
FaceDetector.InputImage
Wrapper aroundBitmap
to avoid user passing unprocessed datastatic class
FaceDetector.InputImageProcessor
ProcessesBitmap
s to compatible format
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FaceDetector
create(Context context, float minConfidence)
CreateFaceDetector
instance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).static FaceDetector
create(Context context, float minConfidence, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)
CreateFaceDetector
instance.List<FaceDetector.Face>
detectFaces(FaceDetector.InputImage input)
Detect multiple faces in anFaceDetector.InputImage
and return their locations.
-
-
-
Method Detail
-
create
public static FaceDetector create(Context context, float minConfidence, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads)
CreateFaceDetector
instance.- Parameters:
context
- AndroidContext
object, may be in background.minConfidence
- Minimum confidence to track a detection, must be higher than 0.0f and smaller than 1.0fhwAcceleration
- 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:
FaceDetector
instance.- See Also:
create(Context, float)
-
create
public static FaceDetector create(Context context, float minConfidence)
CreateFaceDetector
instance with sensible defaults regarding hardware acceleration (CPU, XNNPACK, 4 threads).- Parameters:
context
- AndroidContext
object, may be in background.minConfidence
- Minimum confidence to track a detection, must be higher than 0.0f and smaller than 1.0f- Returns:
FaceDetector
instance.- See Also:
create(Context, float, boolean, boolean, int)
-
detectFaces
public List<FaceDetector.Face> detectFaces(FaceDetector.InputImage input)
Detect multiple faces in anFaceDetector.InputImage
and return their locations.- Parameters:
input
- Image, processed withFaceDetector.InputImageProcessor
- Returns:
- List of
FaceDetector.Face
objects
-
-