Builder
class Builder
kotlin.Any | |
↳ | android.hardware.camera2.params.Face.Builder |
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.
Summary
Public constructors | |
---|---|
Builder() |
|
Public methods | |
---|---|
Face |
build() Returns an instance of |
Face.Builder |
Bounds of the face. |
Face.Builder |
An unique id per face while the face is visible to the tracker. |
Face.Builder |
setLeftEyePosition(leftEyePosition: Point) The coordinates of the center of the left eye. |
Face.Builder |
setMouthPosition(mouthPosition: Point) The coordinates of the center of the mouth. |
Face.Builder |
setRightEyePosition(rightEyePosition: Point) The coordinates of the center of the right eye. |
Face.Builder |
The confidence level for the detection of the face. |
Public constructors
Builder
Builder(current: Face)
Parameters | |
---|---|
current |
Face: This value cannot be null . |
Public methods
build
fun build(): Face
Returns an instance of Face
created from the fields set on this builder.
Return | |
---|---|
Face |
A Face. This value cannot be null . |
setBounds
fun setBounds(bounds: Rect): Face.Builder
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
.
Parameters | |
---|---|
bounds |
Rect: Bounds of the face. This value cannot be null . |
Return | |
---|---|
Face.Builder |
This builder. |
setId
fun setId(id: Int): Face.Builder
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 {@value #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 CaptureResult.STATISTICS_FACE_DETECT_MODE
as CameraMetadata.STATISTICS_FACE_DETECT_MODE_SIMPLE
in CaptureResult
, the face id of each face is expected to be {@value #ID_UNSUPPORTED}.
This value should either be {@value #ID_UNSUPPORTED} or otherwise greater than 0
.
Parameters | |
---|---|
id |
Int: A unique ID per face visible to the tracker. |
Return | |
---|---|
Face.Builder |
This builder. |
See Also
setLeftEyePosition
fun setLeftEyePosition(leftEyePosition: Point): Face.Builder
The coordinates of the center of the left eye.
The coordinates should be in the same space as the ones for setBounds
. 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 setId
is called with {@value #ID_UNSUPPORTED}.
Parameters | |
---|---|
leftEyePosition |
Point: The position of the left eye. This value cannot be null . |
Return | |
---|---|
Face.Builder |
This builder. |
setMouthPosition
fun setMouthPosition(mouthPosition: Point): Face.Builder
The coordinates of the center of the mouth.
The coordinates should be in the same space as the ones for setBounds
. 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 setId
is called with {@value #ID_UNSUPPORTED}.
Parameters | |
---|---|
mouthPosition |
Point: The position of the mouth. This value cannot be null . |
Return | |
---|---|
Face.Builder |
This builder. |
setRightEyePosition
fun setRightEyePosition(rightEyePosition: Point): Face.Builder
The coordinates of the center of the right eye.
The coordinates should be in the same space as the ones for setBounds
.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 setId
is called with {@value #ID_UNSUPPORTED}.
Parameters | |
---|---|
rightEyePosition |
Point: The position of the right eye. This value cannot be null . |
Return | |
---|---|
Face.Builder |
This builder. |
setScore
fun setScore(score: Int): Face.Builder
The confidence level for the detection of the face.
The range is {@value #SCORE_MIN} to {@value #SCORE_MAX}. {@value #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 {@value #SCORE_MAX} is recommended.
Parameters | |
---|---|
score |
Int: Confidence level between {@value #SCORE_MIN}-{@value #SCORE_MAX}. Value is between SCORE_MIN and SCORE_MAX inclusive |
Return | |
---|---|
Face.Builder |
This builder. This value cannot be null . |
See Also