ImageAnalysis

public final class ImageAnalysis
extends UseCase

java.lang.Object
   ↳ androidx.camera.core.UseCase
     ↳ androidx.camera.core.ImageAnalysis


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

ImageAnalysis acquires images from the camera via an ImageReader. Each image is provided to an ImageAnalysis.Analyzer function which can be implemented by application code, where it can access image data for application analysis via an ImageProxy.

The application is responsible for calling ImageProxy.close() to close the image. Failing to close the image will cause future images to be stalled or dropped depending on the backpressure strategy.

Summary

Nested classes

interface ImageAnalysis.Analyzer

Interface for analyzing images. 

class ImageAnalysis.Builder

Builder for a ImageAnalysis

Constants

int OUTPUT_IMAGE_FORMAT_RGBA_8888

Images sent to the analyzer will have RGBA format.

int OUTPUT_IMAGE_FORMAT_YUV_420_888

Images sent to the analyzer will have YUV format.

int STRATEGY_BLOCK_PRODUCER

Block the producer from generating new images.

int STRATEGY_KEEP_ONLY_LATEST

Only deliver the latest image to the analyzer, dropping images as they arrive.

Public methods

void clearAnalyzer()

Removes a previously set analyzer.

int getBackpressureStrategy()

Returns the mode with which images are acquired from the image producer.

int getImageQueueDepth()

Returns the number of images available to the camera pipeline, including the image being analyzed, for the STRATEGY_BLOCK_PRODUCER backpressure mode.

int getOutputImageFormat()

Gets output image format.

ResolutionInfo getResolutionInfo()

Gets resolution related information of the ImageAnalysis.

int getTargetRotation()

Returns the rotation of the intended target for images.

boolean isOutputImageRotationEnabled()

Checks if output image rota