# FaceMesh

public class **FaceMesh** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
Represent face mesh detected by `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetector`.

When `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions#BOUNDING_BOX_ONLY` is selected, `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh` only
contains valid bounding box.

When `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions#FACE_MESH`
is selected. `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh` also
contains a group of 468 3D face mesh points and related triangle information. Each point is
represented by `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint`
describing a specific position in detected face. The triangle information is a group of 3
`https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint`s
representing a valid surface on Face (e.g. a valid small surface on nose tip).

### Nested Class Summary

|---|---|---|---|
| @interface | [FaceMesh.ContourType](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh.ContourType) || Type of face contour. |

### Constant Summary

|---|---|---|
| int | [FACE_OVAL](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#FACE_OVAL) | The outline of the subject's face. |
| int | [LEFT_EYE](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#LEFT_EYE) | The outline of the subject's left eye cavity. |
| int | [LEFT_EYEBROW_BOTTOM](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#LEFT_EYEBROW_BOTTOM) | The bottom outline of the subject's left eyebrow. |
| int | [LEFT_EYEBROW_TOP](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#LEFT_EYEBROW_TOP) | The top outline of the subject's left eyebrow. |
| int | [LOWER_LIP_BOTTOM](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#LOWER_LIP_BOTTOM) | The bottom outline of the subject's lower lip. |
| int | [LOWER_LIP_TOP](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#LOWER_LIP_TOP) | The top outline of the subject's lower lip. |
| int | [NOSE_BRIDGE](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#NOSE_BRIDGE) | The outline of the subject's nose bridge. |
| int | [RIGHT_EYE](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#RIGHT_EYE) | The outline of the subject's right eye cavity. |
| int | [RIGHT_EYEBROW_BOTTOM](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#RIGHT_EYEBROW_BOTTOM) | The bottom outline of the subject's right eyebrow. |
| int | [RIGHT_EYEBROW_TOP](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#RIGHT_EYEBROW_TOP) | The top outline of the subject's right eyebrow. |
| int | [UPPER_LIP_BOTTOM](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#UPPER_LIP_BOTTOM) | The bottom outline of the subject's upper lip. |
| int | [UPPER_LIP_TOP](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#UPPER_LIP_TOP) | The top outline of the subject's upper lip. |

### Public Method Summary

|---|---|
| [List](https://developer.android.com/reference/java/util/List.html)\<[FaceMeshPoint](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint)\> | [getAllPoints](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#getAllPoints())() Gets a list of `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint` representing the whole detected face. |
| [List](https://developer.android.com/reference/java/util/List.html)\<Triangle\<[FaceMeshPoint](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint)\>\> | [getAllTriangles](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#getAllTriangles())() Gets a list of `https://developers.google.com/android/reference/com/google/mlkit/vision/common/Triangle` representing logical triangle surfaces of detected face. |
| [Rect](https://developer.android.com/reference/android/graphics/Rect.html) | [getBoundingBox](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#getBoundingBox())() Returns the `NonNull` axis-aligned bounding rectangle of the detected face mesh. |
| [List](https://developer.android.com/reference/java/util/List.html)\<[FaceMeshPoint](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint)\> | [getPoints](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMesh#getPoints(int))(int contourType) Gets a list of `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint` representing a specific contour. |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## 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](https://developer.android.com/reference/java/util/List.html)\<[FaceMeshPoint](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint)\>
**getAllPoints** ()

Gets a list of `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint`
representing the whole detected face. Returns empty list if `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions#BOUNDING_BOX_ONLY` is selected.

#### public [List](https://developer.android.com/reference/java/util/List.html)\<Triangle\<[FaceMeshPoint](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint)\>\>
**getAllTriangles** ()

Gets a list of `https://developers.google.com/android/reference/com/google/mlkit/vision/common/Triangle`
representing logical triangle surfaces of detected face. Returns empty list if
`https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions#BOUNDING_BOX_ONLY` is selected.

Each `https://developers.google.com/android/reference/com/google/mlkit/vision/common/Triangle`
contains 3 `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/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](https://developer.android.com/reference/android/graphics/Rect.html) **getBoundingBox** ()

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

#### public [List](https://developer.android.com/reference/java/util/List.html)\<[FaceMeshPoint](https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint)\>
**getPoints** (int contourType)

Gets a list of `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshPoint`
representing a specific contour. Returns empty list if `https://developers.google.com/android/reference/com/google/mlkit/vision/facemesh/FaceMeshDetectorOptions#BOUNDING_BOX_ONLY` is selected.