Register now for Android Dev Summit 2019!

ImageAnalysis.Analyzer

public static interface ImageAnalysis.Analyzer

androidx.camera.core.ImageAnalysis.Analyzer


Interface for analyzing images.

Implement Analyzer and pass it to ImageAnalysis.setAnalyzer(Analyzer) to receive images and perform custom processing by implementing the analyze(ImageProxy, int) function.

Summary

Public methods

abstract void analyze(ImageProxy image, int rotationDegrees)

Analyzes an image to produce a result.

Public methods

analyze

public abstract void analyze (ImageProxy image, 
                int rotationDegrees)

Analyzes an image to produce a result.

This method is called once for each image from the camera, and called at the frame rate of the camera. Each analyze call is executed sequentially.

The caller is responsible for ensuring this analysis method can be executed quickly enough to prevent stalls in the image acquisition pipeline. Otherwise, newly available images will not be acquired and analyzed.

The image passed to this method becomes invalid after this method returns. The caller should not store external references to this image, as these references will become invalid.

Processing should complete within a single frame time of latency, or the image data should be copied out for longer processing. Applications can be skip analyzing a frame by having the analyzer return immediately.

Parameters
image ImageProxy: The image to analyze

rotationDegrees int: The rotation which if applied to the image would make it match the current target rotation of ImageAnalysis, expressed in degrees in the range [0..360).