Class ImageCompare

java.lang.Object
org.eclnt.ccee.image.ImageCompare

public class ImageCompare extends Object
Utility for comparing two images.
  • Constructor Details

    • ImageCompare

      public ImageCompare()
  • Method Details

    • compareImages

      public static float compareImages(BufferedImage image1, BufferedImage image2)
      Short version of compareImages(BufferedImage, BufferedImage, Color) using Color.WHITE as defaultColor.
    • compareImages

      public static float compareImages(BufferedImage image1, BufferedImage image2, Color defaultColor)
      Parameters:
      image1 -
      image2 -
      defaultColor - A default color: if pixels are the same and the color of the pixels is the defaultColor, then they are not counted. Default value is Color.WHITE. - Typically you compare images that e.g. have a white background. Espcecially when comparing images containing text then "nearly all" pixels are white and as result the ration of same pixels between image1 and image2 always is very high. By using the defaultColor the white pixels are not counted. - You may pass null, so that really all pixels are counted for building the ratio.
      Returns:
      ratio of pixels that are different between image1 and image2