class ImageHandler {

    public static boolean isDuplicate(BufferedImage image1, BufferedImage image2) {

        if (image1 == null || image2 == null) {
            return true;
        }

        // normalize size if not done already
        // if (image1.getWidth() != image2.getWidth()) {
        // image1 = rescaleImage(image1, 200);
        // image2 = rescaleImage(image2, 200);
        // }
        //
        // BufferedImage substractedImage = substractImages(image1, image2);
        // float averageGray = getAverageGray(substractedImage);
        //
        // if (averageGray < 50) return true;

        double similarity = getSimilarity(image1, image2, DIFFG);
        // System.out.println(similarity);
        return similarity > 0.82;
    }

}