# Face

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/hardware/camera2/params/Face#nestedclasses)\|[Constants](https://developer.android.com/reference/android/hardware/camera2/params/Face#constants)\|[Methods](https://developer.android.com/reference/android/hardware/camera2/params/Face#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/params/Face#inhmethods)  

# Face

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/hardware/camera2/params/Face "View this page in Kotlin")\|Java

`
public

final

class
Face
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|--------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.camera2.params.Face |

<br />

*** ** * ** ***

Describes a face detected in an image.

## Summary

|                                                          ### Nested classes                                                          ||
|----------|----------------------------------------------------------------------------------------------------------------------------|
| ` class` | [Face.Builder](https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder) Builds a Face object. |

|                                                                                   ### Constants                                                                                   ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED) The ID is`-1`when the optional set of fields is unsupported. |
| `int` | [SCORE_MAX](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX) The maximum possible value for the confidence level.                   |
| `int` | [SCORE_MIN](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN) The minimum possible value for the confidence level.                   |

|                                                                                                                      ### Public methods                                                                                                                       ||
|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Rect](https://developer.android.com/reference/android/graphics/Rect)   | ` `[getBounds](https://developer.android.com/reference/android/hardware/camera2/params/Face#getBounds())`() ` Bounds of the face.                                                 |
| ` int`                                                                     | ` `[getId](https://developer.android.com/reference/android/hardware/camera2/params/Face#getId())`() ` An unique id per face while the face is visible to the tracker.             |
| ` `[Point](https://developer.android.com/reference/android/graphics/Point) | ` `[getLeftEyePosition](https://developer.android.com/reference/android/hardware/camera2/params/Face#getLeftEyePosition())`() ` The coordinates of the center of the left eye.    |
| ` `[Point](https://developer.android.com/reference/android/graphics/Point) | ` `[getMouthPosition](https://developer.android.com/reference/android/hardware/camera2/params/Face#getMouthPosition())`() ` The coordinates of the center of the mouth.           |
| ` `[Point](https://developer.android.com/reference/android/graphics/Point) | ` `[getRightEyePosition](https://developer.android.com/reference/android/hardware/camera2/params/Face#getRightEyePosition())`() ` The coordinates of the center of the right eye. |
| ` int`                                                                     | ` `[getScore](https://developer.android.com/reference/android/hardware/camera2/params/Face#getScore())`() ` The confidence level for the detection of the face.                   |
| ` `[String](https://developer.android.com/reference/java/lang/String)      | ` `[toString](https://developer.android.com/reference/android/hardware/camera2/params/Face#toString())`() ` Represent the Face as a string for debugging purposes.                |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### ID_UNSUPPORTED

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ID_UNSUPPORTED
```

The ID is`-1`when the optional set of fields is unsupported.

<br />

**See also:**

- [getId()](https://developer.android.com/reference/android/hardware/camera2/params/Face#getId())

Constant Value: -1 (0xffffffff)  

### SCORE_MAX

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int SCORE_MAX
```

The maximum possible value for the confidence level.

<br />

**See also:**

- [getScore()](https://developer.android.com/reference/android/hardware/camera2/params/Face#getScore())

Constant Value: 100 (0x00000064)  

### SCORE_MIN

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int SCORE_MIN
```

The minimum possible value for the confidence level.

<br />

**See also:**

- [getScore()](https://developer.android.com/reference/android/hardware/camera2/params/Face#getScore())

Constant Value: 1 (0x00000001)

## Public methods

### getBounds

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Rect getBounds ()
```

Bounds of the face.

A rectangle relative to the sensor's[CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE](https://developer.android.com/reference/android/hardware/camera2/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`.

<br />

<br />

|                                    Returns                                    ||
|-----------------------------------------------------------------------|--------|
| [Rect](https://developer.android.com/reference/android/graphics/Rect) | <br /> |

### getId

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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](https://developer.android.com/reference/android/hardware/camera2/params/Face#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](https://developer.android.com/reference/android/hardware/camera2/CaptureResult#STATISTICS_FACE_DETECT_MODE)as[CameraMetadata.STATISTICS_FACE_DETECT_MODE_SIMPLE](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#STATISTICS_FACE_DETECT_MODE_SIMPLE)in[CaptureResult](https://developer.android.com/reference/android/hardware/camera2/CaptureResult), the face id of each face is expected to be[.ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED).

This value will either be[.ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED)or otherwise greater than`0`.

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

**See also:**

- [ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED)  

### getLeftEyePosition

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Point getLeftEyePosition ()
```

The coordinates of the center of the left eye.

The coordinates are in the same space as the ones for[getBounds()](https://developer.android.com/reference/android/hardware/camera2/params/Face#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()](https://developer.android.com/reference/android/hardware/camera2/params/Face#getId())returns[.ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED).

<br />

<br />

|                                                          Returns                                                           ||
|-------------------------------------------------------------------------|---------------------------------------------------|
| [Point](https://developer.android.com/reference/android/graphics/Point) | The left eye position, or`null`if unknown. <br /> |

### getMouthPosition

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Point getMouthPosition ()
```

The coordinates of the center of the mouth.

The coordinates are in the same space as the ones for[getBounds()](https://developer.android.com/reference/android/hardware/camera2/params/Face#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()](https://developer.android.com/reference/android/hardware/camera2/params/Face#getId())returns[.ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED).

<br />

<br />

<br />

|                                                         Returns                                                         ||
|-------------------------------------------------------------------------|------------------------------------------------|
| [Point](https://developer.android.com/reference/android/graphics/Point) | The mouth position, or`null`if unknown. <br /> |

### getRightEyePosition

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Point getRightEyePosition ()
```

The coordinates of the center of the right eye.

The coordinates are in the same space as the ones for[getBounds()](https://developer.android.com/reference/android/hardware/camera2/params/Face#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()](https://developer.android.com/reference/android/hardware/camera2/params/Face#getId())returns[.ID_UNSUPPORTED](https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED).

<br />

<br />

|                                                           Returns                                                           ||
|-------------------------------------------------------------------------|----------------------------------------------------|
| [Point](https://developer.android.com/reference/android/graphics/Point) | The right eye position, or`null`if unknown. <br /> |

### getScore

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getScore ()
```

The confidence level for the detection of the face.

The range is[.SCORE_MIN](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN)to[.SCORE_MAX](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX).[.SCORE_MAX](https://developer.android.com/reference/android/hardware/camera2/params/Face#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](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX)is recommended.

<br />

<br />

|                                                                                                                     Returns                                                                                                                      ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is between[SCORE_MIN](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN)and[SCORE_MAX](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX)inclusive <br /> |

**See also:**

- [SCORE_MAX](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX)
- [SCORE_MIN](https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN)  

### toString

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Represent the Face as a string for debugging purposes.

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string representation of the object. <br /> |