AI-generated Key Takeaways
-
FaceMeshDetector is used for finding FaceMeshs in images, performing best for selfies where the face is close to the camera.
-
It offers two functionalities: detecting face bounding boxes with low latency or detecting face meshes with 468 3D points and triangle information for up to 2 faces.
-
A FaceMeshDetector is created using FaceMeshDetection.getClient().
-
To perform detection, you need to create an InputImage and then use the process method of the FaceMeshDetector.
-
The detector can be closed to release resources.
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(); 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.