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

ImageAnalysisConfig

public final class ImageAnalysisConfig
extends Object implements Config, UseCaseEventConfig

java.lang.Object
   ↳ androidx.camera.core.ImageAnalysisConfig


Configuration for an image analysis use case.

Summary

Nested classes

class ImageAnalysisConfig.Builder

Builder for a ImageAnalysisConfig

Public methods

Executor getBackgroundExecutor()

Returns the executor that will be used for background tasks.

Executor getBackgroundExecutor(Executor valueIfMissing)

Returns the executor that will be used for background tasks.

int getImageQueueDepth(int valueIfMissing)

Returns the number of images available to the camera pipeline.

int getImageQueueDepth()

Returns the number of images available to the camera pipeline.

ImageAnalysis.ImageReaderMode getImageReaderMode()

Returns the mode that the image is acquired from ImageReader.

ImageAnalysis.ImageReaderMode getImageReaderMode(ImageAnalysis.ImageReaderMode valueIfMissing)

Returns the mode that the image is acquired from ImageReader.

CameraX.LensFacing getLensFacing()

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

CameraX.LensFacing getLensFacing(CameraX.LensFacing valueIfMissing)

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

AspectRatio getTargetAspectRatio(AspectRatio valueIfMissing)

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

AspectRatio getTargetAspectRatio()

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

String getTargetName()

Retrieves the name of the target object being configured.

String getTargetName(String valueIfMissing)

Retrieves the name of the target object being configured.

Size getTargetResolution(Size valueIfMissing)

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

Size getTargetResolution()

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

int getTargetRotation()

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

int getTargetRotation(int valueIfMissing)

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

Inherited methods

Public methods

getBackgroundExecutor

public Executor getBackgroundExecutor ()

Returns the executor that will be used for background tasks.

Returns
Executor The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getBackgroundExecutor

public Executor getBackgroundExecutor (Executor valueIfMissing)

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.

Returns
Executor The stored value or valueIfMissing if the value does not exist in this configuration.

getImageQueueDepth

public int getImageQueueDepth (int valueIfMissing)

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.

Returns
int The stored value or valueIfMissing if the value does not exist in this configuration.

getImageQueueDepth

public int getImageQueueDepth ()

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.

Returns
int The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getImageReaderMode

public ImageAnalysis.ImageReaderMode getImageReaderMode ()

Returns the mode that the image is acquired from ImageReader.

The available values are ImageAnalysis.ImageReaderMode.ACQUIRE_NEXT_IMAGE and ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE.

Returns
ImageAnalysis.ImageReaderMode The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getImageReaderMode

public ImageAnalysis.ImageReaderMode getImageReaderMode (ImageAnalysis.ImageReaderMode valueIfMissing)

Returns the mode that the image is acquired from ImageReader.

The available values are ImageAnalysis.ImageReaderMode.ACQUIRE_NEXT_IMAGE and ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE.

Parameters
valueIfMissing ImageAnalysis.ImageReaderMode: The value to return if this configuration option has not been set.

Returns
ImageAnalysis.ImageReaderMode The stored value or valueIfMissing if the value does not exist in this configuration.

getLensFacing

public CameraX.LensFacing getLensFacing ()

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

Returns
CameraX.LensFacing The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getLensFacing

public CameraX.LensFacing getLensFacing (CameraX.LensFacing valueIfMissing)

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.

Returns
CameraX.LensFacing The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetAspectRatio

public AspectRatio getTargetAspectRatio (AspectRatio valueIfMissing)

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

Parameters
valueIfMissing AspectRatio: The value to return if this configuration option has not been set.

Returns
AspectRatio The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetAspectRatio

public AspectRatio getTargetAspectRatio ()

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

Returns
AspectRatio The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

public String getTargetName ()

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.

Returns
String The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

public String getTargetName (String valueIfMissing)

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.

Returns
String The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetResolution

public Size getTargetResolution (Size valueIfMissing)

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.

Returns
Size The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetResolution

public Size getTargetResolution ()

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

Returns
Size The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetRotation

public int getTargetRotation ()

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.

Returns
int The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetRotation

public int getTargetRotation (int valueIfMissing)

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.

Returns
int The stored value or valueIfMissing if the value does not exist in this configuration.