Stay organized with collections
Save and categorize content based on your preferences.
class MeteringPoint
A MeteringPoint
is used to specify a region which can then be converted to sensor coordinate system for focus and metering purpose.
Conceptually, a MeteringPoint
is a opaque handle to a metering point created by a MeteringPointFactory
, for use when building a FocusMeteringAction
. The coordinates of the point are specified by the application when creating points from the factory, and then the coordinates are converted into an internal representation stored by this class. Because of the nature of internal representation, the X and Y of the MeteringPoint
is not publicly visible. These are for internal use only.
When a FocusMeteringAction
is submitted via startFocusAndMetering
, the MeteringPoint
is converted to a point in the sensor coordinate system where it defines the center of a metering rectangle. If zoom is applied via CameraControl
, it will set a crop region calculated by the zoom and the final coordinates will be mapped into the crop region. If not set, it is mapped to the sensor active array.
Besides defining the center point of the metering rectangle, there is also the size of the MeteringPoint
. The size of the MeteringPoint
ranges from 0 to 1.0. The size is the percentage of sensor width and height (or crop region width/height if crop region is set). See formula below:
Metering rectangle width = size * sensorSizeOrCropRegion.width
Metering rectangle height = size * sensorSizeOrCropRegion.height
The metering rectangle defined by the
MeteringPoint
has the same shape as the sensor array.
Summary
Public functions |
Float |
Size of the MeteringPoint width and height (ranging from 0 to 1).
|
Public functions
fun getSize(): Float
Size of the MeteringPoint width and height (ranging from 0 to 1). It is the percentage of the sensor width/height (or crop region width/height if crop region is set).
Crop region is set when zoom is set in CameraControl
and it is the region inside the sensor active array and it defines the output region of the sensor. See formula below:
Metering rectangle width = size * sensorSizeOrCropRegion.width
Metering rectangle height = size * sensorSizeOrCropRegion.height
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-15 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-15 UTC."],[],[],null,["# MeteringPoint\n=============\n\nArtifact: [androidx.camera:camera-core](/jetpack/androidx/releases/camera) \n[View Source](https://cs.android.com/search?q=file:androidx/camera/core/MeteringPoint.java+class:androidx.camera.core.MeteringPoint) \nAdded in [1.0.0](/jetpack/androidx/releases/camera#1.0.0)\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/androidx/camera/core/MeteringPoint \"View this page in Java\")\n\n\n```\nclass MeteringPoint\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint) is used to specify a region which can then be converted to sensor coordinate system for focus and metering purpose.\n\nConceptually, a [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint) is a opaque handle to a metering point created by a [MeteringPointFactory](/reference/kotlin/androidx/camera/core/MeteringPointFactory), for use when building a [FocusMeteringAction](/reference/kotlin/androidx/camera/core/FocusMeteringAction). The coordinates of the point are specified by the application when creating points from the factory, and then the coordinates are converted into an internal representation stored by this class. Because of the nature of internal representation, the X and Y of the [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint) is not publicly visible. These are for internal use only.\n\nWhen a [FocusMeteringAction](/reference/kotlin/androidx/camera/core/FocusMeteringAction) is submitted via [startFocusAndMetering](/reference/kotlin/androidx/camera/core/CameraControl#startFocusAndMetering(androidx.camera.core.FocusMeteringAction)), the [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint) is converted to a point in the sensor coordinate system where it defines the center of a metering rectangle. If zoom is applied via [CameraControl](/reference/kotlin/androidx/camera/core/CameraControl) , it will set a crop region calculated by the zoom and the final coordinates will be mapped into the crop region. If not set, it is mapped to the sensor active array.\n\nBesides defining the center point of the metering rectangle, there is also the size of the [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint). The size of the [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint) ranges from 0 to 1.0. The size is the percentage of sensor width and height (or crop region width/height if crop region is set). See formula below: \n\n```kotlin\nMetering rectangle width = size * sensorSizeOrCropRegion.width\nMetering rectangle height = size * sensorSizeOrCropRegion.height\n```\nThe metering rectangle defined by the [MeteringPoint](/reference/kotlin/androidx/camera/core/MeteringPoint) has the same shape as the sensor array.\n\nSummary\n-------\n\n| ### Public functions |\n|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [getSize](/reference/kotlin/androidx/camera/core/MeteringPoint#getSize())`()` Size of the MeteringPoint width and height (ranging from 0 to 1). |\n\nPublic functions\n----------------\n\n### getSize\n\nAdded in [1.0.0](/jetpack/androidx/releases/camera#1.0.0) \n\n```\nfun getSize(): Float\n```\n\nSize of the MeteringPoint width and height (ranging from 0 to 1). It is the percentage of the sensor width/height (or crop region width/height if crop region is set).\n\nCrop region is set when zoom is set in [CameraControl](/reference/kotlin/androidx/camera/core/CameraControl) and it is the region inside the sensor active array and it defines the output region of the sensor. See formula below: \n\n```kotlin\nMetering rectangle width = size * sensorSizeOrCropRegion.width\nMetering rectangle height = size * sensorSizeOrCropRegion.height\n```"]]