Class ImageUtils


  • public class ImageUtils
    extends Object
    Utility methods for image processing.
    • Constructor Detail

      • ImageUtils

        public ImageUtils()
    • Method Detail

      • getImageAsFile

        public File getImageAsFile​(String imageName)
        Parameters:
        imageName - the name of a test image (as used in the locator yaml files)
        Returns:
        a File representing the specified image
      • getImageAsBase64String

        public String getImageAsBase64String​(String imageName)
        Parameters:
        imageName - the name of a test image (as used in the locator yaml files)
        Returns:
        a Base64 encoded String representing the specified image
      • getFullPath

        public String getFullPath​(String imageName)
        Parameters:
        imageName - the name of a test image (as used in the locator yaml files)
        Returns:
        the fully-qualified path to the specified image
      • encodeBase64

        public String encodeBase64​(String fullPath)
        Parameters:
        fullPath - fully-qualified path to an image file
        Returns:
        a Base64 encoded String representing the specified image
      • imageToBase64String

        public byte[] imageToBase64String​(BufferedImage image)
        Parameters:
        image - a BufferedImage
        Returns:
        a Base64 encoded String representing the specified image
      • scaleImage

        public BufferedImage scaleImage​(BufferedImage image,
                                        double scaleFactor)
        Parameters:
        image - the BufferedImage to scale
        scaleFactor - the scale factor (<1 will scale down, >1 will scale up, 1 = 100%)
        Returns:
        a BufferedImage which is a version of the original image scaled by the given factor
      • scaleImage

        public org.opencv.core.Mat scaleImage​(org.opencv.core.Mat image,
                                              double scaleFactor)
        Parameters:
        image - the Mat to scale
        scaleFactor - the scale factor (<1 will scale down, >1 will scale up, 1 = 100%)
        Returns:
        a Mat which is a version of the original image scaled by the given factor