MlKitAnalyzer.Result


public final class MlKitAnalyzer.Result


The aggregated MLKit result of a camera frame.

Summary

Public constructors

Result(
    @NonNull Map<Detector<Object>, Object> values,
    long timestamp,
    @NonNull Map<Detector<Object>, Throwable> throwables
)

Public methods

@Nullable Throwable

The error returned from the given Detector.

long

The timestamp of the camera frame.

@Nullable T
<T> getValue(@NonNull Detector<T> detector)

Get the analysis result for the given ML Kit Detector.

Public constructors

Result

Added in 1.1.0
public Result(
    @NonNull Map<Detector<Object>, Object> values,
    long timestamp,
    @NonNull Map<Detector<Object>, Throwable> throwables
)

Public methods

getThrowable

Added in 1.1.0
public @Nullable Throwable getThrowable(@NonNull Detector<Object> detector)

The error returned from the given Detector.

Returns null if the Detector finishes without exceptions.

Parameters
@NonNull Detector<Object> detector

has to be one of the Detectors provided in MlKitAnalyzer's constructor.

getTimestamp

Added in 1.1.0
public long getTimestamp()

The timestamp of the camera frame.

The timestamp of the camera frame based on which the analysis result is produced. This is the value of getImageInfo.

getValue

Added in 1.1.0
public @Nullable T <T> getValue(@NonNull Detector<T> detector)

Get the analysis result for the given ML Kit Detector.

Returns null if the detection is unsuccessful.

This method and getThrowable may both return null. For example, when a face detector processes a frame successfully and does not detect any faces. However, if getThrowable returns a non-null Throwable, then this method will always return null.

Parameters
@NonNull Detector<T> detector

has to be one of the Detectors provided in MlKitAnalyzer's constructor.