Face

public class Face extends Object

A human face detected in an image or video.

It is important to note that all fields described here are with regards to the image that the detector has processed. Many live apps that process images directly from the camera show the user a mirrored display of the actual image.

All coordinate values are reported as absolute image coordinates. That is, image position (0, 0) represents the upper-left corner of the image.

Constant Summary

float UNCOMPUTED_PROBABILITY The value that a probability is set to if it was not computed.

Public Method Summary

float
getEulerY()
Returns the rotation of the face about the vertical axis of the image.
float
getEulerZ()
Returns the rotation of the face about the axis pointing out of the image.
float
getHeight()
Returns the height of the face region in pixels.
int
getId()
Returns the face ID.
float
getIsLeftEyeOpenProbability()
Returns a value between 0.0 and 1.0 giving a probability that the face's left eye is open.
float
getIsRightEyeOpenProbability()
Returns a value between 0.0 and 1.0 giving a probability that the face's right eye is open.
float
getIsSmilingProbability()
Returns a value between 0.0 and 1.0 giving a probability that the face is smiling.
List<Landmark>
getLandmarks()
Returns a list of Landmarks (eyes, nose, etc.) found on the face.
PointF
getPosition()
Returns the top left position of the face within the image.
float
getWidth()
Returns the width of the face region in pixels.

Inherited Method Summary

Constants

public static final float UNCOMPUTED_PROBABILITY

The value that a probability is set to if it was not computed.

Constant Value: -1.0

Public Methods

public float getEulerY ()

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

Returns
  • the rotation of the face about the vertical axis of the image

public float getEulerZ ()

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

Returns
  • the rotation of the face about the axis pointing out of the image

public float getHeight ()

Returns the height of the face region in pixels. This is a rough estimate that is likely to be slightly larger than the exact bounds of the face and therefore may include some background.

Returns
  • the height of the face in pixels

public int getId ()

Returns the face ID. This can be used to track a Face over multiple Frames.

public float getIsLeftEyeOpenProbability ()

Returns a value between 0.0 and 1.0 giving a probability that the face's left eye is open.

This returns UNCOMPUTED_PROBABILITY if the probability was not computed. The probability is not computed if eye open classification is not enabled via setClassificationType(int) or the LEFT_EYE landmark was not found.

Returns
  • the probability for the face's left eye being open

public float getIsRightEyeOpenProbability ()

Returns a value between 0.0 and 1.0 giving a probability that the face's right eye is open.

This returns UNCOMPUTED_PROBABILITY if the probability was not computed. The probability is not computed if eye open classification is not enabled via setClassificationType(int) or the RIGHT_EYE landmark was not found.

Returns
  • the probability for the face's right eye being open

public float getIsSmilingProbability ()

Returns a value between 0.0 and 1.0 giving a probability that the face is smiling.

This returns UNCOMPUTED_PROBABILITY if the probability was not computed. The probability is not computed if smile classification is not enabled via setClassificationType(int) or the required landmarks are not found. The LEFT_MOUTH, RIGHT_MOUTH, and NOSE_BASE landmarks are required to compute a smile probability.

Returns
  • the probability that the face is smiling

public List<Landmark> getLandmarks ()

Returns a list of Landmarks (eyes, nose, etc.) found on the face. A landmark detector must be specified via setLandmarkType(int) to detect landmarks. The landmark detector may not find all possible landmarks on any given face.

Returns
  • a list of landmarks found on the face

public PointF getPosition ()

Returns the top left position of the face within the image.

public float getWidth ()

Returns the width of the face region in pixels. This is a rough estimate that is likely to be slightly larger than the exact bounds of the face and therefore may include some background.

Returns
  • the width of the face in pixels