MlKitAnalyzer.Result

class MlKitAnalyzer.Result


The aggregated MLKit result of a camera frame.

Summary

Public constructors

Result(
    values: (Mutable)Map<Detector<Any!>!, Any!>,
    timestamp: Long,
    throwables: (Mutable)Map<Detector<Any!>!, Throwable!>
)

Public functions

Throwable?
getThrowable(detector: Detector<Any!>)

The error returned from the given Detector.

Long

The timestamp of the camera frame.

T?
<T> getValue(detector: Detector<T!>)

Get the analysis result for the given ML Kit Detector.

Public constructors

Result

Added in 1.1.0
Result(
    values: (Mutable)Map<Detector<Any!>!, Any!>,
    timestamp: Long,
    throwables: (Mutable)Map<Detector<Any!>!, Throwable!>
)

Public functions

getThrowable

Added in 1.1.0
fun getThrowable(detector: Detector<Any!>): Throwable?

The error returned from the given Detector.

Returns null if the Detector finishes without exceptions.

Parameters
detector: Detector<Any!>

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

getTimestamp

Added in 1.1.0
fun getTimestamp(): Long

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
fun <T> getValue(detector: Detector<T!>): T?

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
detector: Detector<T!>

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