Class TextRecognizer

java.lang.Object
com.codename1.ai.vision.TextRecognizer
All Implemented Interfaces:
VisionAnalyzer<TextRecognitionResult>, AutoCloseable

public final class TextRecognizer extends Object
Creates reusable on-device OCR analyzers. The default recognizes the Latin script; select VisionOptions.textScript(TextScript) to read Chinese, Devanagari, Japanese or Korean text.
  • Constructor Details

    • TextRecognizer

      public TextRecognizer()
      Creates an analyzer using the platform default backend and options, reading the Latin script.
      See Also:
    • TextRecognizer

      public TextRecognizer(VisionOptions options)
      Creates a reusable analyzer with explicit backend and result options. The writing system comes from VisionOptions.textScript(TextScript).
      Parameters:
      options - configuration captured by this analyzer; null uses defaults
  • Method Details

    • isSupported

      public final boolean isSupported()
      Description copied from interface: VisionAnalyzer
      Tests the exact feature/backend pair configured for this analyzer.
      Specified by:
      isSupported in interface VisionAnalyzer<T>
      Returns:
      whether this analyzer's feature/backend is available and open
    • process

      public final AsyncResource<TextRecognitionResult> process(VisionImage image)
      Starts one analysis using the retained native backend.
      Specified by:
      process in interface VisionAnalyzer<T>
      Parameters:
      image - immutable encoded or raw input
      Returns:
      asynchronous typed result
    • close

      public final void close()
      Idempotently releases the retained native backend.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface VisionAnalyzer<T>