public final class VisionOptions

  1. Object
  2. VisionOptions

Common analyzer configuration. An analyzer captures the supplied options when constructed; reuse it for frames needing the same backend, confidence threshold, and result limit.

ImageLabeler labeler = new ImageLabeler(new VisionOptions()
        .minimumConfidence(0.6f)   // drop guesses below 60%
        .maximumResults(5));       // keep the top five labels

The analyzer snapshots these values, so mutating the options object afterwards changes nothing – construct a second analyzer instead. Not every analyzer reads every setting: textScript(TextScript) applies only to TextRecognizer, and a backend may ignore a limit it has no way to enforce.

Constructors

public VisionOptions()

Methods

public VisionOptions backend(VisionBackend value)
public VisionOptions textScript(TextScript value)Selects the writing system TextRecognizer should read.
public VisionOptions minimumConfidence(float value)Sets the confidence threshold, clamped to 0..1.
public VisionOptions maximumResults(int value)Sets a non-negative result limit; zero means backend default/unlimited.
public VisionBackend getBackend()
public float getMinimumConfidence()
public int getMaximumResults()
public TextScript getTextScript()

Inherited methods

Constructor details

VisionOptions

public VisionOptions()

Method details

backend

public VisionOptions backend(VisionBackend value)

Parameters

value VisionBackend
selector, or null to restore automatic selection

Returns

this options object

textScript

public VisionOptions textScript(TextScript value)
Selects the writing system TextRecognizer should read. Analyzers other than the text recognizer ignore it.

Parameters

value TextScript
script selector, or null for the platform default (Latin)

Returns

this options object

minimumConfidence

public VisionOptions minimumConfidence(float value)
Sets the confidence threshold, clamped to 0..1. NaN has no meaningful ordering and is rejected instead of being passed to platform detectors.

Parameters

value float
requested threshold

Returns

this options object

Throws

IllegalArgumentException
if value is NaN

maximumResults

public VisionOptions maximumResults(int value)
Sets a non-negative result limit; zero means backend default/unlimited.

Parameters

value int
requested limit

Returns

this options object

getBackend

public VisionBackend getBackend()

Returns

selected backend, never null

getMinimumConfidence

public float getMinimumConfidence()

Returns

confidence threshold in the range 0..1

getMaximumResults

public int getMaximumResults()

Returns

non-negative result limit; zero means backend default/unlimited

getTextScript

public TextScript getTextScript()

Returns

the selected writing system, or null for the platform default