# Camera.Face

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Fields](https://developer.android.com/reference/android/hardware/Camera.Face#lfields)\|[Ctors](https://developer.android.com/reference/android/hardware/Camera.Face#pubctors)\|[Inherited Methods](https://developer.android.com/reference/android/hardware/Camera.Face#inhmethods)  

# Camera.Face

*** ** * ** ***

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

`
public
static


class
Camera.Face
`  
`

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


``


`

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

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 21.**   
We recommend using the new[android.hardware.camera2](https://developer.android.com/reference/android/hardware/camera2/package-summary)API for new applications.

Information about a face identified through camera face detection.

When face detection is used with a camera, the[FaceDetectionListener](https://developer.android.com/reference/android/hardware/Camera.FaceDetectionListener)returns a list of face objects for use in focusing and metering.

<br />

**See also:**

- [Camera.FaceDetectionListener](https://developer.android.com/reference/android/hardware/Camera.FaceDetectionListener)

## Summary

|                                                                                                            ### Fields                                                                                                             ||
|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public int`                                                                     | [id](https://developer.android.com/reference/android/hardware/Camera.Face#id) An unique id per face while the face is visible to the tracker.  |
| ` public `[Point](https://developer.android.com/reference/android/graphics/Point) | [leftEye](https://developer.android.com/reference/android/hardware/Camera.Face#leftEye) The coordinates of the center of the left eye.         |
| ` public `[Point](https://developer.android.com/reference/android/graphics/Point) | [mouth](https://developer.android.com/reference/android/hardware/Camera.Face#mouth) The coordinates of the center of the mouth.                |
| ` public `[Rect](https://developer.android.com/reference/android/graphics/Rect)   | [rect](https://developer.android.com/reference/android/hardware/Camera.Face#rect) Bounds of the face.                                          |
| ` public `[Point](https://developer.android.com/reference/android/graphics/Point) | [rightEye](https://developer.android.com/reference/android/hardware/Camera.Face#rightEye) The coordinates of the center of the right eye.      |
| ` public int`                                                                     | [score](https://developer.android.com/reference/android/hardware/Camera.Face#score) <br /> The confidence level for the detection of the face. |

|                                               ### Public constructors                                                ||
|-------------------------------------------------------------------------------------------------------------------|---|
| ` `[Face](https://developer.android.com/reference/android/hardware/Camera.Face#Face())`() ` Create an empty face. |

| ### 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*.                                                                                             | ||

## Fields

### id

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

```
public 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, may not be supported on all devices. If not supported, id will always be set to -1. The optional fields are supported as a set. Either they are all valid, or none of them are.

<br />

### leftEye

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

```
public Point leftEye
```

The coordinates of the center of the left eye. The coordinates are in the same space as the ones for[rect](https://developer.android.com/reference/android/hardware/Camera.Face#rect). This is an optional field, may not be supported on all devices. If not supported, the value will always be set to null. The optional fields are supported as a set. Either they are all valid, or none of them are.

<br />

### mouth

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

```
public Point mouth
```

The coordinates of the center of the mouth. The coordinates are in the same space as the ones for[rect](https://developer.android.com/reference/android/hardware/Camera.Face#rect). This is an optional field, may not be supported on all devices. If not supported, the value will always be set to null. The optional fields are supported as a set. Either they are all valid, or none of them are.

<br />

### rect

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

```
public Rect rect
```

Bounds of the face. (-1000, -1000) represents the top-left of the camera field of view, and (1000, 1000) represents the bottom-right of the field of view. For example, suppose the size of the viewfinder UI is 800x480. The rect passed from the driver is (-1000, -1000, 0, 0). The corresponding viewfinder rect should be (0, 0, 400, 240). It is guaranteed left \< right and top \< bottom. The coordinates can be smaller than -1000 or bigger than 1000. But at least one vertex will be within (-1000, -1000) and (1000, 1000).

The direction is relative to the sensor orientation, that is, what the sensor sees. The direction is not affected by the rotation or mirroring of[Camera.setDisplayOrientation(int)](https://developer.android.com/reference/android/hardware/Camera#setDisplayOrientation(int)). The face bounding rectangle does not provide any information about face orientation.

Here is the matrix to convert driver coordinates to View coordinates in pixels.  

```
 Matrix matrix = new Matrix();
 CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
 // Need mirror for front camera.
 boolean mirror = (info.facing == CameraInfo.CAMERA_FACING_FRONT);
 matrix.setScale(mirror ? -1 : 1, 1);
 // This is the value for android.hardware.Camera.setDisplayOrientation.
 matrix.postRotate(displayOrientation);
 // Camera driver coordinates range from (-1000, -1000) to (1000, 1000).
 // UI coordinates range from (0, 0) to (width, height).
 matrix.postScale(view.getWidth() / 2000f, view.getHeight() / 2000f);
 matrix.postTranslate(view.getWidth() / 2f, view.getHeight() / 2f);
 
```

<br />

<br />

**See also:**

- [Camera.startFaceDetection()](https://developer.android.com/reference/android/hardware/Camera#startFaceDetection())  

### rightEye

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

```
public Point rightEye
```

The coordinates of the center of the right eye. The coordinates are in the same space as the ones for[rect](https://developer.android.com/reference/android/hardware/Camera.Face#rect).This is an optional field, may not be supported on all devices. If not supported, the value will always be set to null. The optional fields are supported as a set. Either they are all valid, or none of them are.

<br />

### score

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

```
public int score
```

<br />

The confidence level for the detection of the face. The range is 1 to 100. 100 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 50 is recommended.

<br />

<br />

**See also:**

- [Camera.startFaceDetection()](https://developer.android.com/reference/android/hardware/Camera#startFaceDetection())

## Public constructors

### Face

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

```
public Face ()
```

Create an empty face.

<br />