FocusMeteringAction
public
final
class
FocusMeteringAction
extends Object
| java.lang.Object | |
| ↳ | androidx.camera.core.FocusMeteringAction |
A configuration used to trigger a focus and/or metering action.
To construct a FocusMeteringAction, apps have to create a FocusMeteringAction.Builder by
FocusMeteringAction.Builder.from(MeteringPoint) or FocusMeteringAction.Builder.from(MeteringPoint, int).
MeteringPoint is a point used to specify the focus/metering areas. Apps can use various
MeteringPointFactory to create the points. When the FocusMeteringAction is built,
pass it to CameraControl.startFocusAndMetering(FocusMeteringAction) to initiate the focus
and metering action.
The default FocusMeteringAction.MeteringMode is FocusMeteringAction.MeteringMode.AF | FocusMeteringAction.MeteringMode.AE |
FocusMeteringAction.MeteringMode.AWB which means the point is used for all AF/AE/AWB regions. Apps can set
the proper FocusMeteringAction.MeteringMode to optionally exclude some 3A regions. Multiple regions for
specific 3A type are also supported via FocusMeteringAction.Builder.addPoint(MeteringPoint) or
FocusMeteringAction.Builder.addPoint(MeteringPoint, int). App can also this API to enable
different region for AF and AE respectively.
If any AF points are specified, it will trigger autofocus to start a manual scan. When
focus is locked and specified AF/AE/AWB regions are updated in capture result, the returned
ListenableFuture in CameraControl.startFocusAndMetering(FocusMeteringAction)
will completed with FocusMeteringResult.isFocusSuccessful() set to indicate if focus is
done successfully or not. If AF point is not specified, it will not trigger autofocus and
simply wait for specified AE/AWB regions being updated to complete the returned
ListenableFuture. In the case of AF points not specified,
FocusMeteringResult.isFocusSuccessful() will be set to false. If Af points are
specified but current camera does not support auto focus,
FocusMeteringResult.isFocusSuccessful() will be set to true .
App can set a auto-cancel duration to let CameraX call
CameraControl.cancelFocusAndMetering() automatically in the specified duration. By
default the auto-cancel duration is 5 seconds. Apps can call FocusMeteringAction.Builder.disableAutoCancel()
to disable auto-cancel.
Summary
Nested classes | |
|---|---|
class |
FocusMeteringAction.Builder
The builder used to create the |
@interface |
FocusMeteringAction.MeteringMode
Focus/Metering mode used to specify which 3A regions is activated for corresponding
|
Public methods | |
|---|---|
long
|
getAutoCancelDurationInMillis()
Returns auto-cancel duration. |
List<MeteringPoint>
|
getMeteringPointsAe()
Returns all |
List<MeteringPoint>
|
getMeteringPointsAf()
Returns all |
List<MeteringPoint>
|
getMeteringPointsAwb()
Returns all |
boolean
|
isAutoCancelEnabled()
Returns if auto-cancel is enabled or not. |
Inherited methods | |
|---|---|
Public methods
getAutoCancelDurationInMillis
public long getAutoCancelDurationInMillis ()
Returns auto-cancel duration. Returns 0 if auto-cancel is disabled.
| Returns | |
|---|---|
long |
|
getMeteringPointsAe
public List<MeteringPoint> getMeteringPointsAe ()
Returns all MeteringPoints used for AE regions.
| Returns | |
|---|---|
List<MeteringPoint> |
|
getMeteringPointsAf
public List<MeteringPoint> getMeteringPointsAf ()
Returns all MeteringPoints used for AF regions.
| Returns | |
|---|---|
List<MeteringPoint> |
|
getMeteringPointsAwb
public List<MeteringPoint> getMeteringPointsAwb ()
Returns all MeteringPoints used for AWB regions.
| Returns | |
|---|---|
List<MeteringPoint> |
|
isAutoCancelEnabled
public boolean isAutoCancelEnabled ()
Returns if auto-cancel is enabled or not.
| Returns | |
|---|---|
boolean |
|
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.