Q: Comparing two images in Sikuli import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.sikuli.basics.Settings;
import org.sikuli.natives.OCR;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Finder;
import org.sikuli.script.Match;
import org.sikuli.script.Pattern;
import org.sikuli.script.Region;
import org.sikuli.script.Screen;

public class DesktopAutomate {

    public static void main(String[] args) throws FindFailed, IOException, InterruptedException {

        Screen screen = new Screen();
        // here is the cheque
        Pattern pattern = new Pattern("C:\\Users\\vk250281\\Desktop\\VIEWER\\hdfc-bank-cheque-new.PNG");

        // String file1 = "C:\\Users\\vk250281\\Desktop\\website\\new.jpg";

        Pattern pa1 = new Pattern("C:\\Users\\vk250281\\Desktop\\VIEWER\\Capture11.PNG");

        // Image image1 = Toolkit.getDefaultToolkit().getImage(file1);

        System.setProperty("webdriver.chrome.driver",
                "C:\\Users\\vk250281\\Downloads\\chromedriver_win32\\chromedriver.exe");

        ChromeOptions options = new ChromeOptions();
        options.addArguments("--start-fullscreen");

        WebDriver driver = new ChromeDriver(options);
        // to on ocr settings

        Settings.OcrTextSearch = true;

        Settings.OcrTextRead = true;

        // here i was trying to break image in text but that to is not producing
        // expected results

        driver.get("file:///C:/Users/vk250281/Desktop/VIEWER/ImageViewer_dev.html");

        WebElement webElement = driver.findElement(By.xpath("//*[@id=\"frontImageViewer\"]/div[2]/div/img[1]"));

        Thread.sleep(5000);// wait added for taking proper screen shot

        /*
         * Finder finder1 = new Finder(pa1.getImage());// to find the image on
         * the screenshot captured
         * 
         * 
         * if(finder1.find(pa1) != null) { System.out.println("aaaa");
         * screen.mouseMove(pa1);
         * 
         * screen.click(pa1);
         * 
         * //screen.click(pa1);
         * 
         * }
         */

        ImageIO.write(screen.capture().getImage(), "PNG", new File(System.getProperty("user.dir")
                + "/TestImages/test.png"));
        /*
         * OCR ocr = OCR. // can be set to "numbers" if you need only digits to
         * be read String text = ocr.read(new Rectangle(200, 300, 100, 50));
         * System.out.println("Text is: " + text);
         */

        // here it captures the screenshot and compare with the image in
        // database but even though the images are same iit doesn't produce
        // expected results

        Finder finder = new Finder(screen.capture().getImage());

        finder.find(pattern.similar(1));

        if (finder.hasNext()) {
            Match m = finder.next();
            System.out.println("MATCH FOUND with " + (m.getScore()) * 100 + "%");
            finder.destroy();
            driver.close();
        } else {
            System.out.println("No Match Found");
            driver.close();
        }

    }

}

Is there any alternative approach?
P.S. This is the image i want to compare

A: In My Case the images i was comparing were of different resolutions and sikuli compares images with same resolution hence it didn't worked for me but I used OpenCv library to achieve what I wanted....Thanks.
