Class VisionPipeline<T>

java.lang.Object
com.codename1.ai.vision.VisionPipeline<T>
All Implemented Interfaces:
AutoCloseable

public final class VisionPipeline<T> extends Object implements AutoCloseable
Connects a camera frame stream to a reusable analyzer with keep-only-latest backpressure. At most one analysis and one pending frame are retained, so a slow model cannot build an unbounded queue. Results and errors arrive on the EDT. The pipeline owns and closes the analyzer but not the camera session.
  • Constructor Details

    • VisionPipeline

      public VisionPipeline(CameraSession session, VisionAnalyzer<T> analyzer, VisionPipelineListener<T> listener)
      Attaches immediately as the session's frame listener.
      Parameters:
      session - active camera session whose frames should be analyzed
      analyzer - reusable analyzer owned by this pipeline
      listener - EDT result/error listener
  • Method Details

    • isBusy

      public boolean isBusy()
      Returns whether a frame is currently being analyzed.
      Returns:
      true while the open pipeline has an analysis in flight
    • close

      public void close()
      Stops accepting frames, detaches from the camera session, discards the pending frame, clears the busy state, and closes the analyzer. A pending frame already selected for dispatch is rechecked and discarded before it can reach the closed analyzer. Calling this method more than once has no effect.
      Specified by:
      close in interface AutoCloseable