java.lang.Object
io.github.jspinak.brobot.model.element.Image

public class Image extends Object
Physical representation of an image in the Brobot GUI automation framework.

Image serves as the core container for visual data in Brobot, providing a unified interface for working with images across different formats and libraries. It acts as the bridge between Java's BufferedImage, OpenCV's Mat format, and SikuliX's image representation, enabling seamless interoperability.

Key features:

  • Multi-format Support: Stores images as BufferedImage internally with conversions to Mat (BGR/HSV) and SikuliX formats
  • Database Persistence: Serializable to byte arrays for storage
  • Color Space Conversions: Built-in BGR and HSV representations for advanced color-based matching
  • Flexible Construction: Can be created from files, BufferedImages, Mats, Patterns, or SikuliX images

Use cases in model-based automation:

  • Storing screenshots captured during automation execution
  • Holding pattern templates for visual matching
  • Providing image data for color analysis and profiling
  • Enabling image manipulation and processing operations

The Image class abstracts away the complexity of working with multiple image libraries, providing a consistent API that supports the framework's cross-platform and technology-agnostic approach to GUI automation.

Since:
1.0
See Also:
  • Constructor Details

    • Image

      public Image(BufferedImage bufferedImage)
    • Image

      public Image(BufferedImage bufferedImage, String name)
    • Image

      public Image(org.bytedeco.opencv.opencv_core.Mat BGRmat)
    • Image

      public Image(org.bytedeco.opencv.opencv_core.Mat BGRmat, String name)
    • Image

      public Image(String filename)
    • Image

      public Image(Pattern pattern)
    • Image

      public Image(org.sikuli.script.Image image)
    • Image

      public Image()
  • Method Details

    • getMatBGR

      public org.bytedeco.opencv.opencv_core.Mat getMatBGR()
      Returns the BGR representation as a JavaCV Mat. If there is a conversion issue, an empty Mat is returned.
      Returns:
      the image as a Mat.
    • getMatHSV

      public org.bytedeco.opencv.opencv_core.Mat getMatHSV()
      Returns the HSV representation as a JavaCV Mat. If there is a conversion issue, an empty Mat is returned.
      Returns:
      the image as a Mat.
    • isEmpty

      public boolean isEmpty()
    • sikuli

      public org.sikuli.script.Image sikuli()
    • setName

      public void setName(String name)
    • setBufferedImage

      public void setBufferedImage(BufferedImage bufferedImage)
    • w

      public int w()
    • h

      public int h()
    • getEmptyImage

      public static Image getEmptyImage()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getName

      public String getName()
    • getBufferedImage

      public BufferedImage getBufferedImage()