Face
  public
  
  final
  
  class
  Face
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.hardware.camera2.params.Face | 
Describes a face detected in an image.
Summary
| Nested classes | |
|---|---|
| 
        
        
        
        
        class | Face.BuilderBuilds a Face object. | 
| Constants | |
|---|---|
| int | ID_UNSUPPORTEDThe ID is  | 
| int | SCORE_MAXThe maximum possible value for the confidence level. | 
| int | SCORE_MINThe minimum possible value for the confidence level. | 
| Public methods | |
|---|---|
| 
        
        
        
        
        
        Rect | 
      getBounds()
      Bounds of the face. | 
| 
        
        
        
        
        
        int | 
      getId()
      An unique id per face while the face is visible to the tracker. | 
| 
        
        
        
        
        
        Point | 
      getLeftEyePosition()
      The coordinates of the center of the left eye. | 
| 
        
        
        
        
        
        Point | 
      getMouthPosition()
      The coordinates of the center of the mouth. | 
| 
        
        
        
        
        
        Point | 
      getRightEyePosition()
      The coordinates of the center of the right eye. | 
| 
        
        
        
        
        
        int | 
      getScore()
      The confidence level for the detection of the face. | 
| 
        
        
        
        
        
        String | 
      toString()
      Represent the Face as a string for debugging purposes. | 
| Inherited methods | |
|---|---|
Constants
ID_UNSUPPORTED
public static final int ID_UNSUPPORTED
The ID is -1 when the optional set of fields is unsupported.
See also:
Constant Value: -1 (0xffffffff)
SCORE_MAX
public static final int SCORE_MAX
The maximum possible value for the confidence level.
See also:
Constant Value: 100 (0x00000064)
SCORE_MIN
public static final int SCORE_MIN
The minimum possible value for the confidence level.
See also:
Constant Value: 1 (0x00000001)
Public methods
getBounds
public Rect getBounds ()
Bounds of the face.
A rectangle relative to the sensor's
 CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE, with (0,0)
 representing the top-left corner of the active array rectangle.
There is no constraints on the Rectangle value other than it
 is not-null.
| Returns | |
|---|---|
| Rect | |
getId
public int getId ()
An unique id per face while the face is visible to the tracker.
If the face leaves the field-of-view and comes back, it will get a new id.
This is an optional field and may not be supported on all devices.
 If the id is .ID_UNSUPPORTED then the leftEyePosition, rightEyePosition, and
 mouthPositions are guaranteed to be null. Otherwise, each of leftEyePosition,
 rightEyePosition, and mouthPosition may be independently null or not-null. When devices
 report the value of key CaptureResult.STATISTICS_FACE_DETECT_MODE as
 CameraMetadata.STATISTICS_FACE_DETECT_MODE_SIMPLE in CaptureResult,
 the face id of each face is expected to be .ID_UNSUPPORTED.
This value will either be .ID_UNSUPPORTED or
 otherwise greater than 0.
| Returns | |
|---|---|
| int | |
See also:
getLeftEyePosition
public Point getLeftEyePosition ()
The coordinates of the center of the left eye.
The coordinates are in
 the same space as the ones for getBounds(). This is an
 optional field and may not be supported on all devices. If not
 supported, the value will always be set to null.
 This value will  always be null only if getId() returns
 .ID_UNSUPPORTED.
| Returns | |
|---|---|
| Point | The left eye position, or nullif unknown. | 
getMouthPosition
public Point getMouthPosition ()
The coordinates of the center of the mouth.
The coordinates are in
 the same space as the ones for getBounds(). This is an optional
 field and may not be supported on all devices. If not
 supported, the value will always be set to null.
 This value will  always be null only if getId() returns
 .ID_UNSUPPORTED.
| Returns | |
|---|---|
| Point | The mouth position, or nullif unknown. | 
getRightEyePosition
public Point getRightEyePosition ()
The coordinates of the center of the right eye.
The coordinates are
 in the same space as the ones for getBounds().This is an
 optional field and may not be supported on all devices. If not
 supported, the value will always be set to null.
 This value will  always be null only if getId() returns
 .ID_UNSUPPORTED.
| Returns | |
|---|---|
| Point | The right eye position, or nullif unknown. | 
getScore
public int getScore ()
The confidence level for the detection of the face.
The range is .SCORE_MIN to .SCORE_MAX.
 .SCORE_MAX is the highest confidence.
Depending on the device, even very low-confidence faces may be
 listed, so applications should filter out faces with low confidence,
 depending on the use case. For a typical point-and-shoot camera
 application that wishes to display rectangles around detected faces,
 filtering out faces with confidence less than half of .SCORE_MAX
 is recommended.
| Returns | |
|---|---|
| int | Value is between SCORE_MINandSCORE_MAXinclusive | 
toString
public String toString ()
Represent the Face as a string for debugging purposes.
| Returns | |
|---|---|
| String | a string representation of the object. | 
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
