Class ImageUtils

java.lang.Object
io.github.jspinak.brobot.imageUtils.ImageUtils

@Component public class ImageUtils extends Object
  • Constructor Details

  • Method Details

    • saveRegionToFile

      public String saveRegionToFile(Region region, String path)
      Saves the region to file as a .png file.
      Parameters:
      region - The region to save
      path - The base path name: the first free filename will be used based on the base path name and an available number.
      Returns:
      The path name used to save the file.
    • saveBuffImgToFile

      public String saveBuffImgToFile(BufferedImage bufferedImage, String path)
    • saveScreenshotToFile

      public String saveScreenshotToFile(String path)
    • getFreePath

      public String getFreePath(String path)
      Searches for the first free filename with the given base path name.
      Parameters:
      path - the base path name
      Returns:
      the path name with the first free filename
    • getFreePath

      public String getFreePath(String prefix, String suffix)
    • getFreePath

      public String getFreePath()
    • getFreeNumber

      public int getFreeNumber()
    • getFreeNumber

      public int getFreeNumber(String path)
    • matToPattern

      public Pattern matToPattern(org.bytedeco.opencv.opencv_core.Mat mat, String name)
      Saves the Mat as a .png to file and creates a Pattern object.
      Parameters:
      mat - the Mat to save
      name - name without filetype, saved as .png, overwrites a file with the same name
      Returns:
      a Pattern object
    • writeWithUniqueFilename

      public boolean writeWithUniqueFilename(org.bytedeco.opencv.opencv_core.Mat mat, String nameWithoutFiletype)
    • writeAllWithUniqueFilename

      public boolean writeAllWithUniqueFilename(List<org.bytedeco.opencv.opencv_core.Mat> mats, List<String> filenames)