Class SimilarImagesFindOptions
This class encapsulates parameters specific to finding similar images between two ObjectCollections. The first ObjectCollection contains base images for comparison, and the second ObjectCollection contains images to compare against the base images. For each image in the second collection, it finds the best matching image from the first collection and returns a Match object with similarity scores.
This is particularly useful for:
- Screen state recognition - determining which known screen is currently displayed
- Image classification - categorizing images based on similarity to known templates
- Change detection - finding which images have changed between collections
- Duplicate detection - identifying similar or duplicate images across collections
The similarity comparison is performed at the Pattern level, where each StateImage's patterns are compared to find the best match. The larger image automatically becomes the scene, while the smaller becomes the search target.
Example usage:
// Create options for finding similar images
SimilarImagesFindOptions options = new SimilarImagesFindOptions.Builder()
.setSimilarity(0.85) // Minimum similarity threshold
.setComparisonMethod(ComparisonMethod.BEST_MATCH)
.build();
// First collection contains base images
ObjectCollection baseImages = new ObjectCollection.Builder()
.withImages(knownScreens)
.build();
// Second collection contains images to compare
ObjectCollection compareImages = new ObjectCollection.Builder()
.withImages(capturedScreens)
.build();
// Perform comparison
ActionResult result = action.perform(options, baseImages, compareImages);
// Result contains one Match per image in compareImages
- Since:
- 2.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder for constructingSimilarImagesFindOptions
with a fluent API.static enum
Defines how images are compared when multiple patterns exist.Nested classes/interfaces inherited from class io.github.jspinak.brobot.action.ActionConfig
ActionConfig.Illustrate
-
Method Summary
Modifier and TypeMethodDescriptionstatic SimilarImagesFindOptions
Creates a configuration optimized for change detection.static SimilarImagesFindOptions
Creates a configuration optimized for finding duplicate images.static SimilarImagesFindOptions
Creates a configuration optimized for screen state recognition.Gets the find strategy for this options instance.boolean
boolean
Methods inherited from class io.github.jspinak.brobot.action.basic.find.BaseFindOptions
getMatchAdjustmentOptions, getMaxMatchesToActOn, getSearchDuration, getSearchRegions, getSimilarity, isCaptureImage, isUseDefinedRegion
Methods inherited from class io.github.jspinak.brobot.action.ActionConfig
getAfterActionLog, getBeforeActionLog, getFailureLog, getIllustrate, getPauseAfterEnd, getPauseBeforeBegin, getSubsequentActions, getSuccessCriteria, getSuccessLog
-
Method Details
-
getFindStrategy
Description copied from class:BaseFindOptions
Gets the find strategy for this options instance.Subclasses should override this method to return their specific strategy. For example, PatternFindOptions would map its Strategy enum to FindStrategy, while ColorFindOptions would return FindStrategy.COLOR.
- Specified by:
getFindStrategy
in classBaseFindOptions
- Returns:
- The find strategy to use for this find operation
-
forScreenRecognition
Creates a configuration optimized for screen state recognition.This preset uses high similarity thresholds and strict comparison to accurately identify which known screen state is currently displayed.
- Returns:
- SimilarImagesFindOptions configured for screen recognition
-
forDuplicateDetection
Creates a configuration optimized for finding duplicate images.This preset uses very high similarity thresholds to identify images that are nearly identical.
- Returns:
- SimilarImagesFindOptions configured for duplicate detection
-
forChangeDetection
Creates a configuration optimized for change detection.This preset uses lower similarity thresholds and includes all results to identify which images have changed between collections.
- Returns:
- SimilarImagesFindOptions configured for change detection
-
getComparisonMethod
-
isIncludeNoMatches
public boolean isIncludeNoMatches() -
isReturnAllScores
public boolean isReturnAllScores()
-