Entry point to get a FaceDetector
for finding Faces in a supplied
image.
A FaceDetector
is created via
getClient(FaceDetectorOptions) or getClient()
if you wish to use the default options. For example, the code below creates a FaceDetector
with default options.
FaceDetector faceDetector = FaceDetection.getClient();
To perform face detection in an image, you first need to create an instance of
InputImage
from a Bitmap,
ByteBuffer,
Image
etc. See InputImage
documentation for more details. For example, the code below creates an InputImage
from a Bitmap.
InputImage image = InputImage.fromBitmap(bitmap);
Then the code below can detect faces in the supplied InputImage.
Task<List<Face>> task = faceDetector.process(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
| static FaceDetector |
getClient(FaceDetectorOptions
options)
Gets a new instance of
FaceDetector
that detects faces in a supplied image.
|
| static FaceDetector |
getClient()
Gets an instance of
FaceDetector
that detects faces in a supplied image with a default FaceDetectorOptions.
|
Gets a new instance of FaceDetector
that detects faces in a supplied image.
To release the resources associated with a FaceDetector, you need to ensure that
close()
is called on the resulting FaceDetector
object once it will no longer be used.
| options | the options for the face detector |
|---|
Gets an instance of FaceDetector
that detects faces in a supplied image with a default FaceDetectorOptions.