androidx.camera.common


CameraX Common is a collection of well documented common types, interfaces, wrappers, math and utilities designed to enable library and application developers to build on a shared set of types regardless of CameraX or Camera2 usage. This library is intentionally designed to be lightweight to ensure that libraries or applications that depend on it have minimal impact to their library and code size.

Library developers that can consume media content from a camera are encouraged to use these interfaces and types as part of their permanent public API surface instead of library-specific subtypes when possible. Developers that expose or develop camera libraries or applications that utilize Camera2 directly are encouraged to depend on and supply instances of these public API types directly.

Interfaces

CameraCharacteristicsMetadata

An interface that provides compatibility-focused, read-only query access to CameraCharacteristics.

CameraCharacteristicsWrapper

Wrapper interface providing compatibility-focused access to CameraCharacteristics.

CameraExtensionCharacteristicsWrapper

Compatibility wrapper around CameraExtensionCharacteristics.

CaptureRequestMetadata

An interface that provides compatibility-focused, read-only query access to the settings applied to a camera capture request.

CaptureRequestWrapper

A wrapper interface representing the settings applied to a specific camera capture request.

CaptureResultMetadata

An interface that provides compatibility-focused, read-only query access to the results of a single image capture.

CaptureResultWrapper

A wrapper interface providing compatibility-focused access to CaptureResult and custom metadata.

ColorSpaceProfilesWrapper

A compatibility wrapper for color space profiles.

DynamicRangeProfilesWrapper

Provides compatibility-focused access to android.hardware.camera2.params.DynamicRangeProfiles.

ImagePlane

A wrapper interface that mirrors Image.Plane.

ImageWrapper

A wrapper interface that mirrors the primary read-only properties of Image.

Metadata

A read-only, map-like interface for accessing unified camera metadata.

MutableImageWrapper

A mutable extension of ImageWrapper that allows modifying properties of the image.

StreamConfigurationMapWrapper

A compatibility wrapper for android.hardware.camera2.params.StreamConfigurationMap.

UnsafeWrapper

An interface for wrapper objects that hide underlying platform or implementation-specific types.

Classes

CameraFrameNumber

A strongly typed identifier for a camera frame.

CameraId

A type-safe identifier for a camera device.

DiscreteRotation

A value class representing a rotation constrained to 90-degree increments (0, 90, 180, or 270 degrees).

Metadata.Key

A type-safe key used to identify and retrieve values from a Metadata container.

Objects

CameraCharacteristicsWrapper.Keys
CameraCharacteristicsWrappers

Custom metadata keys for CameraCharacteristicsWrapper.

CameraColorSpaces

Constants and utility functions for CameraColorSpace.

CameraExtensionCharacteristicsWrappers

Helper for constructing and loading CameraExtensionCharacteristicsWrapper instances.

CameraMath

Utility functions for doing common transformations of camera and sensor coordinate spaces.

CaptureRequestWrappers
CaptureResultWrappers
ImageWrappers

Utility methods for ImageWrapper.

Extension functions summary

inline T?

Inline extension function to attempt to unwrap this object into the reified type T.

Extension functions

UnsafeWrapper.unwrapAs

inline fun <T : Any> UnsafeWrapper.unwrapAs(): T?

Inline extension function to attempt to unwrap this object into the reified type T.

This is a Kotlin-friendly helper for UnsafeWrapper.unwrapAs.

Parameters
<T : Any>

The expected type of the underlying object.

Returns
T?

The underlying object cast to T, or null if the object cannot be unwrapped.

See also
unwrapAs