Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

MeteringPoint

open class MeteringPoint
kotlin.Any
   ↳ androidx.camera.core.MeteringPoint

A MeteringPoint used to specify a region in sensor coordinates for focusing and metering Purpose.

To create a MeteringPoint, apps have to use DisplayOrientedMeteringPointFactory or SensorOrientedMeteringPointFactory. The X/Y insides a MeteringPoint represents the normalized X/Y inside current crop region. If no crop region is set, the the whole sensor area is used. AreaSize represents the width and the height of the metering area and Weight can also be specified. By default, a MeteringPoint is mapped to the sensor coordinates using Preview aspect ratio. A custom FOV aspect ratio can be set if apps want to use aspect ratio other than Preview.

Summary

Public methods

open Rational?

Get custom aspect ratio to be adjusted for final sensor coordinates.

open Float

Normalized crop region X (Ranging from 0 to 1)

open Float

Normalized crop region Y (Ranging from 0 to 1)

open Float

Size of the MeteringPoint(ranging from 0 to 1).

open Float

Weight of the MeteringPoint (Ranging from 0 to 1)

open Unit
setFOVAspectRatio(@Nullable fovAspectRatio: Rational?)

Set custom aspect ratio to be adjusted for final sensor coordinates.

open Unit
setSize(size: Float)

Sets the size of MeteringPoint (ranging from 0 to 1).

open Unit
setWeight(weight: Float)

Sets weight of this metering point (ranging from 0 to 1)

Public methods

getFOVAspectRatio

@Nullable open fun getFOVAspectRatio(): Rational?

Get custom aspect ratio to be adjusted for final sensor coordinates.

getNormalizedCropRegionX

open fun getNormalizedCropRegionX(): Float

Normalized crop region X (Ranging from 0 to 1)

getNormalizedCropRegionY

open fun getNormalizedCropRegionY(): Float

Normalized crop region Y (Ranging from 0 to 1)

getSize

open fun getSize(): Float

Size of the MeteringPoint(ranging from 0 to 1). The value represents the percentage of current crop region width/height

getWeight

open fun getWeight(): Float

Weight of the MeteringPoint (Ranging from 0 to 1)

setFOVAspectRatio

open fun setFOVAspectRatio(@Nullable fovAspectRatio: Rational?): Unit

Set custom aspect ratio to be adjusted for final sensor coordinates.

setSize

open fun setSize(size: Float): Unit

Sets the size of MeteringPoint (ranging from 0 to 1). It is the percentage of the sensor width/height (or cropRegion width/height if crop region is set)

Metering Area width = size * cropRegion.width
      Metering Area height = size * cropRegion.height
      

setWeight

open fun setWeight(weight: Float): Unit

Sets weight of this metering point (ranging from 0 to 1)