SurfaceOrientedMeteringPointFactory
public
class
SurfaceOrientedMeteringPointFactory
extends MeteringPointFactory
java.lang.Object | ||
↳ | androidx.camera.core.MeteringPointFactory | |
↳ | androidx.camera.core.SurfaceOrientedMeteringPointFactory |
A MeteringPointFactory
that can create MeteringPoint
by surface oriented x, y
on an area defined by (0, 0) - (width, height). MeteringPoint
can then be used to
construct a FocusMeteringAction
to start a focus and metering action.
The MeteringPoint
defines a normalized coordinate system whose left-top is (0, 0)
and right-bottom is (1.0, 1.0). This coordinate system is the normalized coordinate
system of a Surface
of certain aspect ratio.
SurfaceOrientedMeteringPointFactory
is the simplest factory to create this normalized
(x, y) by dividing the (x, y) with (width, height).
This factory is suitable for apps that already have coordinates converted into surface
oriented coordinates. It is also useful for apps that want to focus on something detected in
ImageAnalysis
. Apps can pass the ImageAnalysis
instance for useCaseForSurface
argument and CameraX will then adjust the final sensor coordinates by aspect ratio of
ImageAnalysis.
See also:
Summary
Public constructors | |
---|---|
SurfaceOrientedMeteringPointFactory(float width, float height)
Creates the The width/height is the width/height in surface orientation which defines an area (0, 0)
- (width, height) within which apps can specify metering points by
|
|
SurfaceOrientedMeteringPointFactory(float width, float height, UseCase useCaseForAspectRatio)
Creates the |
Inherited methods | |
---|---|
Public constructors
SurfaceOrientedMeteringPointFactory
public SurfaceOrientedMeteringPointFactory (float width, float height)
Creates the SurfaceOrientedMeteringPointFactory
by width and height
The width/height is the width/height in surface orientation which defines an area (0, 0)
- (width, height) within which apps can specify metering points by
MeteringPointFactory.createPoint(float, float)
. Setting width and height to 1.0 will allow points to
be created by specifying normalized coordinates.
By default, it will use active Preview
to get the surface aspect ratio for final
coordinates conversion.
Parameters | |
---|---|
width |
float : the width of the area in surface orientation. |
height |
float : the height of the area in surface orientation.
|
SurfaceOrientedMeteringPointFactory
public SurfaceOrientedMeteringPointFactory (float width, float height, UseCase useCaseForAspectRatio)
Creates the SurfaceOrientedMeteringPointFactory
by width, height and the surface
aspect ratio. The surface aspect ratio is retrieved from the UseCase
.
The width/height is the width/height in surface orientation which defines an
area (0, 0) - (width, height) within which apps can specify metering points by
MeteringPointFactory.createPoint(float, float)
. Setting width and height to 1.0 will allow points to
be created by specifying normalized coordinates.
A UseCase
is passed in order to determine the surface aspect ratio for final
coordinates conversion. This use case needs to be bound at the time this method is called,
otherwise an IllegalStateException
will be thrown.
Parameters | |
---|---|
width |
float : the width of the area in surface orientation. |
height |
float : the height of the area in surface orientation. |
useCaseForAspectRatio |
UseCase : the UseCase to get the surface aspect ratio.
|