A FaceMeshDetection
client for finding FaceMesh
s in a
supplied image, which works best in selfie use case where face is within ~2 meters, or ~6.5
feet from the camera.
The FaceMeshDetection
provides two functionalities. When
FaceMeshDetectorOptions.BOUNDING_BOX_ONLY
is selected, it detects face bounding
box in selfie image with low latency(i.e. 12ms for a 640 * 360 image on Pixel 3). When
FaceMeshDetectorOptions.FACE_MESH
is selected, it detects at most 2 faces and for each detected face it provides extra 468 3D
points and its triangle information.
A FaceMeshDetector
is created via
FaceMeshDetection.getClient(FaceMeshDetectorOptions)
or FaceMeshDetection.getClient()
,
if you wish to use the default options. For example, the code below creates a FaceMeshDetector
client with default options.
FaceMeshDetector faceMeshDetector = FaceMeshDetection.getClient();
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, rotationDegrees);
InputImage
.
Task<List<FaceMesh>> task = faceMeshDetector.process(image);
task.addOnSuccessListener(...).addOnFailureListener(...);
Public Method Summary
abstract void |
close()
Closes the detector and releases its resources.
|
abstract Task<List<FaceMesh>> | |
abstract Task<List<FaceMesh>> |
process(InputImage image)
Detects face mesh from the supplied image.
|
Inherited Method Summary
Public Methods
public abstract void close ()
Closes the detector and releases its resources.
public abstract Task<List<FaceMesh>> process (MlImage image)
public abstract Task<List<FaceMesh>> process (InputImage image)
Detects face mesh from the supplied image.
Create an InputImage
object using one of InputImage
's
factory methods. See InputImage
documentation for more details.
If there is no face gets detected, the returned Task
will
contain an empty List
.