FaceMesh

  • FaceMesh represents face mesh detected by FaceMeshDetector.

  • When BOUNDING_BOX_ONLY is selected, FaceMesh only contains a valid bounding box.

  • When FACE_MESH is selected, FaceMesh contains 468 3D face mesh points and related triangle information, represented by FaceMeshPoint.

  • The class includes methods to get all points, all triangles, the bounding box, and points for specific contours.

public class FaceMesh extends Object

Represent face mesh detected by FaceMeshDetector.

When FaceMeshDetectorOptions.BOUNDING_BOX_ONLY is selected, FaceMesh only contains valid bounding box.

When FaceMeshDetectorOptions.FACE_MESH is selected. FaceMesh also contains a group of 468 3D face mesh points and related triangle information. Each point is represented by FaceMeshPoint describing a specific position in detected face. The triangle information is a group of 3 FaceMeshPoints representing a valid surface on Face (e.g. a valid small surface on nose tip).

Nested Class Summary

@interface FaceMesh.ContourType Type of face contour. 

Constant Summary

int FACE_OVAL The outline of the subject's face.
int LEFT_EYE The outline of the subject's left eye cavity.
int LEFT_EYEBROW_BOTTOM The bottom outline of the subject's left eyebrow.
int LEFT_EYEBROW_TOP The top outline of the subject's left eyebrow.
int LOWER_LIP_BOTTOM The bottom outline of the subject's lower lip.
int LOWER_LIP_TOP The top outline of the subject's lower lip.
int NOSE_BRIDGE The outline of the subject's nose bridge.
int RIGHT_EYE The outline of the subject's right eye cavity.
int RIGHT_EYEBROW_BOTTOM The bottom outline of the subject's right eyebrow.
int RIGHT_EYEBROW_TOP The top outline of the subject's right eyebrow.
int UPPER_LIP_BOTTOM The bottom outline of the subject's upper lip.
int UPPER_LIP_TOP The top outline of the subject's upper lip.

Public Method Summary

List<FaceMeshPoint>
getAllPoints()
Gets a list of FaceMeshPoint representing the whole detected face.
List<Triangle<FaceMeshPoint>>
getAllTriangles()
Gets a list of Triangle representing logical triangle surfaces of detected face.
Rect
getBoundingBox()
Returns the NonNull axis-aligned bounding rectangle of the detected face mesh.
List<FaceMeshPoint>
getPoints(int contourType)
Gets a list of FaceMeshPoint representing a specific contour.

Inherited Method Summary

Constants

public static final int FACE_OVAL

The outline of the subject's face. It might include invisible points when user rotates the head to a certain angle.

Constant Value: 1

public static final int LEFT_EYE

The outline of the subject's left eye cavity.

Constant Value: 6

public static final int LEFT_EYEBROW_BOTTOM

The bottom outline of the subject's left eyebrow.

Constant Value: 3

public static final int LEFT_EYEBROW_TOP

The top outline of the subject's left eyebrow.

Constant Value: 2

public static final int LOWER_LIP_BOTTOM

The bottom outline of the subject's lower lip.

Constant Value: 11

public static final int LOWER_LIP_TOP

The top outline of the subject's lower lip.

Constant Value: 10

public static final int NOSE_BRIDGE

The outline of the subject's nose bridge.

Constant Value: 12

public static final int RIGHT_EYE

The outline of the subject's right eye cavity.

Constant Value: 7

public static final int RIGHT_EYEBROW_BOTTOM

The bottom outline of the subject's right eyebrow.

Constant Value: 5

public static final int RIGHT_EYEBROW_TOP

The top outline of the subject's right eyebrow.

Constant Value: 4

public static final int UPPER_LIP_BOTTOM

The bottom outline of the subject's upper lip.

Constant Value: 9

public static final int UPPER_LIP_TOP

The top outline of the subject's upper lip.

Constant Value: 8

Public Methods

public List<FaceMeshPoint> getAllPoints ()

Gets a list of FaceMeshPoint representing the whole detected face. Returns empty list if FaceMeshDetectorOptions.BOUNDING_BOX_ONLY is selected.

public List<Triangle<FaceMeshPoint>> getAllTriangles ()

Gets a list of Triangle representing logical triangle surfaces of detected face. Returns empty list if FaceMeshDetectorOptions.BOUNDING_BOX_ONLY is selected.

Each Triangle contains 3 FaceMeshPoint, representing 3 points of the triangle surface. The sequence of the 3 points are constant and always counter clockwise in face mesh.

public Rect getBoundingBox ()

Returns the NonNull axis-aligned bounding rectangle of the detected face mesh.

public List<FaceMeshPoint> getPoints (int contourType)

Gets a list of FaceMeshPoint representing a specific contour. Returns empty list if FaceMeshDetectorOptions.BOUNDING_BOX_ONLY is selected.