androidx.camera.core


Interfaces

Camera

The camera interface is used to control the flow of data to use cases, control the camera via the CameraControl, and publish the state of the camera via CameraInfo.

CameraControl

The CameraControl provides various asynchronous operations like zoom, focus and metering which affects output of all UseCases currently bound to that camera.

CameraFilter

An interface for filtering cameras.

CameraInfo

An interface for retrieving camera information.

CameraProvider

A CameraProvider provides basic access to a set of cameras such as querying for camera existence or information.

CameraXConfig.Provider

An interface which can be implemented to provide the configuration for CameraX.

ExposureState

An interface which contains the camera exposure related information.

ExtendableBuilder

Extendable builders are used to add externally defined options that can be passed to the implementation being built.

ImageAnalysis.Analyzer

Interface for analyzing images.

ImageCapture.OnImageSavedCallback

Listener containing callbacks for image file I/O events.

ImageCapture.ScreenFlash

Interface to do the application changes required for screen flash operations.

ImageCapture.ScreenFlashListener

Callback listener for discovering when the application has completed its changes for a screen flash image capture.

ImageCaptureCapabilities

ImageCaptureCapabilities is used to query ImageCapture use case capabilities on the device.

ImageInfo

Metadata for an image.

ImageProcessor

Post-processing effect for images.

ImageProcessor.Request

A request for processing one or multiple ImageProxy.

ImageProcessor.Response

A response for returning a processed ImageProxy to CameraX.

ImageProxy

An image proxy which has a similar interface as android.media.Image.

ImageProxy.PlaneProxy

A plane proxy which has an analogous interface as android.media.Image.Plane.

Preview.SurfaceProvider

A interface implemented by the application to provide a Surface for Preview.

PreviewCapabilities

PreviewCapabilities is used to query Preview use case capabilities on the device.

RetryPolicy

Defines a strategy for retrying upon initialization failures of the CameraProvider.

RetryPolicy.ExecutionState

Provides insights into the current execution state of the camera initialization process.

SurfaceOutput

A Surface for drawing processed camera frames.

SurfaceProcessor

Interface to implement a GPU-based post-processing effect.

SurfaceRequest.TransformationInfoListener

Listener that receives updates of the TransformationInfo associated with the SurfaceRequest.

ZoomState

An interface which contains the zoom related information from a camera.

Classes

AspectRatio

The aspect ratio of the use case.

CameraEffect

An effect for one or multiple camera outputs.

CameraSelector

A set of requirements and priorities used to select a camera or return a filtered set of cameras.

CameraSelector.Builder

Builder for a CameraSelector.

CameraState

Represents the different states the camera can be in.

CameraState.StateError

Error that the camera has encountered.

CameraXConfig

A configuration for adding implementation and user-specific behavior to CameraX.

CameraXConfig.Builder

A builder for generating CameraXConfig objects.

CompositionSettings

Composition settings for dual concurrent camera.

CompositionSettings.Builder

A builder for CompositionSettings instances.

ConcurrentCamera

Concurrent camera is a new feature introduced from Android 11, which supports simultaneous streaming of camera devices, for example, it allows a device to have both the front and back cameras operating at the same time.

ConcurrentCamera.SingleCameraConfig

Configuration for a single camera in concurrent camera mode, including CameraSelector, LifecycleOwner and UseCaseGroup.

DisplayOrientedMeteringPointFactory

A MeteringPointFactory that can convert a View (x, y) into a MeteringPoint which can then be used to construct a FocusMeteringAction to start a focus and metering action.

DynamicRange

A representation of the dynamic range of an image.

FocusMeteringAction

A configuration used to trigger a focus and/or metering action.

FocusMeteringAction.Builder

The builder used to create the FocusMeteringAction.

FocusMeteringResult

Result of the startFocusAndMetering.

ImageAnalysis

A use case providing CPU accessible images for an app to perform image analysis on.

ImageAnalysis.Builder

Builder for a ImageAnalysis.

ImageCapture

A use case for taking a picture.

ImageCapture.Builder

Builder for an ImageCapture.

ImageCapture.Metadata

Holder class for metadata that will be saved with captured images.

ImageCapture.OnImageCapturedCallback

Callback for image capture events.

ImageCapture.OutputFileOptions

Options for saving newly captured image.

ImageCapture.OutputFileOptions.Builder

Builder class for OutputFileOptions.

ImageCapture.OutputFileResults

Info about the saved image file.

ImageCaptureLatencyEstimate

An immutable representation of the estimated duration an image capture will take capturing and processing the current scene according to the scene's lighting condition and/or camera configuration.

MeteringPoint

A MeteringPoint is used to specify a region which can then be converted to sensor coordinate system for focus and metering purpose.

MeteringPointFactory

A factory to create a MeteringPoint.

MirrorMode

The mirror mode.

Preview

A use case that provides a camera preview stream for displaying on-screen.

Preview.Builder

Builder for a Preview.

ResolutionInfo

A ResolutionInfo allows the application to know the resolution information of a specific use case.

