Class SceneAnalysisCollectionBuilder

java.lang.Object
io.github.jspinak.brobot.action.internal.find.scene.SceneAnalysisCollectionBuilder

@Component public class SceneAnalysisCollectionBuilder extends Object
Orchestrates the creation and population of scene analysis collections for color-based matching.

SceneAnalysisCollectionBuilder serves as the entry point for comprehensive color analysis workflows in the Brobot framework. It coordinates scene acquisition, target selection, and pixel-level analysis to produce collections ready for matching operations.

Primary responsibilities:

  • Acquire scenes through screenshots or provided images
  • Determine target images for matching
  • Select additional images for classification context
  • Coordinate pixel analysis across all scenes

ObjectCollection usage pattern:

  • First collection: Target images to find as matches
  • Second collection: Additional classification context
  • Third+ collections: Scenes to analyze

When scene analysis is not required (non-color matching), scenes are simply wrapped in SceneAnalysis objects without pixel processing.

See Also:
  • Constructor Details

  • Method Details

    • get

      public SceneAnalyses get(List<ObjectCollection> objectCollections, int scenesToCapture, double secondsBetweenCaptures, ActionConfig actionConfig)
      Creates a collection of analyzed scenes for color-based matching operations.

      Orchestrates the complete workflow from scene acquisition to pixel analysis:

      1. Acquires scenes (screenshots or provided images)
      2. Determines if color analysis is required
      3. Identifies target and context images
      4. Performs pixel analysis on each scene

      When color analysis is not required (non-COLOR find operations), scenes are wrapped without pixel processing for efficiency.

      Side effects: May capture screenshots if no scenes provided

      Parameters:
      objectCollections - collections containing targets, context, and scenes
      scenesToCapture - number of screenshots to take if no scenes provided
      secondsBetweenCaptures - delay between multiple screenshots
      actionConfig - configuration including find type and thresholds
      Returns:
      SceneAnalysisCollection ready for matching operations
    • getTargetImages

      public Set<StateImage> getTargetImages(List<ObjectCollection> images)
      Extracts target images from the first ObjectCollection.

      Target images are the primary patterns to find in the scene. These images will be both classified and matched, generating concrete Match objects when found.

      The first ObjectCollection by convention contains targets. An empty first collection indicates classify-only mode with no specific matching targets.

      Parameters:
      images - list of ObjectCollections
      Returns:
      set of target images to find, may be empty