ImageAnalysisConfig

class ImageAnalysisConfig : UseCaseConfig<ImageAnalysis!>, ImageOutputConfig, CameraDeviceConfig, ThreadConfig
kotlin.Any
   ↳ androidx.camera.core.ImageAnalysisConfig

Configuration for an image analysis use case.

Summary

Nested classes

Builder for a ImageAnalysisConfig.

Public methods

Executor?
getBackgroundExecutor(@Nullable valueIfMissing: Executor?)

Returns the executor that will be used for background tasks.

Executor

Returns the executor that will be used for background tasks.

Handler?
getCallbackHandler(@Nullable valueIfMissing: Handler?)

Returns the default handler that will be used for callbacks.

Handler

Returns the default handler that will be used for callbacks.

Int
getImageQueueDepth(valueIfMissing: Int)

Returns the number of images available to the camera pipeline.

Int

Returns the number of images available to the camera pipeline.

ImageAnalysis.ImageReaderMode?

Returns the mode that the image is acquired from ImageReader.

ImageAnalysis.ImageReaderMode

Returns the mode that the image is acquired from ImageReader.

CameraX.LensFacing?
getLensFacing(@Nullable valueIfMissing: CameraX.LensFacing?)

Returns the lens-facing direction of the camera being configured.

CameraX.LensFacing

Retrieves the lens facing direction for the primary camera to be configured.

Rational?
getTargetAspectRatio(@Nullable valueIfMissing: Rational?)

Retrieves the aspect ratio of the target intending to use images from this configuration.

Rational

Retrieves the aspect ratio of the target intending to use images from this configuration.

String?
getTargetName(@Nullable valueIfMissing: String?)

Retrieves the name of the target object being configured.

String

Retrieves the name of the target object being configured.

Size?
getTargetResolution(@Nullable valueIfMissing: Size?)

Retrieves the resolution of the target intending to use from this configuration.

Size

Retrieves the resolution of the target intending to use from this configuration.

Int
getTargetRotation(valueIfMissing: Int)

Retrieves the rotation of the target intending to use images from this configuration.

Int

Retrieves the rotation of the target intending to use images from this configuration.

Public methods

getBackgroundExecutor

@Nullable fun getBackgroundExecutor(@Nullable valueIfMissing: Executor?): Executor?

Returns the executor that will be used for background tasks.

Parameters
valueIfMissing Executor?: The value to return if this configuration option has not been set.
Return
Executor?: The stored value or valueIfMissing if the value does not exist in this configuration.

getBackgroundExecutor

@NonNull fun getBackgroundExecutor(): Executor

Returns the executor that will be used for background tasks.

Return
Executor: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getCallbackHandler

@Nullable fun getCallbackHandler(@Nullable valueIfMissing: Handler?): Handler?

Returns the default handler that will be used for callbacks.

Parameters
valueIfMissing Handler?: The value to return if this configuration option has not been set.
Return
Handler?: The stored value or valueIfMissing if the value does not exist in this configuration.

getCallbackHandler

@NonNull fun getCallbackHandler(): Handler

Returns the default handler that will be used for callbacks.

Return
Handler: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getImageQueueDepth

fun getImageQueueDepth(valueIfMissing: Int): Int

Returns the number of images available to the camera pipeline.

The image queue depth is the total number of images, including the image being analyzed, available to the camera pipeline. If analysis takes long enough, the image queue may become full and stall the camera pipeline.

Parameters
valueIfMissing Int: The value to return if this configuration option has not been set.
Return
Int: The stored value or valueIfMissing if the value does not exist in this configuration.

getImageQueueDepth

fun getImageQueueDepth(): Int

Returns the number of images available to the camera pipeline.

The image queue depth is the total number of images, including the image being analyzed, available to the camera pipeline. If analysis takes long enough, the image queue may become full and stall the camera pipeline.

Return
Int: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getImageReaderMode