RetryPolicy.Builder

A builder class for customizing RetryPolicy behavior.

RetryPolicy.RetryConfig

Represents the outcome of a RetryPolicy decision.

RetryPolicy.RetryConfig.Builder

A builder class for creating and customizing RetryConfig objects.

SurfaceOrientedMeteringPointFactory

A MeteringPointFactory that can create MeteringPoint by surface oriented x, y on an area defined by (0, 0) - (width, height).

SurfaceOutput.Event

Events of the Surface retrieved from getSurface.

SurfaceRequest

A completable, single-use request of a Surface.

SurfaceRequest.Result

Result of providing a surface to a SurfaceRequest via provideSurface.

SurfaceRequest.TransformationInfo

Transformation associated the preview output.

TorchState

The camera flash torch state.

UseCase

The use case which all other use cases are built on top of.

UseCaseGroup

Represents a collection of UseCase.

UseCaseGroup.Builder

A builder for generating UseCaseGroup.

ViewPort

The field of view of one or many UseCases.

ViewPort.Builder

Builder for ViewPort.

Exceptions

CameraControl.OperationCanceledException

An exception representing a failure that the operation is canceled which might be caused by a new value is set or camera is closed.

CameraInfoUnavailableException

An exception thrown when unable to retrieve information about a camera.

CameraUnavailableException

CameraUnavailableException is thrown when a camera device could not be queried or opened or if the connection to an opened camera device is no longer valid.

ImageCaptureException

An exception thrown to indicate an error has occurred during image capture or while saving the captured image.

InitializationException

InitializationException is thrown when a failure occurs during an initialization process.

ProcessingException

Exception throw when effects post-processing fails.

Annotations

ExperimentalGetImage

Denotes that the annotated method uses the experimental getImage method.

ExperimentalImageCaptureOutputFormat

Denotes that the annotated method uses an experimental path for configuring output format of ImageCapture or related querying in ImageCaptureCapabilities.

ExperimentalLensFacing

Denotes that the annotated API is designed to be used with a lens facing that its behavior hasn't been verified thoroughly.

ExperimentalMirrorMode

Denotes that the annotated API is designed to be experimental for MirrorMode

ExperimentalRetryPolicy

Indicates that the annotated API uses the experimental RetryPolicy feature for CameraX initialization.

ExperimentalUseCaseApi

Denotes that the methods on use cases and use case builders are experimental and may change in a future release

ExperimentalZeroShutterLag

Denotes that the annotated API uses the experimental zero-shutter lag capture mode in ImageCapture and related querying function in CameraInfo.

Enums

CameraState.ErrorType

Types of errors the camera can encounter.

CameraState.Type

States the camera can be in.

Extension functions summary

suspend ImageProxy
ImageCapture.takePicture(
    onCaptureStarted: (() -> Unit)?,
    onCaptureProcessProgressed: ((Int) -> Unit)?,
    onPostviewBitmapAvailable: ((Bitmap) -> Unit)?
)

Captures a new still image for in memory access.

suspend ImageCapture.OutputFileResults
ImageCapture.takePicture(
    outputFileOptions: ImageCapture.OutputFileOptions,
    onCaptureStarted: (() -> Unit)?,
    onCaptureProcessProgressed: ((Int) -> Unit)?,
    onPostviewBitmapAvailable: ((Bitmap) -> Unit)?
)

Captures a new still image and saves to a file along with application specified metadata.

Extension functions

suspend fun ImageCapture.takePicture(
    onCaptureStarted: (() -> Unit)? = null,
    onCaptureProcessProgressed: ((Int) -> Unit)? = null,
    onPostviewBitmapAvailable: ((Bitmap) -> Unit)? = null
): ImageProxy

Captures a new still image for in memory access.

The caller is responsible for calling ImageProxy.close on the returned image.

Parameters
onCaptureStarted: (() -> Unit)? = null

Callback for when the camera has started exposing the frame.

onCaptureProcessProgressed: ((Int) -> Unit)? = null

Callback to report the progress of the capture's processing.

onPostviewBitmapAvailable: ((Bitmap) -> Unit)? = null

Callback to notify that the postview bitmap is available.

suspend fun ImageCapture.takePicture(
    outputFileOptions: ImageCapture.OutputFileOptions,
    onCaptureStarted: (() -> Unit)? = null,
    onCaptureProcessProgressed: ((Int) -> Unit)? = null,
    onPostviewBitmapAvailable: ((Bitmap) -> Unit)? = null
): ImageCapture.OutputFileResults

Captures a new still image and saves to a file along with application specified metadata.

Parameters
outputFileOptions: ImageCapture.OutputFileOptions

Options to store the output image file.

onCaptureStarted: (() -> Unit)? = null

Callback for when the camera has started exposing the frame.

onCaptureProcessProgressed: ((Int) -> Unit)? = null

Callback to report the progress of the capture's processing.

onPostviewBitmapAvailable: ((Bitmap) -> Unit)? = null

Callback to notify that the postview bitmap is available.