Face

public class Face extends Object

Represents a face detected by FaceDetector.

Public Method Summary

List<FaceContour>
getAllContours()
Gets a list of all available FaceContours.
List<FaceLandmark>
getAllLandmarks()
Gets a list of all available FaceLandmarks.
Rect
getBoundingBox()
Returns the NonNull axis-aligned bounding rectangle of the detected face.
FaceContour
getContour(int contourType)
Gets contour based on the provided FaceContour.ContourType.
float
getHeadEulerAngleX()
Returns the rotation of the face about the horizontal axis of the image, in degrees.
float
getHeadEulerAngleY()
Returns the rotation of the face about the vertical axis of the image, in degrees.
float
getHeadEulerAngleZ()
Returns the rotation of the face about the axis pointing out of the image, in degrees.
FaceLandmark
getLandmark(int landmarkType)
Gets a FaceLandmark based on the provided FaceLandmark.LandmarkType.
Float
getLeftEyeOpenProbability()
Returns a value between 0.0 and 1.0 giving a probability that the face's left eye is open.
Float
getRightEyeOpenProbability()
Returns a value between 0.0 and 1.0 giving a probability that the face's right eye is open.
Float
getSmilingProbability()
Returns a value between 0.0 and 1.0 giving a probability that the face is smiling.
Integer
getTrackingId()
Returns the tracking ID if the tracking is enabled.
String

Inherited Method Summary

Public Methods

public List<FaceContour> getAllContours ()

Gets a list of all available FaceContours. All FaceContours are defined in FaceContour.ContourType. If no contours are available, an empty list is returned.

public List<FaceLandmark> getAllLandmarks ()

Gets a list of all available FaceLandmarks. All possible FaceLandmarks are defined in FaceLandmark.LandmarkType. If no landmarks are available, an empty list is returned.

public Rect getBoundingBox ()

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

public FaceContour getContour (int contourType)

Gets contour based on the provided 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 getLandmark (int landmarkType)

Gets a FaceLandmark based on the provided FaceLandmark.LandmarkType. It returns null if the landmark type is not available.

public Float 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 FaceDetectorOptions.Builder.setClassificationMode(int) or the feature is not available.

public Float 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 FaceDetectorOptions.Builder.setClassificationMode(int) or the feature is not available.

public Float 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 FaceDetectorOptions.Builder.setClassificationMode(int) or the required landmarks are not found.

public Integer getTrackingId ()

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

public String toString ()