Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#inhmethods)

# Face.Builder

*** ** * ** ***

` public static final class Face.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Builds a Face object.

This builder is public to allow for easier application testing by creating custom object instances. It's not necessary to construct these objects during normal use of the camera API.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#Builder()() ` |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#Builder(android.hardware.camera2.params.Face)(https://developer.android.com/reference/android/hardware/camera2/params/Face current) ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#build()() ` Returns an instance of `Face` created from the fields set on this builder. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect bounds) ` Bounds of the face. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setId(int)(int id) ` An unique id per face while the face is visible to the tracker. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setLeftEyePosition(android.graphics.Point)(https://developer.android.com/reference/android/graphics/Point leftEyePosition) ` The coordinates of the center of the left eye. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setMouthPosition(android.graphics.Point)(https://developer.android.com/reference/android/graphics/Point mouthPosition) ` The coordinates of the center of the mouth. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setRightEyePosition(android.graphics.Point)(https://developer.android.com/reference/android/graphics/Point rightEyePosition) ` The coordinates of the center of the right eye. |
| ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | ` https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setScore(int)(int score) ` The confidence level for the detection of the face. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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*.

## Public constructors

### Builder

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

```
public Builder ()
```

<br />

<br />

### Builder

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

```
public Builder (Face current)
```

<br />

<br />

| Parameters ||
|---|---|
| `current` | `Face`: This value cannot be `null`. <br /> |

## Public methods

### build

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

```
public Face build ()
```

Returns an instance of `Face` created from the fields set on this builder.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face` | A Face. This value cannot be `null`. <br /> |

### setBounds

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

```
public Face.Builder setBounds (Rect bounds)
```

Bounds of the face.

A rectangle relative to the sensor's `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 />

| Parameters ||
|---|---|
| `bounds` | `Rect`: Bounds of the face. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | This builder. <br /> |

### setId

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

```
public Face.Builder setId (int id)
```

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 `https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED` then the leftEyePosition, rightEyePosition, and mouthPositions should be `null`. Otherwise, each of leftEyePosition, rightEyePosition, and mouthPosition may be independently null or not-null. When devices report the value of key `https://developer.android.com/reference/android/hardware/camera2/CaptureResult#STATISTICS_FACE_DETECT_MODE` as `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#STATISTICS_FACE_DETECT_MODE_SIMPLE` in `https://developer.android.com/reference/android/hardware/camera2/CaptureResult`, the face id of each face is expected to be `https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED`.

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

<br />

<br />

| Parameters ||
|---|---|
| `id` | `int`: A unique ID per face visible to the tracker. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | This builder. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED`

### setLeftEyePosition

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

```
public Face.Builder setLeftEyePosition (Point leftEyePosition)
```

The coordinates of the center of the left eye.

The coordinates should be in the same space as the ones for `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setBounds(android.graphics.Rect)`. This is an optional field and may not be supported on all devices. If not supported, the value should always be unset or set to null. This value should always be null if `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setId(int)` is called with `https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED`.

<br />

<br />

| Parameters ||
|---|---|
| `leftEyePosition` | `Point`: The position of the left eye. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | This builder. <br /> |

### setMouthPosition

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

```
public Face.Builder setMouthPosition (Point mouthPosition)
```

The coordinates of the center of the mouth.

The coordinates should be in the same space as the ones for `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setBounds(android.graphics.Rect)`. This is an optional field and may not be supported on all devices. If not supported, the value should always be set to null. This value should always be null if `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setId(int)` is called with `https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED`.

<br />

<br />

<br />

| Parameters ||
|---|---|
| `mouthPosition` | `Point`: The position of the mouth. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | This builder. <br /> |

### setRightEyePosition

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

```
public Face.Builder setRightEyePosition (Point rightEyePosition)
```

The coordinates of the center of the right eye.

The coordinates should be in the same space as the ones for `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setBounds(android.graphics.Rect)`.This is an optional field and may not be supported on all devices. If not supported, the value should always be set to null. This value should always be null if `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder#setId(int)` is called with `https://developer.android.com/reference/android/hardware/camera2/params/Face#ID_UNSUPPORTED`.

<br />

<br />

| Parameters ||
|---|---|
| `rightEyePosition` | `Point`: The position of the right eye. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | This builder. <br /> |

### setScore

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

```
public Face.Builder setScore (int score)
```

The confidence level for the detection of the face.

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

<br />

<br />

| Parameters ||
|---|---|
| `score` | `int`: Confidence level between `https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN`-`https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX`. Value is between `https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN` and `https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX` inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/Face.Builder` | This builder. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MAX`
- `https://developer.android.com/reference/android/hardware/camera2/params/Face#SCORE_MIN`