Package org.eclnt.ccee.image
Class ImageCompare
java.lang.Object
org.eclnt.ccee.image.ImageCompare
Utility for comparing two images.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic float
compareImages
(BufferedImage image1, BufferedImage image2) Short version ofcompareImages(BufferedImage, BufferedImage, Color)
usingColor.WHITE
as defaultColor.static float
compareImages
(BufferedImage image1, BufferedImage image2, Color defaultColor)
-
Constructor Details
-
ImageCompare
public ImageCompare()
-
-
Method Details
-
compareImages
Short version ofcompareImages(BufferedImage, BufferedImage, Color)
usingColor.WHITE
as defaultColor. -
compareImages
- 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 isColor.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
-