The Android Developer Challenge is back! Submit your idea before December 2.

MeteringPoint

public class MeteringPoint
extends Object

java.lang.Object
   ↳ 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

Rational getFOVAspectRatio()

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

float getNormalizedCropRegionX()

Normalized crop region X (Ranging from 0 to 1)

float getNormalizedCropRegionY()

Normalized crop region Y (Ranging from 0 to 1)

float getSize()

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

float getWeight()

Weight of the MeteringPoint (Ranging from 0 to 1)

void setFOVAspectRatio(Rational fovAspectRatio)

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

void setSize(float size)

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

void setWeight(float weight)

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

Inherited methods

Public methods

getFOVAspectRatio

public Rational getFOVAspectRatio ()

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

Returns
Rational

getNormalizedCropRegionX

public float getNormalizedCropRegionX ()

Normalized crop region X (Ranging from 0 to 1)

Returns
float

getNormalizedCropRegionY

public float getNormalizedCropRegionY ()

Normalized crop region Y (Ranging from 0 to 1)

Returns
float

getSize

public float getSize ()

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

Returns
float

getWeight

public float getWeight ()

Weight of the MeteringPoint (Ranging from 0 to 1)

Returns
float

setFOVAspectRatio

public void setFOVAspectRatio (Rational fovAspectRatio)

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

Parameters
fovAspectRatio Rational

setSize

public void setSize (float size)

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
 

Parameters
size float

setWeight

public void setWeight (float weight)

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

Parameters
weight float