@Override protected List<ScreenRegion> getUnorderedMatches(ScreenRegion screenRegion) { Rectangle screenRegionBounds = screenRegion.getBounds(); if (screenRegionBounds.width < targetImage.getWidth() || screenRegionBounds.height < targetImage.getHeight()) { // if screen region is smaller than the target, no target can be found // TODO: perhaps a more fault tolerant approach is to return a smaller target with a lower // score return Lists.newArrayList(); } List<TemplateMatcher.Result> matches; BufferedImage screenImage = screenRegion.capture(); List<Rectangle> rois = screenRegion.getROIs(); if (rois.isEmpty()) { matches = TemplateMatcher.findMatchesByGrayscaleAtOriginalResolution( screenImage, targetImage, getLimit(), getMinScore()); } else { matches = TemplateMatcher.findMatchesByGrayscaleAtOriginalResolutionWithROIs( screenImage, targetImage, getLimit(), getMinScore(), rois); } return convertToScreenRegions(screenRegion, matches); }