public final class
FaceDetector
Performs face detection on images.
The API expects a TFLite model with TFLite Model Metadata..
- Input image
MPImage
- The image that the face detector runs on.
- Output FaceDetectorResult
FaceDetectorResult
- A FaceDetectorResult containing detected faces.
Nested Classes
class | FaceDetector.FaceDetectorOptions | Options for setting up a FaceDetector . |
Public Methods
static FaceDetector |
createFromBuffer(Context context, ByteBuffer modelBuffer)
Creates a
FaceDetector instance from a model buffer and the default FaceDetector.FaceDetectorOptions . |
static FaceDetector |
createFromFile(Context context, String modelPath)
Creates a
FaceDetector instance from a model file and the default FaceDetector.FaceDetectorOptions . |
static FaceDetector |
createFromFile(Context context, File modelFile)
Creates a
FaceDetector instance from a model file and the default FaceDetector.FaceDetectorOptions . |
static FaceDetector |
createFromOptions(Context context, FaceDetector.FaceDetectorOptions detectorOptions)
Creates a
FaceDetector instance from a FaceDetector.FaceDetectorOptions . |
FaceDetectorResult | |
FaceDetectorResult |
detect(MPImage image, ImageProcessingOptions imageProcessingOptions)
Performs face detection on the provided single image.
|
void |
detectAsync(MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Sends live image data to perform face detection, and the results will be available via the
OutputHandler.ResultListener provided in the FaceDetector.FaceDetectorOptions . |
void |
detectAsync(MPImage image, long timestampMs)
Sends live image data to perform face detection with default image processing options, i.e.
|
FaceDetectorResult |
detectForVideo(MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Performs face detection on the provided video frame.
|
FaceDetectorResult |
detectForVideo(MPImage image, long timestampMs)
Performs face detection on the provided video frame with default image processing options, i.e.
|
Inherited Methods
Public Methods
public static FaceDetector createFromBuffer (Context context, ByteBuffer modelBuffer)
Creates a FaceDetector
instance from a model buffer and the default FaceDetector.FaceDetectorOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
modelBuffer | a direct ByteBuffer or a ERROR(/MappedByteBuffer) of the detection
model. |
Throws
if there is an error during FaceDetector creation.
|
public static FaceDetector createFromFile (Context context, String modelPath)
Creates a FaceDetector
instance from a model file and the default FaceDetector.FaceDetectorOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
modelPath | path to the detection model with metadata in the assets. |
Throws
if there is an error during FaceDetector creation.
|
public static FaceDetector createFromFile (Context context, File modelFile)
Creates a FaceDetector
instance from a model file and the default FaceDetector.FaceDetectorOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
modelFile | the detection model File instance. |
Throws
IOException | if an I/O error occurs when opening the tflite model file. |
---|---|
if there is an error during FaceDetector creation.
|
public static FaceDetector createFromOptions (Context context, FaceDetector.FaceDetectorOptions detectorOptions)
Creates a FaceDetector
instance from a FaceDetector.FaceDetectorOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
detectorOptions | a FaceDetector.FaceDetectorOptions |