FaceMeshDetector

public interface FaceMeshDetector extends Detector<List<FaceMesh>>

A FaceMeshDetection client for finding FaceMeshs 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();
 
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, rotationDegrees);
 
Then the code below can detect faces in the supplied 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>>
process(MlImage image)
Detects human faces from the supplied image.
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)

Detects human faces from the supplied image.

This is an experimental API in beta version.

Create an MlImage object using one of MlImage's builder methods. See MlImage documentation for more details.

If there is no face gets detected, the returned Task will contain an empty List.

Returns

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.

Returns