@Nullable fun getImageReaderMode(@Nullable valueIfMissing: ImageAnalysis.ImageReaderMode?): ImageAnalysis.ImageReaderMode?

Returns the mode that the image is acquired from ImageReader.

The available values are ImageReaderMode#ACQUIRE_NEXT_IMAGE and .

Parameters
valueIfMissing ImageAnalysis.ImageReaderMode?: The value to return if this configuration option has not been set.
Return
ImageAnalysis.ImageReaderMode?: The stored value or valueIfMissing if the value does not exist in this configuration.

getImageReaderMode

@NonNull fun getImageReaderMode(): ImageAnalysis.ImageReaderMode

Returns the mode that the image is acquired from ImageReader.

The available values are ImageReaderMode#ACQUIRE_NEXT_IMAGE and .

Return
ImageAnalysis.ImageReaderMode: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getLensFacing

@Nullable fun getLensFacing(@Nullable valueIfMissing: CameraX.LensFacing?): CameraX.LensFacing?

Returns the lens-facing direction of the camera being configured.

Parameters
valueIfMissing CameraX.LensFacing?: The value to return if this configuration option has not been set.
Return
CameraX.LensFacing?: The stored value or valueIfMissing if the value does not exist in this configuration.

getLensFacing

@NonNull fun getLensFacing(): CameraX.LensFacing

Retrieves the lens facing direction for the primary camera to be configured.

Return
CameraX.LensFacing: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getTargetAspectRatio

@Nullable fun getTargetAspectRatio(@Nullable valueIfMissing: Rational?): Rational?

Retrieves the aspect ratio of the target intending to use images from this configuration.

This is the ratio of the target's width to the image's height, where the numerator of the provided Rational corresponds to the width, and the denominator corresponds to the height.

Parameters
valueIfMissing Rational?: The value to return if this configuration option has not been set.
Return
Rational?: The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetAspectRatio

@NonNull fun getTargetAspectRatio(): Rational

Retrieves the aspect ratio of the target intending to use images from this configuration.

This is the ratio of the target's width to the image's height, where the numerator of the provided Rational corresponds to the width, and the denominator corresponds to the height.

Return
Rational: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

@Nullable fun getTargetName(@Nullable valueIfMissing: String?): String?

Retrieves the name of the target object being configured.

The name should be a value that can uniquely identify an instance of the object being configured.

Parameters
valueIfMissing String?: The value to return if this configuration option has not been set.
Return
String?: The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetName

@NonNull fun getTargetName(): String

Retrieves the name of the target object being configured.

The name should be a value that can uniquely identify an instance of the object being configured.

Return
String: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getTargetResolution

@Nullable fun getTargetResolution(@Nullable valueIfMissing: Size?): Size?

Retrieves the resolution of the target intending to use from this configuration.

Parameters
valueIfMissing Size?: The value to return if this configuration option has not been set.
Return
Size?: The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetResolution

@NonNull fun getTargetResolution(): Size

Retrieves the resolution of the target intending to use from this configuration.

Return
Size: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.

getTargetRotation

fun getTargetRotation(valueIfMissing: Int): Int

Retrieves the rotation of the target intending to use images from this configuration.

This is one of four valid values: Surface#ROTATION_0, Surface#ROTATION_90, Surface#ROTATION_180, Surface#ROTATION_270. Rotation values are relative to the device's "natural" rotation, Surface#ROTATION_0.

Parameters
valueIfMissing Int: The value to return if this configuration option has not been set.
Return
Int: The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetRotation

fun getTargetRotation(): Int

Retrieves the rotation of the target intending to use images from this configuration.

This is one of four valid values: Surface#ROTATION_0, Surface#ROTATION_90, Surface#ROTATION_180, Surface#ROTATION_270. Rotation values are relative to the device's "natural" rotation, Surface#ROTATION_0.

Return
Int: The stored value, if it exists in this configuration.
Exceptions
IllegalArgumentException if the option does not exist in this configuration.