Face Stay organized with collections Save and categorize content based on your preferences.
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
| List<Contour> | getContours() Returns a list of contours (eyes, nose, etc.) found on the face. |
| 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 floatUNCOMPUTED_PROBABILITY
The value that a probability is set to if it was not computed.
Public Methods
publicList<Contour>getContours()
Returns a list ofcontours (eyes, nose, etc.) found on the face. A contour detector must be specified via FaceDetector.Builder.setLandmarkType(int) to detect contours. The contour detector may not find all possible contour on any given face.
Returns
- a list of landmarks found on the face
public floatgetEulerY()
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 floatgetEulerZ()
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 floatgetHeight()
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 intgetId()
Returns the face ID. This can be used to track a Face over multipleFrames.
public floatgetIsLeftEyeOpenProbability()
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 FaceDetector.Builder.setClassificationType(int) or theLandmark.LEFT_EYE landmark was not found.
Returns
- the probability for the face's left eye being open
public floatgetIsRightEyeOpenProbability()
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 FaceDetector.Builder.setClassificationType(int) or theLandmark.RIGHT_EYE landmark was not found.
Returns
- the probability for the face's right eye being open
public floatgetIsSmilingProbability()
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 FaceDetector.Builder.setClassificationType(int) or the required landmarks are not found. TheLandmark.LEFT_MOUTH,Landmark.RIGHT_MOUTH, andLandmark.NOSE_BASE landmarks are required to compute a smile probability.
Returns
- the probability that the face is smiling
publicList<Landmark>getLandmarks()
Returns a list ofLandmarks (eyes, nose, etc.) found on the face. A landmark detector must be specified via FaceDetector.Builder.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
publicPointFgetPosition()
Returns the top left position of the face within the image.
public floatgetWidth()
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
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-06-17 UTC.