# Face

public class **Face** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
Represents a face detected by `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceDetector`.

### Public Method Summary

|---|---|
| [List](https://developer.android.com/reference/java/util/List.html)\<[FaceContour](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour)\> | [getAllContours](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getAllContours())() Gets a list of all available `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour`s. |
| [List](https://developer.android.com/reference/java/util/List.html)\<[FaceLandmark](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark)\> | [getAllLandmarks](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getAllLandmarks())() Gets a list of all available `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark`s. |
| [Rect](https://developer.android.com/reference/android/graphics/Rect.html) | [getBoundingBox](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getBoundingBox())() Returns the `NonNull` axis-aligned bounding rectangle of the detected face. |
| [FaceContour](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour) | [getContour](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getContour(int))(int contourType) Gets contour based on the provided `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour.ContourType`. |
| float | [getHeadEulerAngleX](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getHeadEulerAngleX())() Returns the rotation of the face about the horizontal axis of the image, in degrees. |
| float | [getHeadEulerAngleY](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getHeadEulerAngleY())() Returns the rotation of the face about the vertical axis of the image, in degrees. |
| float | [getHeadEulerAngleZ](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getHeadEulerAngleZ())() Returns the rotation of the face about the axis pointing out of the image, in degrees. |
| [FaceLandmark](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark) | [getLandmark](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getLandmark(int))(int landmarkType) Gets a `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark` based on the provided `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark.LandmarkType`. |
| [Float](https://developer.android.com/reference/java/lang/Float.html) | [getLeftEyeOpenProbability](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getLeftEyeOpenProbability())() Returns a value between 0.0 and 1.0 giving a probability that the face's left eye is open. |
| [Float](https://developer.android.com/reference/java/lang/Float.html) | [getRightEyeOpenProbability](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getRightEyeOpenProbability())() Returns a value between 0.0 and 1.0 giving a probability that the face's right eye is open. |
| [Float](https://developer.android.com/reference/java/lang/Float.html) | [getSmilingProbability](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getSmilingProbability())() Returns a value between 0.0 and 1.0 giving a probability that the face is smiling. |
| [Integer](https://developer.android.com/reference/java/lang/Integer.html) | [getTrackingId](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#getTrackingId())() Returns the tracking ID if the tracking is enabled. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [toString](https://developers.google.com/android/reference/com/google/mlkit/vision/face/Face#toString())() |

### 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() |

## Public Methods

#### public [List](https://developer.android.com/reference/java/util/List.html)\<[FaceContour](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour)\>
**getAllContours** ()

Gets a list of all available `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour`s.
All `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour`s
are defined in `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour.ContourType`.
If no contours are available, an empty list is returned.

#### public [List](https://developer.android.com/reference/java/util/List.html)\<[FaceLandmark](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark)\>
**getAllLandmarks** ()

Gets a list of all available `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark`s.
All possible `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark`s
are defined in `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark.LandmarkType`.
If no landmarks are available, an empty list is returned.

#### public [Rect](https://developer.android.com/reference/android/graphics/Rect.html) **getBoundingBox** ()

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

#### public [FaceContour](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour)
**getContour** (int contourType)

Gets contour based on the provided `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceContour.ContourType`.
It returns `null` if the contour is not available.

#### public float **getHeadEulerAngleX** ()

Returns the rotation of the face about the horizontal axis of the image, in degrees.
Positive euler X is the face is looking up.

##### Returns

- the rotation of the face about the horizontal axis of the image

#### public float **getHeadEulerAngleY** ()

Returns the rotation of the face about the vertical axis of the image, in degrees.
Positive euler y is when the face turns toward the right side of the image that is
being processed.

##### Returns

- the rotation of the face about the vertical axis of the image

#### public float **getHeadEulerAngleZ** ()

Returns the rotation of the face about the axis pointing out of the image, in
degrees. Positive euler z is a counter-clockwise rotation within the image plane.

#### public [FaceLandmark](https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark)
**getLandmark** (int landmarkType)

Gets a `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark`
based on the provided `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceLandmark.LandmarkType`.
It returns `null` if the landmark type is not available.

#### public [Float](https://developer.android.com/reference/java/lang/Float.html) **getLeftEyeOpenProbability** ()

Returns a value between 0.0 and 1.0 giving a probability that the face's left eye is
open. This returns `null` if the probability was not computed. The
probability is not computed if classification is not enabled via `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceDetectorOptions.Builder#setClassificationMode(int)` or the feature is not
available.

#### public [Float](https://developer.android.com/reference/java/lang/Float.html) **getRightEyeOpenProbability** ()

Returns a value between 0.0 and 1.0 giving a probability that the face's right eye
is open. This returns `null` if the probability was not computed. The
probability is not computed if classification is not enabled via `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceDetectorOptions.Builder#setClassificationMode(int)` or the feature is not
available.

#### public [Float](https://developer.android.com/reference/java/lang/Float.html) **getSmilingProbability** ()

Returns a value between 0.0 and 1.0 giving a probability that the face is smiling.
This returns `null` if the probability was not computed. The probability is
not computed if classification is not enabled via `https://developers.google.com/android/reference/com/google/mlkit/vision/face/FaceDetectorOptions.Builder#setClassificationMode(int)` or the required
landmarks are not found.

#### public [Integer](https://developer.android.com/reference/java/lang/Integer.html) **getTrackingId** ()

Returns the tracking ID if the tracking is enabled. Otherwise, returns
`null`;

#### public [String](https://developer.android.com/reference/java/lang/String.html) **toString** ()