Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class VisionOptions
- Object
- 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 labelsThe 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
Inherited methods
Constructor details
VisionOptions
public VisionOptions()Method details
backend
public VisionOptions backend(VisionBackend value)Parameters
valueVisionBackend- selector, or
nullto restore automatic selection
Returns
textScript
public VisionOptions textScript(TextScript value)TextRecognizer should read. Analyzers
other than the text recognizer ignore it.Parameters
valueTextScript- script selector, or
nullfor the platform default (Latin)
Returns
minimumConfidence
public VisionOptions minimumConfidence(float value)Parameters
valuefloat- requested threshold
Returns
Throws
IllegalArgumentException- if
valueis NaN
maximumResults
public VisionOptions maximumResults(int value)Parameters
valueint- requested limit
Returns
barcodeFormats
public VisionOptions barcodeFormats(String... values)Limits BarcodeScanner to the given BarcodeFormat
constants. The platform detector is configured with only these
symbologies, so it neither spends frame time on formats the application
will never accept nor reports one of them by mistake – which matters
most for dense codes such as PDF417, where every frame counts.
Analyzers other than the barcode scanner ignore it, as does a backend
with no way to restrict its detector (it still reports every format).
CodeScannerOptions.formats(String...) sets this for the
scanner it opens, so a CodeScanner caller does not need both.
Parameters
valuesString...- format constants; empty or
nulldetects every format the backend supports
Returns
getBarcodeFormats
public String[] getBarcodeFormats()Returns
getBackend
public VisionBackend getBackend()Returns
nullgetMinimumConfidence
public float getMinimumConfidence()Returns
getMaximumResults
public int getMaximumResults()Returns
getTextScript
public TextScript getTextScript()Returns
null for the platform
default